submitit icon indicating copy to clipboard operation
submitit copied to clipboard

Should submitit be allowed to change `__main__` ?

Open gwenzek opened this issue 4 years ago • 2 comments

In investigating #11 I realized that submitit is changing the value of __main__

Should this be allowed ? It should at least be documented. I've added https://github.com/facebookincubator/submitit/blob/master/submitit/test_pickle.py#L54 to illustrate this behavior.

I don't think we need this to fix #11, but this might cause issues in the future.

@jrapin

gwenzek avatar Nov 26 '20 10:11 gwenzek

Similarly submitit jobs have a different sys.path (probably because of the different __main__ IIUC) and different sys.argv. We could patch sys module to display a warning when reading those from a job. Or we could try to save them with the job pickle and restore them at job start. @jrapin thougths ?

gwenzek avatar Nov 26 '20 10:11 gwenzek

is it easy to reproduce jobs as though main was unchanged? I don't see how, I am not familiar with how it works. If it's possible to store the location (in delayed job?) and get back to it (change dir?), that would be helpful to prevent weird issues indeed I think. Then again, it could create some more :D

jrapin avatar Nov 30 '20 14:11 jrapin