You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SLURM cluster only schedules one task on 20 workers (19 idle) #230
The general idea is to use dask to schedule an embarrassingly parallel problem where each task requires 8 cores (is threaded via OpenMP). That means that one worker should only take one task.
This started here #181 - I'm now running my cluster like this
def test_task(param_id):
# cur_uuid = str(uuid.uuid4())
cur_uuid = param_id
import time
print("\n\n################### STARTING NEW TASK ##############", cur_uuid, '#########')
for i in range(12):
print(cur_uuid, i, 30)
time.sleep(5)
return param_id
I submit jobs using this command: futures = [client.submit(test_task, param_id, resources={'processes':1}) for param_id in range(10000)]
But it seems that only one worker is actually doing anything while the other workers are completely idle (tail-fing the slurm out files)
I am specifically trying this with adaptive scaling and the worker 1 has been sitting there for two minutes not getting any of the 10k tasks and everything is running on the worker 0.
That is worker 2s log:
distributed.worker - INFO - bokeh at: 172.16.2.130:43198
distributed.worker - INFO - Waiting to connect to: tcp://172.16.2.152:41753
distributed.worker - INFO - -------------------------------------------------
distributed.worker - INFO - Threads: 8
distributed.worker - INFO - Memory: 7.00 GB
distributed.worker - INFO - Local Directory: /home/wek224/projects/tardis/nn/hesma/worker-qjv1h0ng
distributed.worker - INFO - -------------------------------------------------
distributed.worker - INFO - Registered to: tcp://172.16.2.152:41753
distributed.worker - INFO - -------------------------------------------------
distributed.core - INFO - Starting established connection
distributed.worker - INFO - Stopping worker at tcp://172.16.2.130:33306
distributed.nanny - INFO - Closing Nanny at 'tcp://172.16.2.130:37770'
distributed.dask_worker - INFO - End worker
That is what I see inside the notebook happening:
DEBUG:removing worker name (dask-worker--14933947--) and job_id (14933947)
and then it relaunches a slurm job to get up to 20 workers again. So worker 1 does all the work while the others are spawned - live for sometime and then die again without having done anything.
what happens if you don't use adaptive, i.e. remove cluster.adapt and use cluster.scale(num_workers_goes_here)?
please post a fully stand-alone snippet so we can try to reproduce. Fully stand-alone means we can copy and paste your snippet and try it on the SLURM clusters we have access to. This is invaluable for us and will increase the likelihood for you to get quality feed-back.
this should be part of the previous bullet points, but can you try replacing your multi-threaded function by a simple Python function (e.g. time.sleep) to see whether you are seeing the same behaviour
I don't think this is part of the problem but you probably don't need job_extra=['--nodes=1', '--ntasks-per-node=1', '--cpus-per-task=8'].
Hey guys, in the process of debugging: I need the job extras as the cluster here does not like it another way: Plase do not specify --ntasks on prince cluster, try to use --nodes and --tasks-per-node together. The test task that I defined is at the top.
@guillaumeeb@lesteve so I am now scaled it to two - but I do not see any print-out in the slurmXXX.outs. Does dask not let the print statements through? Should I define a logging function in my test task?
does not seem to be the case. I have access to the dashboard - it seems to be executing - but nothing in the workers log (when I execute my code - I can definitely see that in the .out file - but I'm using logging).
@wkerzendorf you have to help us help you ;-) ! Without a stand-alone snippet we are reduced to wild guesses which is not the most optimal way of spending our time ...
I strongly suggest:
we look at one problem at a time in this issue. My understanding is that the original question was about the following: only part of the workers are used to run the computation, the rest of the workers do nothing. Correct me if I misunderstood so we can make sure we are all on the same page.
we start with something simple and increase complexity step by step as I suggested in my earlier message
OK so let's start with something simple, single-core jobs with simple Python function. Can you run this in your notebook and post the output you get?
I have also now run this setup and just changed to adapt (and taken out the while loop). When that happens it queues one job (which is not being scheduled because I think the scheduler would like more CPUs to be scheduled) even though the maximum is 3.
I see a similar behavior now - it runs the first worker. then it spawns new workers and immediately kills them. I'm trying to see if it is the resources option but the cluster is very busy and it takes a while.
@guillaumeeb@lesteve - I'm pretty sure that the resources option is to blame. I ran it with and without resources option and with it the behaviour is that it kills the workers as soon as they are spawned because they are idle.
I need the resources because I need my workers to execute something that needs 8 threads but only execute one of these tasks at a time on each SLURM job (I hope that makes sense). I can trick it into doing this by specifying
just an update - with my workaround it works (not using the resource option for now). It works amazingly well (with the nannies killing the workers as they reach their memory limit) - great framework - thank you!!! still interested in helping to get to the bottom of the resource problem.
Thanks @wkerzendorf. The other trick you used was the second solution for your need. The drawback is that you cannot have tasks that need different number of cores, whereas you could with --resources.
So it seems you got the same problem as @leej3 in dask/distributed#1851. This is a distributed issue, I did not have time to dig deeper currently.
I guess it is not needed to post anything more in distributed. But if you can dig deeper the already opened issue and come with some solution, that would be really appreciated (I know, this is probably too much to ask for now).
@guillaumeeb I'm happy to dig deeper on a pair coding session with an experienced dasker. Alone I think I will get quickly lost. I'm also a willing beta tester 😉
This starts running and makes 4 workers on different slurm instances, which is all great. However, like the issue, only one of them actually ends up running, with the others just idling. I wonder if the resources aren't specified per worker, but only one of them gets them, or something?
I tried the workaround suggested above, specifying cores=1, but while that works, in my case it does actually seem to use only one core, which makes my code run much more slowly.
Your problem may be related to the original issue, hard to tell really without investigating more and having a separate issue will help keeping our issue tracker tidy.
Closing this issue as stale, and there are a lot of different problem in it. The last one raised is the adaptative scalign using resources, but if someone encounters it again, we should open a new issue.
Activity
guillaumeeb commentedon Feb 1, 2019
Hi @wkerzendorf, could you provide a more complete (but still minimalist) example of what you're doing?
Did you take a look at http://jobqueue.dask.org/en/latest/debug.html?
wkerzendorf commentedon Feb 1, 2019
@guillaumeeb I've updated the main question.
wkerzendorf commentedon Feb 1, 2019
I am specifically trying this with adaptive scaling and the worker 1 has been sitting there for two minutes not getting any of the 10k tasks and everything is running on the worker 0.
That is worker 2s log:
distributed.worker - INFO - bokeh at: 172.16.2.130:43198 distributed.worker - INFO - Waiting to connect to: tcp://172.16.2.152:41753 distributed.worker - INFO - ------------------------------------------------- distributed.worker - INFO - Threads: 8 distributed.worker - INFO - Memory: 7.00 GB distributed.worker - INFO - Local Directory: /home/wek224/projects/tardis/nn/hesma/worker-qjv1h0ng distributed.worker - INFO - ------------------------------------------------- distributed.worker - INFO - Registered to: tcp://172.16.2.152:41753 distributed.worker - INFO - ------------------------------------------------- distributed.core - INFO - Starting established connection distributed.worker - INFO - Stopping worker at tcp://172.16.2.130:33306 distributed.nanny - INFO - Closing Nanny at 'tcp://172.16.2.130:37770' distributed.dask_worker - INFO - End workerThat is what I see inside the notebook happening:
wkerzendorf commentedon Feb 1, 2019
and then it relaunches a slurm job to get up to 20 workers again. So worker 1 does all the work while the others are spawned - live for sometime and then die again without having done anything.
lesteve commentedon Feb 4, 2019
Here are the things I suggest you try:
cluster.adaptand usecluster.scale(num_workers_goes_here)?time.sleep) to see whether you are seeing the same behaviourI don't think this is part of the problem but you probably don't need
job_extra=['--nodes=1', '--ntasks-per-node=1', '--cpus-per-task=8'].guillaumeeb commentedon Feb 4, 2019
This sounds weird and looks like the problem of @npaulson in #206.
And you're both with Slurm.
@wkerzendorf please follow @lesteve advices, maybe you can try snippet from #206 (comment).
lesteve commentedon Feb 4, 2019
Yep completely agree. It'd be great to get to the bottom of this ...
wkerzendorf commentedon Feb 4, 2019
Hey guys, in the process of debugging: I need the job extras as the cluster here does not like it another way:
Plase do not specify --ntasks on prince cluster, try to use --nodes and --tasks-per-node together. The test task that I defined is at the top.wkerzendorf commentedon Feb 4, 2019
I'm also using the jupyter widget for scaling - I can do it in code if you guys think that this might be problematic.
wkerzendorf commentedon Feb 4, 2019
@guillaumeeb @lesteve so I am now scaled it to two - but I do not see any print-out in the slurmXXX.outs. Does dask not let the print statements through? Should I define a logging function in my test task?
guillaumeeb commentedon Feb 4, 2019
Have you worker job ended yet? With batch scheduler often you don't get the output befor the job ends.
Have you access to the Dashboard? This could help to see if several workers are executing tasks.
wkerzendorf commentedon Feb 4, 2019
does not seem to be the case. I have access to the dashboard - it seems to be executing - but nothing in the workers log (when I execute my code - I can definitely see that in the .out file - but I'm using logging).

lesteve commentedon Feb 4, 2019
@wkerzendorf you have to help us help you ;-) ! Without a stand-alone snippet we are reduced to wild guesses which is not the most optimal way of spending our time ...
I strongly suggest:
OK so let's start with something simple, single-core jobs with simple Python function. Can you run this in your notebook and post the output you get?
wkerzendorf commentedon Feb 4, 2019
Here's what comes out. I think the issues seems to be more about the resources keywords that I used to ensure that only one task runs per worker.
wkerzendorf commentedon Feb 4, 2019
I have also now run this setup and just changed to
adapt(and taken out the while loop). When that happens it queues one job (which is not being scheduled because I think the scheduler would like more CPUs to be scheduled) even though the maximum is 3.8 remaining items
wkerzendorf commentedon Feb 4, 2019
I see a similar behavior now - it runs the first worker. then it spawns new workers and immediately kills them. I'm trying to see if it is the
resourcesoption but the cluster is very busy and it takes a while.wkerzendorf commentedon Feb 4, 2019
@guillaumeeb @lesteve - I'm pretty sure that the
resourcesoption is to blame. I ran it with and withoutresourcesoption and with it the behaviour is that it kills the workers as soon as they are spawned because they are idle.I need the resources because I need my workers to execute something that needs 8 threads but only execute one of these tasks at a time on each SLURM job (I hope that makes sense). I can trick it into doing this by specifying
but I guess it would be good to fix that properly. Let me know how I can help more.
wkerzendorf commentedon Feb 4, 2019
just an update - with my workaround it works (not using the
resourceoption for now). It works amazingly well (with the nannies killing the workers as they reach their memory limit) - great framework - thank you!!! still interested in helping to get to the bottom of the resource problem.guillaumeeb commentedon Feb 5, 2019
Thanks @wkerzendorf. The other trick you used was the second solution for your need. The drawback is that you cannot have tasks that need different number of cores, whereas you could with
--resources.So it seems you got the same problem as @leej3 in dask/distributed#1851. This is a distributed issue, I did not have time to dig deeper currently.
wkerzendorf commentedon Feb 5, 2019
@guillaumeeb let me know if I should post something in dask distributed (I guess not as it already has an issue)
guillaumeeb commentedon Feb 11, 2019
I guess it is not needed to post anything more in distributed. But if you can dig deeper the already opened issue and come with some solution, that would be really appreciated (I know, this is probably too much to ask for now).
wkerzendorf commentedon Feb 13, 2019
@guillaumeeb I'm happy to dig deeper on a pair coding session with an experienced dasker. Alone I think I will get quickly lost. I'm also a willing beta tester 😉
martiningram commentedon Jul 30, 2019
I believe I have the same issue with
resources. My goal is to run several jobs; each one requires a GPU and should be placed on a separate worker.I start a client & workers as follows:
This works fine. I then call this function like so:
This starts running and makes 4 workers on different slurm instances, which is all great. However, like the issue, only one of them actually ends up running, with the others just idling. I wonder if the resources aren't specified per worker, but only one of them gets them, or something?
I tried the workaround suggested above, specifying
cores=1, but while that works, in my case it does actually seem to use only one core, which makes my code run much more slowly.I'd appreciate any suggestions / help!
lesteve commentedon Jul 30, 2019
Can you create a separate issue please?
martiningram commentedon Jul 30, 2019
Sure, sorry, I didn't want to duplicate this one, but happy to do that.
lesteve commentedon Jul 30, 2019
Your problem may be related to the original issue, hard to tell really without investigating more and having a separate issue will help keeping our issue tracker tidy.
martiningram commentedon Jul 30, 2019
Got it -- done now, see: #304
guillaumeeb commentedon Aug 30, 2022
Closing this issue as stale, and there are a lot of different problem in it. The last one raised is the adaptative scalign using resources, but if someone encounters it again, we should open a new issue.