SpiNNakerManchester / SpiNNMan

Interface to SpiNNaker boards from Python
Apache License 2.0
5 stars 1 forks source link

job keep alive causing a restart on Windows #402

Open Christian-B opened 1 month ago

Christian-B commented 1 month ago

launch_keepalive_task https://github.com/SpiNNakerManchester/SpiNNMan/blob/cdfc5e40fbced5be33f0c8dff7d3f83d38943bad/spinnman/spalloc/spalloc_client.py#L671

On a windows machine was causing the whole script to restart.

This was found to be caused by spawn https://docs.python.org/3/library/multiprocessing.html

The problem is that spawn creates a new python instants and import all the code running.

If the start script does not have "if name == 'main':" this will cause the script to restart!

Christian-B commented 1 month ago

A work around is to force all scripts (for Window users) to have if name == 'main':"

Yes many Python tutorials do highly recommend that.

It would however break out script check code which depends on the script being written the (some would say sloppy) way without the if name == name

Christian-B commented 1 month ago

the main problem is that many users scripts do not have the if name == main: