Skip to content

Add submit_command_extra and cancel_command_extra arguments - #434

Closed
matyasselmeci wants to merge 10 commits into
dask:mainfrom
matyasselmeci:pr/411-extra-commands
Closed

matyasselmeci wants to merge 10 commits into
dask:mainfrom
matyasselmeci:pr/411-extra-commands

Conversation

@matyasselmeci

Copy link
Copy Markdown
Contributor

submit_command_extra and cancel_command_extra (config options
jobqueue.X.submit-command-extra and jobqueue.X.cancel-command-extra)
are lists of strings that are arguments passed on as-is to condor_submit
and condor_rm when submitting or removing HTCondor jobs.

Fixes #411.

`submit_command_extra` and `cancel_command_extra` (config options
`jobqueue.X.submit-command-extra` and `jobqueue.X.cancel-command-extra`)
are lists of strings that are arguments passed on as-is to `condor_submit`
and `condor_rm` when submitting or removing HTCondor jobs.

@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.

Works fine for me (tested it with "-name" on our cluster to chose another schedd) . I made minor comments regarding adding another function and testing a list argument with one item. But otherwise LGTM.

Thanks!! now I will be finally close my fork for our cluster :)

Comment thread dask_jobqueue/htcondor.py Outdated
)

self.cancel_command = (
HTCondorJob.cancel_command + " " + shell_quote_list(cancel_command_extra)

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.

not so sure if I see the benefit over directly calling " ".join(shlex.quote(arg) for arg in cancel_command_extra)

@riedel

riedel commented May 27, 2020

Copy link
Copy Markdown
Member

I tested a bit more and have a problem I cannot understand.

cluster = HTCondorCluster(cores=1, memory="1GB", disk="100MB", submit_command_extra=["-name","schedd2"] ,cancel_command_extra=["-name", "schedd2"])

cluster.scale(1)
cluster.scale(0)

strangely leaves stale jobs. Any clue?

@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 rechecked and there seems to be really a strange problem:

In [6]: cluster.scale(0)
DEBUG:dask_jobqueue.core:Stopping worker: 0 job: 10139.0
DEBUG:dask_jobqueue.core:Executing the following command to command line
condor_rm 10139.0
In [12]: cluster._dummy_job.cancel_command
Out[12]: 'condor_rm -name notebooks.sdil.kit.edu'

So checking cluster._dummy_job.cancel_command seems to be not enough ???!?

@riedel

riedel commented May 27, 2020

Copy link
Copy Markdown
Member

@matyasselmeci , can you reproduce my problem with the "-name" argument?

Any clue how to effectively check that the params have been passed? Your idea from #411 (comment) was actually really good I think. But this won't do for the cancel_command I guess.

@matyasselmeci

Copy link
Copy Markdown
Contributor Author

Job._close_job() appears to be a class method: https://github.com/dask/dask-jobqueue/blob/master/dask_jobqueue/core.py#L343-L348
so it's not using the instance-specific cancel_command attributes.

@matyasselmeci
matyasselmeci marked this pull request as draft May 28, 2020 15:22
@lesteve

lesteve commented Jun 8, 2020 •

Copy link
Copy Markdown
Member

Job._close_job() appears to be a class method: /dask_jobqueue/core.py@master#L343-L348
so it's not using the instance-specific cancel_command attributes.

Sorry I missed this one (don't hesitate to ping me if you need input in general), no objection to make it a normal method rather than a class method.

For example, I would expect something like this to work fine for any cluster class:

cluster = FooCluster(**some_kwargs)
# this custom cancel command should be used to cancel the job
cluster.cancel_command = 'some_custom_cancel_command'

@matyasselmeci

Copy link
Copy Markdown
Contributor Author

Sounds good, thanks!

One idea for a test case for cancel_command is to add -name {wrong_name} as an argument and watch condor_rm fail; then replace that with -name {right_name} and watch it succeed.

Some htcondor parameters (e.g. "-name" to specify a schedd name) expect
to be given an FQDN (or something that looks like one) and will fail if
not given a parameter with a `.` in it.
- htcondor with a broken submit command
- htcondor with working submit/cancel commands with extra arguments
- htcondor with a broken cancel command
@riedel

riedel commented Jun 10, 2020

Copy link
Copy Markdown
Member

thx!! Ping me or remove the draft status, if you like me to review/test it .

@riedel

riedel commented Jun 10, 2020

Copy link
Copy Markdown
Member

One thought: It might make sense to split this PR and merge it in 2 batches to see that the tests are working as expected, but I can also manually revert the class variable part and test it locally. I think it might be a bit of a hassle otherwise, as all this is logically connected.

Maybe the title of the PR should mention that this only adds the commands to HTCondor (should maybe add more tickets to remind the other groups to add this to their schedulers if it makes sense or track the status across schedulers in the ticket and ask for comments,)

@lesteve

lesteve commented Jun 10, 2020

Copy link
Copy Markdown
Member

should maybe add more tickets to remind the other groups to add this to their schedulers if it makes sense or track the status across schedulers in the ticket and ask for comments,

It seems to me that this is very HTCondor specific and I have not seen anyone express a need for more flexibility along this axis in other job schedulers.

I agree there it would be great to keep some uniformity between schedulers (mostly for stability/maintenance reasons) but at the same time I think it is fine having some scheduler-specific developments if there is a strong use case behind it.

(assuming no other workers are running -- it would be even better if
I had the job IDs of the workers from the cluster.

Also don't wait so long.  A remove is quicker than a submit.
memory="100MB",
disk="100MB",
loop=loop,
submit_command_extra=["-name", schedd_name],

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.

tests multiple arguments

@riedel

riedel commented Jun 16, 2020

Copy link
Copy Markdown
Member

LGTM. Tested it on our cluster with the sched arg manually. Anything left to do? If you remove the draft status the CI should also run. Can't wait for the merge...

Comment thread dask_jobqueue/tests/test_htcondor.py Resolved
@matyasselmeci
matyasselmeci marked this pull request as ready for review June 16, 2020 02:37
* master:
  Tweak name in cluster.job_script(). (dask#439)
  Switch from Travis to GitHub Actions (dask#435)
  Fix name parameters being ignored in Cluster class (dask#398)
@riedel

riedel commented Jun 16, 2020

Copy link
Copy Markdown
Member

seems like there are some side effects to making the method an instance method: #442 (I just cherry-picked your commit, anyone working on this should probably do the same to distangle the problem).

There seem to be some unwanted leftovers: I didn't see that when manually testing if the arguments work (calling the cancel command seemed to work fine for me...)

BTW: @lesteve: can we turn on github actions for draft PRs?

@lesteve

lesteve commented Jun 16, 2020

Copy link
Copy Markdown
Member

BTW: @lesteve: can we turn on github actions for draft PRs?

It seems like the CI ran fine. Did you mean "turn off" rather than "turn on"?

@riedel

riedel commented Jun 17, 2020 •

Copy link
Copy Markdown
Member

It seems like the CI ran fine. Did you mean "turn off" rather than "turn on"?

it ran after @matyasselmeci marked it as ready for review. That is why the problem with the instance method only became apparent now. It did not run until deccacb but on ee54cd6.

But don't mind, I looked at the CI and this seems to be a problem with Github actions recently: https://github.community/t/github-actions-not-being-triggered-on-draft-pr/16390 . I guess it also OK to put [WIP] in the title if you want CI but no merge until this is fixed.

@lesteve
lesteve force-pushed the master branch 2 times, most recently from 4d181fe to 26a0e70 Compare December 8, 2020 12:40
Base automatically changed from master to main February 10, 2021 07:12
@guillaumeeb

Copy link
Copy Markdown
Member

Anybody still planning to work on this?

@riedel

riedel commented Sep 2, 2021

Copy link
Copy Markdown
Member

Just to document it, the workaround why I personally gave up was that HTCondor can actually handle crucial extra-args that cannot be passed via the job description also via the the environment variable so I am doing this instead:

os.environ["_condor_SCHEDD_HOST"] = "login-l.sdil.kit.edu"

Still the problem that @matyasselmeci ran into are really strange and it seems like some kind of bug that should be documented (maybe even in dask distributed).

It for sure needs some in depth debugging effort. Should I open a ticket regarding the problem of making job_close an instance method? And then rather close this PR for now (can be reopened if ticket is then fixed)

@guillaumeeb

Copy link
Copy Markdown
Member

Still the problem that @matyasselmeci ran into are really strange and it seems like some kind of bug that should be documented (maybe even in dask distributed).

You think it could come from dask.distributed?

It for sure needs some in depth debugging effort. Should I open a ticket regarding the problem of making job_close an instance method? And then rather close this PR for now (can be reopened if ticket is then fixed)

Do we need this now for anything else that this problem? Or is this just because you think it would be cleaner?

@riedel

riedel commented Sep 5, 2021

Copy link
Copy Markdown
Member

You think it could come from dask.distributed?

Actually it was good that you asked! It triggered me to look into the design. I actually now figured out a way to do this in #514 . It seems that the _close_job is a class method by design, probably because it is used in the weakref finalizer (guessing) . The actual interface was close , so it was rather easy to move the cancel_command derefferencing into this.

I however now have the huge problem of getting @matyasselmeci tests to run properly. Everything seems to be just fine, however, the new test design that actually uses failing submit_commands is really a challenge, because I somehow cannt figure out a way how to really catch that.

@riedel

riedel commented Sep 24, 2021

Copy link
Copy Markdown
Member

I hope it is OK if I close this one in favour of #514 , which includes the majority of changes and has been reviewed.

@riedel riedel closed this Sep 24, 2021
@guillaumeeb

Copy link
Copy Markdown
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add submit_command_extra and cancel_command_extra to HTCondor

4 participants