-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Understanding how to configure Skein and Dask-Yarn together in YAML #49
Comments
Currently if If you wanted to specify files, you might write a specification like: name: dask
queue: myqueue
services:
dask.scheduler:
resources:
memory: <scheduler-memory>
vcores: <scheduler-vcores>
files:
environment: /path/to/environment
other-file-name: /other/local/file/path
script: |
source environment/bin/activate
dask-yarn scheduler
dask.worker:
instances: 0
resources:
memory: <worker-memory>
vcores: <worker-vcores>
files:
environment: /path/to/environment
other-file-name: /other/local/file/path
script: |
source environment/bin/activate
dask-yarn worker In the configuration, you'd indent this whole spec under:
If all you want is
|
Thanks for the quick reply. I wrote this ticket somewhat generically to be helpful to others. But, specifically I'm looking to make sure each of my workers gets a sqlite database when they're started, so your suggestion of adding this to the constructor seems useful. My yarn.yaml file looks currently like:
I want to add
at this point I assume I can just keep the worker and scheduler section inside the
Finally, are the |
You'll want
This is the bash script used to start the workers/schedulers. In the case above I was assuming you were distributing environments with your application, but from the spec you posted above it looks like you have python installed already on every node. In this case, your spec would probably look like: yarn:
specification:
name: dask
queue: myqueue
services:
dask.scheduler:
resources:
memory: 4GiB
vcores: 1
script: |
# Script to start the scheduler. Alternatively dask-yarn scheduler might work if it's on your PATH
/usr/bin/python -m dask_yarn.scheduler
dask.worker:
instances: 2
max_restarts: -1
resources:
memory: 8GiB
vcores: 2
files:
'cached_volume.sqlite3':
source: /mnt/tmp/data
type: file
visibility: public
script: |
# Script to start a worker. Alternatively dask-yarn worker might work if it's on your PATH
/usr/bin/python -m dask_yarn.worker Does that make sense? Also, you may run into issues distributing a sqlite database among workers if you're not using it for reading only, as multiple containers may end up sharing the same localized file. |
Note that adding this to the configuration is only one option, alternatively you can avoid configuration completely and do this programatically using the import skein
import dask_yarn
worker = skein.Service(
instances=0,
max_restarts=-1,
resources=skein.Resources(
memory='8 GiB',
vcores=2
),
files={
'cached_volume.sqlite3': skein.File(
source='/mnt/tmp/data',
type='file',
visibility='public'
)
},
script='/usr/bin/python -m dask_yarn.worker'
)
scheduler = skein.Service(
resources=skein.Resources(
memory='4 GiB',
vcores=1
),
script='/usr/bin/python -m dask_yarn.scheduler'
)
spec = skein.ApplicationSpec(
name='dask',
queue='myqueue',
services={
'dask.worker': worker,
'dask.scheduler': scheduler
}
)
cluster = YarnCluster.from_specification(spec) |
This is helpful. However, I'm trying various configurations but I can't seem to get programmatic or configuration file to work and not give me an error. I've removed all the
This is raised by this script:
and also calling
|
It looks like the application is failing to start - can you get the application logs?
A few likely culprits:
|
Ah, shoot, the command I gave you was wrong. You want |
Thanks! Good catch. Just to update for completeness, the direct command for the scheduler and work seem to be When I include the file type like :
the cluster starts and stops seemingly without error, but if you look into the application logs you see:
That might should be an If I provide the file a relative path everything seems to work, but I'm having a hard time locating where the file went. Is there a programmatic way of retrieving that in each worker? |
Ah good catch, struggling a bit today on my end :/.
YARN localization can only map resources (files or archives) to paths in the containers working directory. For example:
will put the sqlite file at The local container directory could be added to
We should definitely error before submitting, but aren't currently checking specs for this in the python client (will file an issue). I would have expected dask-yarn to raise an error on failure here, you're saying you're not seeing one? |
Actually, on further thought this is only failing repeatedly on worker startup, which isn't something I think we could catch generically on the |
Great. Here's my final
|
Glad you got things working! One note - when specifying files, by default
Also, I missed this above, but for robustness you'll want to add a
It worked fine above because you're not starting an workers initially, but if you were you may have a delay in startup as the cluster isn't available until the scheduler starts.
If you can file a reproducible issue in https://github.com/jcrist/skein that would be much appreciated! |
I've created a new issue for adding the option to distribute files in the constructor: #50 |
I am getting an error while running this
what should i do? |
from config file i am getting error. Every time it says my_env/bin/activate: No such file or directory |
@RahulJangir2003 could you open a new issue rather than adding comments to an issue closed three years ago. |
I am trying to sort out how the Skin YAML configuration (described here https://jcrist.github.io/skein/specification.html) matches with the Dask-Yarn YAML configuration (described here http://yarn.dask.org/en/latest/configuration.html).
Specifically I see the Skin has a
files
configuration to let you distribute files to the workers. It says to place thisfiles
section under themaster
orservice
section of the configuration. For the dask-yarn configuration there's onlyscheduler
andworker
sections shown in the example. Are the dask-yarnscheduler
andworker
being implicitly placed into aservices
section of a Skein configuration?How does the dask-yarn YAML file match up to the Skein YAML file and where would I put the
file
attributes in my dask-yarn config file?Thanks!
The text was updated successfully, but these errors were encountered: