Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update torque support #156

Merged
merged 7 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pysqa/wrapper/torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class TorqueCommands(SchedulerCommands):
@property
def submit_job_command(self):
return ["qsub", "-terse"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit surprised about this one, as it appears in the documentation of the sun grid engine: https://gridscheduler.sourceforge.net/htmlman/manuals.html - can we clarify which systems or system version support this command?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PBSPro - I can see that PBSPro is the closed-source version of the OpenPBS project, Torque is the continued fork of OpenPBS after it was abandoned.

Do we want to create a new set of templates specifically for PBSPro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://docs.adaptivecomputing.com/torque/4-0-2/Content/topics/commands/qsub.htm

Submit PBS job.

Synopsis

qsub [-a date_time] [-A account_string] [-b secs] [-c checkpoint_options]
[-C directive_prefix] [-d path] [-D path] [-e path] [-f] [-F] [-h]
[-I ] [-j join ] [-k keep ] [-l resource_list ]
[-m mail_options] [-M user_list] [-n] [-N name] [-o path]
[-p priority] [-P user[:group]] [-q destination] [-r c] [-S path_to_shell(s)]
[-t array_request] [-u user_list]
[-v variable_list] [-V] [-W additional_attributes] [-x] [-X] [-z] [script]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at any rate there is no -terse option in torque's documentation, and neither in the PBSPro version:

(base) [hlm562@gadi-login-05 ~]$ qsub -H
qsub: invalid option -- 'H'
usage: qsub [-a date_time] [-A account_string] [-c interval]
        [-C directive_prefix] [-e path] [-f ] [-h ] [-I [-X]] [-j oe|eo] [-J X-Y[:Z]]
        [-k keep] [-l resource_list] [-m mail_options] [-M user_list]
        [-N jobname] [-o path] [-p priority] [-P project] [-q queue] [-r y|n]
        [-R o|e|oe] [-S path] [-u user_list] [-W otherattributes=value...]
        [-S path] [-u user_list] [-W otherattributes=value...]
        [-v variable_list] [-V ] [-z] [script | -- command [arg1 ...]]
       qsub --version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, can we have on version for torque and then derive from there a second version for the sun grid engine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we already have a separate implementation for the sun grid engine https://github.com/pyiron/pysqa/blob/main/pysqa/wrapper/sge.py

return ["qsub"]

@property
def delete_job_command(self):
Expand All @@ -28,3 +28,13 @@ def delete_job_command(self):
@property
def get_queue_status_command(self):
return ["qstat", "-x"]

@staticmethod
def get_job_id_from_output(queue_submit_output):
# strip last line from output, leading and trailing whitespaces, and separates the queue id from the stuff after "."
# Adjust if your system doesn't have output like below!
# e.g. qsub run_queue.sh -> "12347673.gadi-pbs", the below returns 12347673
# It must return an integer for it to not raise an exception later.
return int(
queue_submit_output.splitlines()[-1].rstrip().lstrip().split(sep=".")[0]
)
21 changes: 14 additions & 7 deletions tests/config/torque/torque.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash
#PBS -q queue@host
#PBS -l ppn={{cores}}
#PBS -q normal # Insert the queue that you want to use here
#PBS -l ncpus={{cores}}
#PBS -N {{job_name}}
{%- if memory_max %}
#PBS -l mem={{memory_max}}
#PBS -l mem={{ [16, memory_max]| int |max }}GB # Set minimum 16 GB RAM, or user-set limit
{%- endif %}
{%- if run_time_max %}
#PBS -l walltime={{run_time_max}}
#PBS -l walltime={{ [1*3600, run_time_max*3600]|max }} # Replace 3600 if you want to use seconds as input, currently HOURS
{%- endif %}
#PBS -V
#PBS -d {{working_directory}}
#PBS -l wd
#PBS -l software=vasp # If your system requires this kind of command (check your HPC webpage/ask your admin)
#PBS -l storage=scratch/a01+gdata/a01 # If your system requires you to set visibility of storage partitions
#PBS -P a01 # If you have multiple projects and want to charge to project named "a01"

{{command}}
# Remove all the trailing # instructions in the headers above before use!

# Put a command to activate your conda environment with pyiron in it, if required
# e.g. source /software_path/mambaforge/bin/activate pyiron

{{command}}
4 changes: 2 additions & 2 deletions tests/test_queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_interfaces(self):
self.sge._adapter._commands.get_queue_status_command, ["qstat", "-xml"]
)
self.assertEqual(
self.torque._adapter._commands.submit_job_command, ["qsub", "-terse"]
self.torque._adapter._commands.submit_job_command, ["qsub"]
)
self.assertEqual(self.torque._adapter._commands.delete_job_command, ["qdel"])
self.assertEqual(
Expand Down Expand Up @@ -170,7 +170,7 @@ def test__list_command_to_be_executed(self):
with self.subTest("torque"):
self.assertEqual(
self.torque._adapter._list_command_to_be_executed(None, "here"),
["qsub", "-terse", "here"],
["qsub", "here"],
)
with self.subTest("torque with dependency"):
self.assertRaises(
Expand Down