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

Fix --persist mila code bug and intermittent connection errors [MT-78] #101

Merged
merged 20 commits into from
Feb 19, 2024

Conversation

lebrice
Copy link
Collaborator

@lebrice lebrice commented Feb 13, 2024

@lebrice lebrice changed the title Fix --persist bug and unneeded cd $SCRATCH Fix --persist bug and unneeded cd $SCRATCH [MT-78] Feb 13, 2024
@codecov-commenter
Copy link

codecov-commenter commented Feb 14, 2024

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (b823319) 61.03% compared to head (e4686bb) 61.73%.

Files Patch % Lines
milatools/cli/commands.py 51.16% 21 Missing ⚠️
milatools/cli/remote.py 77.77% 4 Missing ⚠️
milatools/cli/local.py 80.00% 1 Missing ⚠️
milatools/cli/utils.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #101      +/-   ##
==========================================
+ Coverage   61.03%   61.73%   +0.69%     
==========================================
  Files           9        9              
  Lines        1404     1445      +41     
==========================================
+ Hits          857      892      +35     
- Misses        547      553       +6     
Flag Coverage Δ
integrationtests 24.91% <14.28%> (+13.73%) ⬆️
unittests 61.73% <61.42%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lebrice lebrice changed the title Fix --persist bug and unneeded cd $SCRATCH [MT-78] Fix --persist bug, unneeded cd $SCRATCH and intermittent connection errors [MT-78] Feb 14, 2024
@lebrice lebrice changed the title Fix --persist bug, unneeded cd $SCRATCH and intermittent connection errors [MT-78] Fix --persist mila code bug and intermittent connection errors [MT-78] Feb 14, 2024
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
`alloc` needs to be a list of strings, but it was typed as
`Sequence[str]`, which allows `str` to be passed (since `str`s are
sequences of `str`s).

This changes it to `list[str]` which is stricter and correct.

Incidentally, there was an undetected bug in the regression test at
`tests/integration/test_code_command.py::test_code` because I was
passing the allocation flags (a string) as salloc.

Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice Normandin <[email protected]>
@lebrice lebrice requested a review from satyaog February 16, 2024 14:35
Comment on lines 620 to 621
if "pytest" in sys.modules:
break
Copy link
Member

@satyaog satyaog Feb 16, 2024

Choose a reason for hiding this comment

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

This is the only change that should be done before merging as this looks like left over from debug

Would this break mila code if someone installs pytest in the same env? Probably better to use an environment variable instead?

Suggested change
if "pytest" in sys.modules:
break

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This just checks if it's run from within pytest. This doesn't change anything during normal operation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not leftover from debug, it's actually just an easy way to change the behaviour of the code when it's being run within pytest. I'll make a small function to make this easier to read.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 6411d30

milatools/cli/commands.py Outdated Show resolved Hide resolved
Comment on lines +1098 to +1099
# The next line may overflow to two (or maybe even more?) lines if the name of the
# $HOME dir is too long.
Copy link
Member

Choose a reason for hiding this comment

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

It does? That's a shame :( But this could mean a quota could also be splitted in two line right having
104
8576
instead of 1048576?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Words aren't split, but what happens is that the home folder is on a single line and the rest on another line.
This here would also work the quotas somehow needed more than one line to display, also.

milatools/cli/remote.py Outdated Show resolved Hide resolved
milatools/cli/utils.py Outdated Show resolved Hide resolved
lebrice and others added 3 commits February 16, 2024 17:24
@lebrice lebrice merged commit 7c733d1 into mila-iqia:master Feb 19, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants