Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulation loops infinitely with python processes #209

Closed
juan-g-bonilla opened this issue Feb 23, 2023 · 1 comment · Fixed by #239
Closed

Simulation loops infinitely with python processes #209

juan-g-bonilla opened this issue Feb 23, 2023 · 1 comment · Fixed by #239

Comments

@juan-g-bonilla
Copy link
Contributor

juan-g-bonilla commented Feb 23, 2023

Describe the bug
A SimBaseClass will freeze (loop infinitely) when including a simulationArchTypes.PythonProcessClass with priority higher than other C/C++ processes in the sim.

To reproduce

from Basilisk.utilities import SimulationBaseClass
from Basilisk.utilities import macros

def test(freeze):

    scSim = SimulationBaseClass.SimBaseClass()

    dynProcess = scSim.CreateNewProcess("simProcess", 10)
    dynProcess.addTask(scSim.CreateNewTask("sensorTask", macros.sec2nano(10.)))

    # Note that having a python priority > C/C++ priority
    # causes a freeze, but not the other way around
    pyProcess = scSim.CreateNewPythonProcess("python", 11 if freeze else 9)

    scSim.InitializeSimulation()
    scSim.ConfigureStopTime(macros.sec2nano(30))
    scSim.ExecuteSimulation()

    print(f"Finished running (Was supposed to freeze? {freeze})")

if __name__ == '__main__':
    test(False)
    test(True) # You are going to have to kill it

Expected behavior
Either not freezing, or a clear error message when trying to create python processes with higher priority than C++ processes.

Desktop:

  • OS: Windows 64bit
  • Version 2.1.7b0 (built with develop when the latest commit was 4f6c57d at February 22nd, 2023 5:17 PM)
  • Python version: Python 3.11.0

Additional context
I would suggest adding an error message for the time being (as you are not supposed to use python processes with higher priority than C/C++ anyway, and this would make it very clear) until #200 gets implemented.

@joaogvcarneiro
Copy link
Contributor

Thanks for pointing this out, @juan-g-bonilla. The last time I worked with Python processes, the simulation didn't freeze. Rather, it simply ignored my priority setting and ran the Python process at the end.

Thanks for mentioning issue #200. This might be a higher priority than I had initially considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants