Skip to content

Commit

Permalink
use the stored env_extra parameter from the base class for htcondor (d…
Browse files Browse the repository at this point in the history
…ask#572)

- no need to reparse the parameter and config in HTCondorCluster
- moved the joining to a string to the only place where it is needed
- renamed _env_header to _env_extra, because it now contains exactly
  the parameter
  • Loading branch information
jolange authored Aug 11, 2022
1 parent a3b4a42 commit d0f3e99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dask_jobqueue/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def __init__(

self.shebang = shebang

self._env_header = "\n".join(filter(None, env_extra))
self._env_extra = env_extra
self.header_skip = set(header_skip)

# dask-worker command line build
Expand Down Expand Up @@ -299,7 +299,7 @@ def job_script(self):
pieces = {
"shebang": self.shebang,
"job_header": header,
"env_header": self._env_header,
"env_header": "\n".join(filter(None, self._env_extra)),
"worker_command": self._command_template,
}
return self._script_template % pieces
Expand Down
12 changes: 4 additions & 8 deletions dask_jobqueue/htcondor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,13 @@ def __init__(
else:
self.job_extra = job_extra

env_extra = base_class_kwargs.get("env_extra", None)
if env_extra is None:
env_extra = dask.config.get(
"jobqueue.%s.env-extra" % self.config_name, default=[]
)

if env_extra is not None:
if self._env_extra is not None:
# Overwrite command template: prepend commands from env_extra separated by semicolon.
# This is special for HTCondor, because lines to execute on the worker node cannot be
# simply added to the submit script like for other batch systems.
self._command_template = "; ".join(env_extra + [self._command_template])
self._command_template = "; ".join(
self._env_extra + [self._command_template]
)

self.job_header_dict = {
"MY.DaskWorkerName": '"htcondor--$F(MY.JobId)--"',
Expand Down

0 comments on commit d0f3e99

Please sign in to comment.