Skip to content

Fix behaviour of env_extra for HTCondor - #563

Merged
guillaumeeb merged 7 commits into
dask:mainfrom
jolange:fix_htcondor_env_extra
Aug 1, 2022
Merged

guillaumeeb merged 7 commits into
dask:mainfrom
jolange:fix_htcondor_env_extra

Conversation

@jolange

@jolange jolange commented Jul 26, 2022

Copy link
Copy Markdown
Contributor

Before only environment variables were considered using HTCondor's Environment = feature, whereas the parameter description generally says "Other commands to add".

If the Environment = feature is needed for some reason, one can still use the generic job_extra parameter to set it.

Example:

from dask_jobqueue.htcondor import HTCondorCluster
from dask.distributed import Client
env_extra = ['cd /some/path', 'source venv/bin/activate']
cluster = HTCondorCluster(cores=1, memory="2GB", disk="4GB", log_directory = 'logs', python='python3',
                          env_extra=env_extra)
print(cluster.job_script())

results in this

#!/usr/bin/env condor_submit

MY.DaskWorkerName = "htcondor--$F(MY.JobId)--"
RequestCpus = MY.DaskWorkerCores
RequestMemory = floor(MY.DaskWorkerMemory / 1048576)
RequestDisk = floor(MY.DaskWorkerDisk / 1024)
MY.JobId = "$(ClusterId).$(ProcId)"
MY.DaskWorkerCores = 1
MY.DaskWorkerMemory = 2000000000
MY.DaskWorkerDisk = 4000000000
LogDirectory = logs
Output = $(LogDirectory)/worker-$F(MY.JobId).out
Error = $(LogDirectory)/worker-$F(MY.JobId).err
Log = $(LogDirectory)/worker-$(ClusterId).log
Stream_Output = True
Stream_Error = True

Arguments = "-c 'cd /some/path; source venv/bin/activate; python3 -m distributed.cli.dask_worker tcp://<IP>:<PORT> --nthreads 1 --memory-limit 2.00GB --name dummy-name --nanny --death-timeout 60'"
Executable = /bin/sh

Queue

fixes #393
related to #323 #556

jolange added 2 commits July 26, 2022 15:13
Before only environment variables were considered using HTCondor's
`Environment =` feature, whereas the parameter description generally
says "Other commands to add".

If the `Environment =` is needed, one can still use the generic
`job_extra` parameter to set it.

fixes dask#393
related to dask#323 dask#556
@mivade

mivade commented Jul 26, 2022

Copy link
Copy Markdown

This looks fine to me but I wonder if it would make sense to add some documentation that would include the example in your comment?

@jolange

jolange commented Jul 26, 2022

Copy link
Copy Markdown
Contributor Author

@mivade sure, always a good idea. Do you have any specific place in mind?
I could add a section to Advanced tips and tricks. Maybe "Setting up the worker's environment".

@riedel riedel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we make htcondor align with others we should also should move the checks to the generic tests

Comment thread dask_jobqueue/tests/test_htcondor.py Outdated
assert "LC_ALL=en_US.utf8" in job_script
assert "cd /some/path/" in job_script
assert "source venv/bin/activate" in job_script
assert "export" not in job_script

@riedel riedel Jul 26, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a) Why is export stripped from jobscript ?? Why doesn't this fail: export should be in the script now.
b) Why can't this be checked independent og htcondor in the generic part

@jolange jolange Jul 26, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a) You are right, "export" should be contained there now, I simply missed that. I'll add it.
b) To be honest, I am not really familiar yet with the structure of your test setup, I simply searched for the occurrences of HTCondor to see where I have to modify tests. If you can point me to where you would add it, I'll try to figure it out ;-)

Sadly there seem to be problems with the CI in general, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For b), yes this could now be checked independently of HTCondor, we could add another test for env_extra in test_jobqueue_core.py, and apply it with a fixture to all the cluster classes.

But since the behavior just changed for HTCondor, I'm keen to leave also this part of the assertion in the HTCondor cluster.

Sadly there seem to be problems with the CI in general, right?

Yes unfortunately, I'm trying to advance on this point, but I've not a lot of time to devote to it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I realized anyway with the addition of f678d37 that HTCondor will stay special because of the quoting. At least for the environment variable part (see that commit) you can't generalize this to all Cluster classes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, special quoting problem. So this confirm we need to keep some specific test for HTCondor.

If you feel like adding a more general test for every queueing system (without export statement 😀), please do.

@jolange
jolange force-pushed the fix_htcondor_env_extra branch from 7188fc7 to f678d37 Compare July 26, 2022 15:43
@mivade

mivade commented Jul 26, 2022 •

Copy link
Copy Markdown

I would put it under the examples section here.

@guillaumeeb

Copy link
Copy Markdown
Member

For the docs, reading your comments, I would recommend three places (and put some doc in at least the first one or the last one):

