Repository navigation
Conversation
|
The unit test and the CI environment are not integrated. Currently the test is passed because the I don't know the environment well enough to fix this. May someone help me? |
|
ping @lesteve who implemented SGECluster and associated CI. I will try to look at this PR too. |
guillaumeeb
left a comment
There was a problem hiding this comment.
So my main point would be to make the change in __init__() if possible. I don't see the need for using a mix of arrays and standard job in one cluster instance (but I may be wrong).
|
|
||
| logger.debug("Job script: \n %s" % self.job_script()) | ||
|
|
||
| def start_workers(self, n=1, ta=True): |
There was a problem hiding this comment.
I know this is only a poc on SGE, but I would propose a use_job_arrays, or use_task_arrays at class level. So directly in JobQueueCluster __init__() method in the end.
There was a problem hiding this comment.
Hi @guillaumeeb ,
this is a nice suggestion. I can implement the change.
I am working on this in my free time, so I am quite slow to follow up...
There was a problem hiding this comment.
Sure, take your time, I know this situation :)
| if ta: | ||
| logging.debug('Submission using task array') | ||
| _original_command_template = self._command_template | ||
| self._command_template = self._command_template.replace('${JOB_ID}', '${JOB_ID}.${SGE_TASK_ID}') |
There was a problem hiding this comment.
Maybe we should always have an ID that takes into account potential job arrays or task arrays. the task array part would potentially be empty.
There was a problem hiding this comment.
It would be excellent, I am afraid it's difficult to abstract it for all schedulers. I don't remember how job arrays are defined in different schedulers.
Will consider and come up with a suggestion.
There was a problem hiding this comment.
See how this is done with JOB_ID in PBSCluster currently: https://github.com/dask/dask-jobqueue/blob/master/dask_jobqueue/pbs.py#L98. A simple line in __init__() specific to all Scheduler could be used.
There was a problem hiding this comment.
Hi @guillaumeeb ,
thanks for the hint!! I used your approach, and redefined JOB_ID to handle task arrays.
One caveat to note: JOB_ID is the variable name that UGE/SGE uses to define their Job ID. We are kinda breaking the consistency with the scheduler.
In other schedulers, as PBS, the same variable is called PBS_JOBID, hence there's no problem...
I don't see it as a problem, but it's worth to keep it in mind.
There was a problem hiding this comment.
Yep, maybe we would need to change the name at one point.
|
|
||
| num_jobs = int(math.ceil(n / self.worker_processes)) | ||
| header_template = self.job_header | ||
| self.job_header = header_template + '\n#$ -t 1-{}'.format(num_jobs) |
There was a problem hiding this comment.
Yes I think that this too should go in __init__()
There was a problem hiding this comment.
Hi, I find this one a bit trickier, since num_jobs is defined when the start_workers function is called.
I could only think of passing num_jobs as
- a placeholder in the configuration (current solution):
config = {'num_jobs_placeholder': '%(num_jobs)d'}` ... self.job_header = self.job_header % {'num_jobs' : num_jobs} - an environmental variable to be picked up by
self.job_header - an attribute to substitute in
self.job_header
Any other idea?
There was a problem hiding this comment.
You're right, no better idea. Just try to avoid as much as possible code duplication.
| from __future__ import absolute_import, division, print_function | ||
|
|
||
| QUEUE_WAIT = 15 # seconds | ||
| QUEUE_WAIT = 120 # seconds |
There was a problem hiding this comment.
120 seconds is a lot of time!
There was a problem hiding this comment.
Yeah, the scheduler I could test with has longer waiting times...
I run my tests with a longer QUEUE_WAIT, and I forgot to revert to the default value before submitting the pull request.
Should be fixed now.
| """ Starts a small cluster and returns information on jobs and tasks """ | ||
| cluster.scale(size) | ||
| # waiting to allow cluster to start (no pending jobs) | ||
| sleep(2) |
There was a problem hiding this comment.
is this sleep(2) mandatory?
There was a problem hiding this comment.
I need to check if it can be removed.
I added it to give time for the cluster.pending_jobs to be populated.
I was thinking that without it, pending_jobs could be empty because the jobs haven't been scheduled, not because they are running.
Do you have a better suggestion?
There was a problem hiding this comment.
I'm not sure I get it right, you don't have the SGE_TASK_ID variable despite the fact of having launched a job array? Or maybe your talking about the line ta = ta and bool(os.getenv('SGE_TASK_ID', None))I did not see this, but when you call this, you're in the Notebook process, not inside a job. So there is no reason this environment variable is declared, is there? |
|
Hi @guillaumeeb ,
I am confused because I consider But in the CI test suite it's undefined. IMHO to fix this we should find how to configure the tests to include/allow job arrays. |
I was probably not clear. There is no reason Maybe your talking about a problem you've got later in the test process? In this case, please remove this check so that we can see what is going on! |
… use of task arrays. SGE only
|
Hi @lesteve , may you take a look at and evaluate this pull request?
Thanks |
|
Sorry I did not have time to look at this. To sum up, my feeling echoes the feeling of other people in the associated issue (#196): task array support does not seem worth the effort. I will comment on #196 with more complete thoughts. Sorry if you feel disappointed because you have spent time on this without seeing it get into Contributions to |
|
I'm intentionnaly leaving aside the discussion about the importance of this evolution or not, if it's worth for you then you can try to fix it!
For this part, you did not answer my comments: there is no reason for the env variable to be set when you initialize your cluster object or call |
|
@lesteve , I am indeed more comfortable with the package now. I will try to contribute and see where this can lead me :) |
|
I initially added a check in SGECluster to be sure that task arrays could be used, and reverted to using normal jobs if To answer you question, I removed the checks from the code and from the tests. Waiting to see what happens... |
|
Closing this pull request, not in line with current ideas about task array support. |
This is the PoC to implement using job arrays (task arrays) #196
For the moment the implementation is only available for the SGE cluster.
The implementation redefines
self._cluster_templateto include the'SGE_TASK_ID'variable and rewrites thestart_workers()method insge.py:SGECluster.There's a new test
test_sge.py:test_taskarrays()to check basic stats on the new function.I also changed the
QUEUE_WAITtime in the tests to allow for more time (my tests required more time).As a starting strategy, the use of task arrays is determined via a new
taargument inSGECluster:start_workers().start_workers(ta=True):the system checks if it can use task arrays and runs the new function.
start_workers(ta=False)or if task arrays cannot be run:it defaults to the original
JobQueueCluster:start_workers()function.The
taargument is True by default, and it's not yet exposed toscale(). Which means, the use of task arrays is automatically activated by default.