Skip to content

Commit 04927a1

Browse files
job_name in SGE system (#470)
add option to set `job_name` in SGE system <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced job submission flexibility by allowing dynamic job naming; users can specify a custom job name or default to "wDPjob." - Updated resource argument structure for improved clarity and usability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent dfa143d commit 04927a1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

dpdispatcher/machines/pbs.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ def gen_script_header(self, job):
186186
#!/bin/bash
187187
#$ -S /bin/bash
188188
#$ -cwd
189-
#$ -N DPjob
190189
{select_node_line}
191190
"""
192191

@@ -215,9 +214,11 @@ def gen_script_header(self, job):
215214
### Ref:https://softpanorama.org/HPC/PBS_and_derivatives/Reference/pbs_command_vs_sge_commands.shtml
216215
# resources.number_node is not used in SGE
217216
resources = job.resources
217+
job_name = resources.kwargs.get("job_name", "wDPjob")
218218
sge_pe_name = resources.kwargs.get("sge_pe_name", "mpi")
219219
sge_script_header_dict = {}
220-
sge_script_header_dict["select_node_line"] = (
220+
sge_script_header_dict["select_node_line"] = f"#$ -N {job_name}\n"
221+
sge_script_header_dict["select_node_line"] += (
221222
f"#$ -pe {sge_pe_name} {resources.cpu_per_node}\n"
222223
)
223224
if resources.queue_name != "":
@@ -315,6 +316,7 @@ def resources_subfields(cls) -> List[Argument]:
315316
resources subfields
316317
"""
317318
doc_sge_pe_name = "The parallel environment name of SGE."
319+
doc_job_name = "The name of SGE's job."
318320

319321
return [
320322
Argument(
@@ -328,6 +330,13 @@ def resources_subfields(cls) -> List[Argument]:
328330
default="mpi",
329331
doc=doc_sge_pe_name,
330332
),
333+
Argument(
334+
"job_name",
335+
str,
336+
optional=True,
337+
default="wDPjob",
338+
doc=doc_job_name,
339+
),
331340
],
332341
optional=False,
333342
doc="Extra arguments.",

0 commit comments

Comments
 (0)