Skip to content

Commit

Permalink
add parameter for output file name
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-jt79 committed Oct 15, 2021
1 parent 6081302 commit 16aee26
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions mycluster/schedulers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def create_submit(
user_email=None,
qos=None,
exclusive=True,
output_name=None,
):
"""
Write a new job file
Expand Down
6 changes: 5 additions & 1 deletion mycluster/schedulers/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def create_submit(
user_email=None,
qos=None,
exclusive=True,
output_name=None,
):
if tasks_per_node is None:
tasks_per_node = self.tasks_per_node(queue_id)
Expand All @@ -147,12 +148,15 @@ def create_submit(

num_queue_slots = num_nodes * tasks_per_node(queue_id)

if output_name is None:
output_name = job_name + ".out"

template = self._load_template("lsf.jinja")

script_str = template.render(
my_name=job_name,
my_script=job_script,
my_output=job_name,
my_output=output_name,
user_email=user_email,
queue_name=queue_name,
num_queue_slots=num_queue_slots,
Expand Down
6 changes: 5 additions & 1 deletion mycluster/schedulers/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def create_submit(
user_email=None,
qos=None,
exclusive=True,
output_name=None,
):
queue_name = queue_id
if tasks_per_node is None:
Expand All @@ -178,12 +179,15 @@ def create_submit(
tasks_per_node, self._min_tasks_per_node(queue_id)
)

if output_name is None:
output_name = job_name + ".out"

template = self._load_template("pbs.jinja")

script_str = template.render(
my_name=job_name,
my_script=job_script,
my_output=job_name,
my_output=output_name,
user_email=user_email,
queue_name=queue_name,
num_queue_slots=num_queue_slots,
Expand Down
6 changes: 5 additions & 1 deletion mycluster/schedulers/sge.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def create_submit(
user_email=None,
qos=None,
exclusive=True,
output_name=None,
):
parallel_env = queue_id.split(":")[0]
queue_name = queue_id.split(":")[1]
Expand All @@ -271,6 +272,9 @@ def create_submit(
if "mycluster-" in job_script:
job_script = self._get_data(job_script)

if output_name is None:
output_name = job_name + ".out"

# For exclusive node use total number of slots required
# is number of nodes x number of slots offer by queue
num_queue_slots = num_nodes * self.tasks_per_node(queue_id)
Expand All @@ -286,7 +290,7 @@ def create_submit(
script_str = template.render(
my_name=job_name,
my_script=job_script,
my_output=job_name,
my_output=output_name,
user_email=user_email,
queue_name=queue_name,
parallel_env=parallel_env,
Expand Down
6 changes: 5 additions & 1 deletion mycluster/schedulers/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def create_submit(
user_email=None,
qos=None,
exclusive=True,
output_name=None,
):
queue_name = queue_id
if tasks_per_node is None:
Expand All @@ -137,12 +138,15 @@ def create_submit(
if "mycluster-" in job_script:
job_script = self._get_data(job_script)

if output_name is None:
output_name = job_name + ".out"

template = self._load_template(self._get_template_name())

script_str = template.render(
my_name=job_name,
my_script=job_script,
my_output=job_name,
my_output=output_name,
user_email=user_email,
queue_name=queue_name,
num_tasks=num_tasks,
Expand Down

0 comments on commit 16aee26

Please sign in to comment.