You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement a tool that executes some commands in CANoe, using for that the py_canoe library. If I implement all the CANoe calls in the main thread everything works fine, but since some of them take a lot of time (highest being 4 mins) I want to execute it a parallel thread and keep the main one only for GUI updates.
When I do this, I can see some strange cases where the CANoe execution stops after opening the instance, depending on the machine I execute the tool on, being a sporadic issue. As a hint, I'm using pySimpleGUI for the UI and I use the built-in thread implementation, but I have already tried to code it myself and the result is the same.
I don't see whether this library is thread safe or not in the documentation, so I'm assuming it's not, and that's why I am having such problems.
Has anyone seen anything similar? Is anyone executing this library in a GUI or multi-thread application? If so, how?
This is an example of my code:
Pd_conf.MainWindow.perform_long_operation(func=lambda: execute_smoketests(choice), end_key="--PRECONDITION_CHECK_DONE--")
event, values = Pd_conf.MainWindow.read(timeout=0)
event = None
print(f"TARGET : Execute the following smoke tests: {choice}")
print(f"Duration : 0:00:00") # noqa: F541
timeDelta = 0
compileStart = datetime.now()
while event != "--PRECONDITION_CHECK_DONE--":
event, values = Pd_conf.MainWindow.read(timeout=1000)
if (datetime.now() - compileStart).seconds > timeDelta:
# Get time delta since start of CANoe operation
timeDelta = (datetime.now() - compileStart).seconds
# Update print output if one second has passed
print(f"Duration : {timedelta(seconds=timeDelta)}", replace=f"Duration : {timedelta(seconds=timeDelta-1)}")
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to implement a tool that executes some commands in CANoe, using for that the py_canoe library. If I implement all the CANoe calls in the main thread everything works fine, but since some of them take a lot of time (highest being 4 mins) I want to execute it a parallel thread and keep the main one only for GUI updates.
When I do this, I can see some strange cases where the CANoe execution stops after opening the instance, depending on the machine I execute the tool on, being a sporadic issue. As a hint, I'm using pySimpleGUI for the UI and I use the built-in thread implementation, but I have already tried to code it myself and the result is the same.
I don't see whether this library is thread safe or not in the documentation, so I'm assuming it's not, and that's why I am having such problems.
Has anyone seen anything similar? Is anyone executing this library in a GUI or multi-thread application? If so, how?
This is an example of my code:
Beta Was this translation helpful? Give feedback.
All reactions