Repository navigation
Conversation
guillaumeeb
left a comment
There was a problem hiding this comment.
Thanks @ericmjl!
A few comments, have a look at distributed.utils for memory string conversion.
| Destination queue for each worker job. Passed to `#$ -q` option. | ||
| memory: str | ||
| The amount of memory requested per worker job. Passed to `#$ -l` option. Can be | ||
| specified in lieu of `resource_spec`. |
There was a problem hiding this comment.
Not sure you should override default docstring here. The addition you make should be implicit, even if it is not the case currently.
There was a problem hiding this comment.
Ok! Will take this out.
There was a problem hiding this comment.
@guillaumeeb, actually, I think the default docstring should be overridden, so as to make clear what memory is being specified.
As I learned today, there are multiple memory specification possibilities for grid engine. Two that I currently know of are m_mem_free and h_vmem. In this PR, I am forcing the memory keyword argument to be passed into m_mem_free, and I think this should be made explicit for SGECluster users.
As far as I can tell, m_mem_free is the most commonly used option for memory specification in job scripts here at work. h_vem is less commonly used. I expect that m_mem_free should be the correct default option for 95% of SGECluster use cases.
The Zen of Python states that "explicit is better than implicit", and I think it'd be better to state explicitly in the docstring that memory is passed to #$ -l m_mem_free, so that the end-user knows that if they need to specify h_vmem instead/on top the requested worker RAM, they still can do so with the resource_spec keyword argument as well.
There was a problem hiding this comment.
I'm just not sure of what will append to the consolidated docstring, as memory is already defined in JobQueueCluster class in core.py:
memory: str
Total amount of memory per job
You may end up with two different memory entries in the docstring. This is worth testing, or maybe look at docrep module to see if it provide some tools for this case.
There was a problem hiding this comment.
Understood. Thank you for pointing that out! I will ensure that the docs are clear and unambiguous on this pointer.
|
|
||
| # Define resource specifications. There are only two cases allowed in this | ||
| # implementation: either specify using resource_spec, or specify using the rest of the | ||
| # kwargs. |
There was a problem hiding this comment.
@lesteve would say that this comment is useless, the code is explicit :)
| if resource_spec is not None: | ||
| header_lines.append('#$ -l %(resource_spec)s') | ||
| else: | ||
| header_lines.append('#$ -l m_mem_free=%s' % parse_memory(kwargs.get('memory'))) |
There was a problem hiding this comment.
I'm wondering if you could add CPU resources spec too, even if this is not the original problem, shouldn't be too hard or introduce much noise.
There was a problem hiding this comment.
I'd like to hold off on that, but only for this PR. Happy to do it in a separate PR, so that we can settle issues independently.
There was a problem hiding this comment.
m_mem_free does not exist on my SGE cluster. Quickly googling this may only exist for Univa Grid Engine.
On my cluster there is mem_req that could be used. Does that exist on yours @ericmjl?
There was a problem hiding this comment.
It does not look like mem_req is standard at all ... not sure what to do.
There was a problem hiding this comment.
@lesteve I am starting to discover this as well. It appears that mapping the memory keyword argument to any particular configuration string is not going to be productive.
I am beginning to think I should close this PR and open a new PR with the following changes:
- Notification to end-user that the
memorykwarg is not mappable to memory configuration, because the grid engine system is too flexible in this regard. - Documentation fix that states clearly that an end-user needs to know how memory requirements are specified per job.
There was a problem hiding this comment.
Wow, that's good to know! It there is no memory option standard, then yes, no other choice to keep with resources_spec and document this.
| logger.debug("Job script: \n %s" % self.job_script()) | ||
|
|
||
|
|
||
| def parse_memory(memory: str): |
There was a problem hiding this comment.
I think the input to this fonction should be worker_memory, that we optain using distributed.utils.parse_bytes. Memory kwarg can be a number with no explicit unit if I'm not mistaken. You should probably use format_memory from the same package, and base your conversation from its output.
There was a problem hiding this comment.
@guillaumeeb I did a search of dask/distributed for format_memory, but could not find it. Here's the URL to the search: https://github.com/dask/distributed/search?utf8=✓&q=format_memory&type=
Can you point to where the function format_memory is located?
There was a problem hiding this comment.
Thanks @mrocklin! Just to confirm, then, @guillaumeeb, you were referring to parse_bytes when you wrote format_memory? Having found parse_bytes, I think I know how to move forward from here.
There was a problem hiding this comment.
You've got format_bytes just above, sorry the function name I used was wrong: https://github.com/dask/distributed/blob/964a917c45e8c11b16086cf05949d3529cc0986a/distributed/utils.py#L1081-L1107.
The only thing is that format_bytes uses "real" Giga/Mega/Kilobytes and note Gibi/Mebi/Kibibytes (see https://en.wikipedia.org/wiki/Gibibyte). For example, PBS uses the GB term, but its meaning is GiB. See https://github.com/dask/dask-jobqueue/blob/master/dask_jobqueue/pbs.py#L106-L128. But I actually don't really like this part of the code, and since GiB>GB, I think it's fine to use Dask's GB as GiB for PBS/SGE, without doing a real conversion.
|
As for your questions, it would definitly be valuable to have a test, at least checking that the job_script contains the correct resource_spec even without specifying it. For the docstring as you wish, this does not look mandatory to me. |
|
Broken CI seems unrelated to your PR, see #201. |
|
CI problem is corrected on master, you can merge it to have correct Travis inputs. |
|
@guillaumeeb, it appears that my use of mypy-style type annotations is breaking tests. Happy to remove it, though can I just check, is mypy being used in dask-jobqueue? |
Nope, never used it. From what I've seen in Dask related projects, we usually just use docstrings to precise args type, or don't precise it at all. |
|
@guillaumeeb yes, closing right now! |
cc: @jhamman, @sntgluca, @guillaumeeb
I am proceeding with very small steps with this PR. This PR is a very focused one, and only adds a memory string parser, such that an end-user can specify the amount of RAM that they would like per worker node.
I have done the following:
If I remember correctly, I can use multiple lines to specify resources. Hence:
should be equivalent to:
@sntgluca, can you confirm/disprove my memory on this?
Still wondering about the following:
If merged, then this PR resolves in part #195, but not fully.