From 16aee26014d9444bf5e33c9c2f95831ae99f32ab Mon Sep 17 00:00:00 2001 From: Mike Turner Date: Fri, 15 Oct 2021 11:59:42 +0100 Subject: [PATCH] add parameter for output file name --- mycluster/schedulers/base.py | 1 + mycluster/schedulers/lsf.py | 6 +++++- mycluster/schedulers/pbs.py | 6 +++++- mycluster/schedulers/sge.py | 6 +++++- mycluster/schedulers/slurm.py | 6 +++++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/mycluster/schedulers/base.py b/mycluster/schedulers/base.py index 7b00366..2a71018 100644 --- a/mycluster/schedulers/base.py +++ b/mycluster/schedulers/base.py @@ -103,6 +103,7 @@ def create_submit( user_email=None, qos=None, exclusive=True, + output_name=None, ): """ Write a new job file diff --git a/mycluster/schedulers/lsf.py b/mycluster/schedulers/lsf.py index c8b0b11..5d9e8be 100644 --- a/mycluster/schedulers/lsf.py +++ b/mycluster/schedulers/lsf.py @@ -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) @@ -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, diff --git a/mycluster/schedulers/pbs.py b/mycluster/schedulers/pbs.py index 2e26c92..4da7818 100644 --- a/mycluster/schedulers/pbs.py +++ b/mycluster/schedulers/pbs.py @@ -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: @@ -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, diff --git a/mycluster/schedulers/sge.py b/mycluster/schedulers/sge.py index 1d5c25b..1471896 100644 --- a/mycluster/schedulers/sge.py +++ b/mycluster/schedulers/sge.py @@ -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] @@ -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) @@ -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, diff --git a/mycluster/schedulers/slurm.py b/mycluster/schedulers/slurm.py index c37dcaa..e5a9b4d 100644 --- a/mycluster/schedulers/slurm.py +++ b/mycluster/schedulers/slurm.py @@ -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: @@ -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,