Skip to content

Conversation

gwenzek
Copy link
Contributor

@gwenzek gwenzek commented Jan 8, 2021

I propose the following to solve #12

I think that the less surprising behavior possible.
We restore sys.path to whatever it was when we created the job instance.

In practice the two paths only differs on the first entry, but I'm not sure we want to assert that.
The scheduler script generally has the folder of scheduler script as first entry while the submitted job has the current folder.

Ouput of test_submitit_respects_sys_path if you skip the sys.path reloading:

E         - /private/var/folders/db/tkc8c7p17xzgpf_kv6ybsdcdng_9j1/T/pytest-of-guw/pytest-81/test_submitit_respects_sys_pat0
E         + /Users/guw/Documents/github/submitit
E           /opt/homebrew/Cellar/python37/3.7.5_3/Frameworks/Python.framework/Versions/3.7/lib/python37.zip
E           /opt/homebrew/Cellar/python37/3.7.5_3/Frameworks/Python.framework/Versions/3.7/lib/python3.7
E           /opt/homebrew/Cellar/python37/3.7.5_3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload
E           /Users/guw/Documents/github/submitit/venv/lib/python3.7/site-packages
E           /Users/guw/Documents/github/submitit

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 8, 2021
@gwenzek gwenzek requested review from LowikC and jrapin January 8, 2021 16:01
@gwenzek gwenzek changed the title reload sys.path on job start #12 reload sys.path on job start Jan 8, 2021
self._result: Any = None
self._done = False
self.timeout_countdown: int = 0 # controlled in submission and execution
self.sys_path = list(sys.path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably hide it, and use a tuple to make it unmutable.
I am not sure I like it. I am actually pretty sure I don't :D but if that fixes it, then why not (modulo the other comment...)

@facebook-github-bot
Copy link

Hi @gwenzek!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants