-
Notifications
You must be signed in to change notification settings - Fork 13
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
Files used by jobs need to be on a shared FS. This is typically the case #448
Conversation
except that the ci_runner, when testing various branches, does the cloning in `/tmp`. One alternative solution would be to ensure this is moved to the home dir.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #448 +/- ##
==========================================
+ Coverage 74.48% 74.60% +0.11%
==========================================
Files 94 94
Lines 3872 3890 +18
==========================================
+ Hits 2884 2902 +18
Misses 988 988 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment, otherwise looks good to me - thanks!
# returns the resulting path | ||
if isinstance(path, str): | ||
path = Path(path) | ||
with tempfile.NamedTemporaryFile(dir=Path.home() / '.psij' / 'test', delete=False) as df: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the delete=False
and finally
instead of delete=True
(which is the default anyway):
with tempfile.NamedTemporaryFile(dir=Path.home() / '.psij' / 'test') as df:
shutil.copyfile(path, df.name)
yield Path(df.name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point and thanks for commenting on this, since I forgot to close the file. With delete=True
it deletes on close. So if the scenario is to manipulate the file outside of python, you'd close it and pass the name around instead. Without delete=False
, the file will be deleted as soon as it is closed. The need to close is because on some platforms (Windows) the file cannot be opened concurrently. The question that the Python documentation doesn't answer is whether, if the file is deleted, the name property would still be guaranteed to be valid. The wording of the documentation suggests that this may not be the case, although a quick test shows that it is (on my laptop).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, makes sense now, thanks!
@@ -67,6 +67,7 @@ def _deploy(path: Union[Path, str]) -> Iterator[Path]: | |||
path = Path(path) | |||
with tempfile.NamedTemporaryFile(dir=Path.home() / '.psij' / 'test', delete=False) as df: | |||
try: | |||
df.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! :-D
except that the ci_runner, when testing various branches, does the cloning in
/tmp
. One alternative solution would be to ensure this is moved to the home dir.This was basically why
test_prelaunch
andtest_nodefile
failed.