I could add a section to Advanced tips and tricks. Maybe "Setting up the worker's environment".

You could add a generic explanation of env_extra here, with HTCondor example if you feel confident with this queuing system.

I would put it under the examples section here.

In the docstring, I would put only a simple example, witthout the explanation. I'm not sure this is mandatory to put an example with env_extra here.

The 3rd place I was thinking about is the Example Deployments section.

jolange added 2 commits July 27, 2022 16:19
- example in the docstring
- description in "example deployments""
- description in "advanced tops an tricks"
@jolange

jolange commented Jul 27, 2022

Copy link
Copy Markdown
Contributor Author

@mivade , @guillaumeeb :
Ok, I added it in all three places: 036b24e
Let me know what you think. Unfortunately I will be offline for the rest of the week, but I will continue this next week with high priority.

@guillaumeeb guillaumeeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations, this is really neat!

I've just got one minor final request. Your doc is perfect, but I don't like duplications. Could you just remove the contentvin examples.rst? The way you described things, it's perfect in advanced tips!

@mivade

mivade commented Jul 27, 2022

Copy link
Copy Markdown

@jolange this looks great, thanks! I agree with @guillaumeeb's suggestion that it's fine to only have the lengthier discussion in one place but language wise it's good.

@jolange

jolange commented Aug 1, 2022

Copy link
Copy Markdown
Contributor Author

@guillaumeeb , @mivade ok, I removed the part from examples.rst.
Once you think it is ready to be merged, I can rebase this and squash the commits into meaningful ones. But looking at the recent history, it looks like you squash all PRs to single commits anyway, right?

@guillaumeeb guillaumeeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! And yes, we squash on merge, I'll merge this right now.

@guillaumeeb
guillaumeeb merged commit a04811a into dask:main Aug 1, 2022
guillaumeeb pushed a commit to ikabadzhov/dask-jobqueue that referenced this pull request Aug 7, 2022
* fix behaviour of `env_extra` for HTCondor

Before only environment variables were considered using HTCondor's
`Environment =` feature, whereas the parameter description generally
says "Other commands to add".

If the `Environment =` is needed, one can still use the generic
`job_extra` parameter to set it.

fixes dask#393
related to dask#323 dask#556

* adapt htcondor tests for new `env_extra` behaviour

* adapt htcondor tests for new `env_extra` behaviour

"export" is preserved now

* docs: made "Moab Deployments" heading the same level as the others

* docs: added description of HTCondorCluster + env_extra

- example in the docstring
- description in "example deployments""
- description in "advanced tops an tricks"

* docs: removed the HTCondorCluster section from examples

* formatting according to black and flake8
guillaumeeb added a commit that referenced this pull request Aug 7, 2022
…ob scripts (#560)

* Use `--nworkers` in stead of deprecated `--nprocs` in the generated job scripts

Fix #559.

* Update the requirements for dask and distributed

This is needed to support the `--nworkers` option.

* Fix behaviour of `env_extra` for HTCondor (#563)

* fix behaviour of `env_extra` for HTCondor

Before only environment variables were considered using HTCondor's
`Environment =` feature, whereas the parameter description generally
says "Other commands to add".

If the `Environment =` is needed, one can still use the generic
`job_extra` parameter to set it.

fixes #393
related to #323 #556

* adapt htcondor tests for new `env_extra` behaviour

* adapt htcondor tests for new `env_extra` behaviour

"export" is preserved now

* docs: made "Moab Deployments" heading the same level as the others

* docs: added description of HTCondorCluster + env_extra

- example in the docstring
- description in "example deployments""
- description in "advanced tops an tricks"

* docs: removed the HTCondorCluster section from examples

* formatting according to black and flake8

* Drop Python 3.7 (#562)

* Drop Python 3.7

* Fix cleanup fixture probem (see fistributed#9137)

* Override cleanup distributed fixture, and reconfigure dask-jobqueue when called

* Use power of 2 for the memory checks in tests (see dask#7484)

* Apply Black

* Apply correct version of black...

* conda install Python in HTCondor Docker image

* Fix HTCondor Dockerfile

* Fix PBS Issue

* Add a timeout for every wait_for_workers call

* Fix HTCondor tests, leave room for scheduling cycle to take place for HTCondor

* flake check

* debugging HTCondor tests on CI

* Flake

* reduce negotiator interval for faster job queuing, more debugging logs

* move condor command at the right place

* always run cleanup step, and print more things on HTCondor

* Clean temporary debug and other not necessary modifications

* Disable HTCondor CI for now

* Import loop_in_thread fixture from distributed

* Override method from distributed to make tests pass

Co-authored-by: Johannes Lange <[email protected]>
Co-authored-by: Guillaume Eynard-Bontemps <[email protected]>
@jolange
jolange deleted the fix_htcondor_env_extra branch August 10, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect description for env_extra for HTCondorCluster

4 participants