Data streaming error #427
Answered
by
cuihantao
jinningwang
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You can modify the logic in streaming.py so that it won’t close the connection until manually done.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Jinning Wang ***@***.***>
Sent: Tuesday, March 14, 2023 6:40:43 PM
To: CURENT/andes ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [CURENT/andes] Data streaming error (Discussion #427)
Hello Hantao,
I run into an error with the streaming function. In the scenario that I may need to run the TDS with incremental ending time, the data streaming runs into the error OSError: [Errno 9] Bad file descriptor. This error seems to be caused by that once the simulation end, the connection is closed. Then, the streaming will run into error because the file is already closed.
Do you have any clue that we can do a quick fix on this?
The code are attached below:
ss.TDS.config.tf = 30
ss.TDS.run()
Output:
Dime connection to "ipc:///tmp/dime2" was successful.
Broadcast system data. Waiting to receive modules init info...
ss.TDS.config.tf = 60
ss.TDS.run()
Output:
1 ss.TDS.config.tf = 60
----> 2 ss.TDS.run()
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[6], line 2
1 ss.TDS.config.tf = 60
----> 2 ss.TDS.run()
File ~/miniconda3/envs/hlc/lib/python3.10/site-packages/andes/routines/tds.py:419, in TDS.run(self, no_summary, **kwargs)
416 # clear storage in memory anyway
417 dae.ts.reset()
--> 419 self.streaming_step()
421 if self.check_criteria() is False:
422 self.err_msg = 'Violated stability criteria. To turn off, set [TDS].criteria = 0.'
File ~/miniconda3/envs/hlc/lib/python3.10/site-packages/andes/routines/tds.py:1053, in TDS.streaming_step(self)
1051 system = self.system
1052 if system.config.dime_enabled:
-> 1053 system.streaming.sync_and_handle()
1054 system.streaming.vars_to_modules()
1055 system.streaming.vars_to_pmu()
File ~/miniconda3/envs/hlc/lib/python3.10/site-packages/andes/io/streaming.py:371, in Streaming.sync_and_handle(self)
369 if not self.system.config.dime_enabled:
370 return
--> 371 current_devices = self.dimec.devices()
373 # record MiniPMU
374 if not self.has_pmu:
File ~/miniconda3/envs/hlc/lib/python3.10/site-packages/dime/client.py:350, in DimeClient.devices(self)
333 def devices(self):
334 """send Send a "devices" command to the server
335
336 Tell the server to send this client a list of all the named,
(...)
347 A list of all groups connected to the DiME server.
348 """
--> 350 self.__send({"command": "devices"})
351 jsondata, _ = self.__recv()
353 if jsondata["status"] < 0:
File ~/miniconda3/envs/hlc/lib/python3.10/site-packages/dime/client.py:368, in DimeClient.__send(self, jsondata, bindata)
361 jsondata = json.dumps(jsondata).encode("utf-8")
363 data = b"DiME" + \
364 struct.pack("!II", len(jsondata), len(bindata)) + \
365 jsondata + \
366 bindata
--> 368 self.conn.sendall(data)
OSError: [Errno 9] Bad file descriptor
—
Reply to this email directly, view it on GitHub<#427>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABSNZAZUI3MHQBFBVSMVI5DW4D6XXANCNFSM6AAAAAAV3CY5WQ>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jinningwang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Hantao,
I run into an error with the streaming function. In the scenario that I may need to run the TDS with incremental ending time, the data streaming runs into the error
OSError: [Errno 9] Bad file descriptor
. This error seems to be caused by that once the simulation end, the connection is closed. Then, the streaming will run into error because the file is already closed.Do you have any clue that we can do a quick fix on this?
The code are attached below:
Output:
Output:
Beta Was this translation helpful? Give feedback.
All reactions