-
Notifications
You must be signed in to change notification settings - Fork 18
Add Python 3 support #106
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
Add Python 3 support #106
Conversation
12cf403 to
23fc412
Compare
|
This makes #89 Invalid. |
scripts/smart_dispatch.py
Outdated
| parser.add_argument('-g', '--gpusPerCommand', type=int, required=False, help='How many gpus a command needs.', default=1) | ||
| # parser.add_argument('-m', '--memPerCommand', type=float, required=False, help='How much memory a command needs (in Gb).') | ||
| parser.add_argument('-f', '--commandsFile', type=file, required=False, help='File containing commands to launch. Each command must be on a seperate line. (Replaces commandAndOptions)') | ||
| parser.add_argument('-f', '--commandsFile', type=str, required=False, help='File containing commands to launch. Each command must be on a seperate line. (Replaces commandAndOptions)') |
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 change file to str ?
|
Not familiar with the code base, but with the comments addressed, the changes look fine to me. |
| @@ -1,7 +1,7 @@ | |||
| language: python | |||
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.
Wh should add unit test in python 3
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.
Already done :-), check below.
59c4d0c to
cc98728
Compare
|
Thank you @ASalvail for your comments. |
|
@mgermain I added a unit test for the --commandsFile option. Make sure you check https://github.com/SMART-Lab/smartdispatch/pull/106/files#diff-f3e1285c65572b36c9b0f21b0734c260 |
| end = int(groups[1]) | ||
| step = 1 if groups[2] is None else int(groups[2]) | ||
| return map(str, range(start, end, step)) | ||
| return [str(i) for i in range(start, end, step)] |
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.
Were we really using map everywhere for no reasons ?
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.
Yes and no. In Python 3, map returns a generator instead of a list. What we want here is a list, so we are better off using list comprehension instead.
cc98728 to
c85fb5f
Compare
…ytes to str and removed function file in argparse
c85fb5f to
6eb7f8e
Compare
|
See PR #161 |
It's all in the title. :D
Maybe @ASalvail could you have a quick look at this one whenever you have time.
Edit: closes #89