From 3c2a1b03c9f70f60d80e705ceb8b6a04fe4b71df Mon Sep 17 00:00:00 2001 From: Charlottez112 <56694726+Charlottez112@users.noreply.github.com> Date: Tue, 6 Apr 2021 09:06:38 -0400 Subject: [PATCH] Changed TORQUE to PBS (#491) Renamed TORQUE scheduler related classes, objects, templates, etc to PBS in code and documentation. * changed torque to pbs * fixed isort error * changed torque to pbs * rename PBSScheduler * rename PBSScheduler * rename PBSScheduler * Add changelog entry. * Rename Torque -> PBS in more places. * Update contributors.yaml * Added back deprecated class for DefaultTorqueEnvironment. * Remove extra line in contributors.yaml. * Fix import. Co-authored-by: Bradley Dice --- changelog.txt | 7 ++++++- contributors.yaml | 5 +++++ doc/api.rst | 8 ++++---- doc/supported_environments.rst | 4 ++-- doc/supported_environments/pbs.rst | 12 ++++++++++++ doc/supported_environments/torque.rst | 12 ------------ flow/environment.py | 26 ++++++++++++++++++------- flow/scheduling/{torque.py => pbs.py} | 28 +++++++++++++-------------- flow/templates/{torque.sh => pbs.sh} | 0 9 files changed, 62 insertions(+), 40 deletions(-) create mode 100644 doc/supported_environments/pbs.rst delete mode 100644 doc/supported_environments/torque.rst rename flow/scheduling/{torque.py => pbs.py} (86%) rename flow/templates/{torque.sh => pbs.sh} (100%) diff --git a/changelog.txt b/changelog.txt index 07bcd0de5..e28f26346 100644 --- a/changelog.txt +++ b/changelog.txt @@ -17,6 +17,11 @@ Added - Documentation for all directives (#480). - Defined validators for the ``fork`` directive (#480). +Changed ++++++++ + +- Renamed TorqueEnvironment and related classes to PBSEnvironment (#491). + Fixed +++++ @@ -82,7 +87,7 @@ Changed - Command line interface always uses ``--job-id`` instead of ``--jobid`` (#363, #386). - ``CPUEnvironment`` and ``GPUEnvironment`` classes are deprecated (#381). - Docstrings are now written in `numpydoc style `__ (#392). -- Default environment for the University of Minnesota Mangi cluster changed from SLURM to Torque (#393). +- Default environment for the University of Minnesota Mangi cluster changed from Torque to SLURM (#393). - Run commands are evaluted lazily (#70, #396). - Deprecated method ``export_job_statuses`` (#402). - Improved internal caching of scheduler status (#410). diff --git a/contributors.yaml b/contributors.yaml index 8d45857c0..a3587f4bb 100644 --- a/contributors.yaml +++ b/contributors.yaml @@ -142,4 +142,9 @@ contributors: family-names: Gnabro given-names: Ange-Desire affiliation: "" + - + family-names: Zhao + given-names: Charlotte + orcid: "https://orcid.org/0000-0003-4915-1064" + affiliation: "University of Michigan" ... diff --git a/doc/api.rst b/doc/api.rst index 30c003c5e..bdccb75b5 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -187,7 +187,7 @@ Compute Environments .. autoclass:: flow.environment.SimpleSchedulerEnvironment :members: -.. autoclass:: flow.environment.TorqueEnvironment +.. autoclass:: flow.environment.PBSEnvironment :members: .. autoclass:: flow.environment.SlurmEnvironment @@ -219,13 +219,13 @@ Schedulers .. autoclass:: flow.scheduling.lsf.LSFScheduler :members: -.. autoclass:: flow.scheduling.simple_scheduler.SimpleScheduler +.. autoclass:: flow.scheduling.pbs.PBSScheduler :members: -.. autoclass:: flow.scheduling.slurm.SlurmScheduler +.. autoclass:: flow.scheduling.simple_scheduler.SimpleScheduler :members: -.. autoclass:: flow.scheduling.torque.TorqueScheduler +.. autoclass:: flow.scheduling.slurm.SlurmScheduler :members: Error Classes diff --git a/doc/supported_environments.rst b/doc/supported_environments.rst index be1b6cc17..1bc58fb56 100644 --- a/doc/supported_environments.rst +++ b/doc/supported_environments.rst @@ -18,9 +18,9 @@ The package currently ships with scheduler support for: .. toctree:: - supported_environments/slurm - supported_environments/torque supported_environments/lsf + supported_environments/pbs + supported_environments/slurm Any supercomputing system utilizing these schedulers is supported out of the box. In addition, the package provides specialized submission templates for the following environments: diff --git a/doc/supported_environments/pbs.rst b/doc/supported_environments/pbs.rst new file mode 100644 index 000000000..8313d9c73 --- /dev/null +++ b/doc/supported_environments/pbs.rst @@ -0,0 +1,12 @@ +.. _pbs: + +PBS +=== + +`Link to qsub man page `_ + +.. autoclass:: flow.environment.DefaultPBSEnvironment + +.. literalinclude:: ../../flow/templates/pbs.sh + :language: jinja + :caption: pbs.sh diff --git a/doc/supported_environments/torque.rst b/doc/supported_environments/torque.rst deleted file mode 100644 index 0621a7ae6..000000000 --- a/doc/supported_environments/torque.rst +++ /dev/null @@ -1,12 +0,0 @@ -.. _torque: - -TORQUE -====== - -`Link to qsub man page `_ - -.. autoclass:: flow.environment.DefaultTorqueEnvironment - -.. literalinclude:: ../../flow/templates/torque.sh - :language: jinja - :caption: torque.sh diff --git a/flow/environment.py b/flow/environment.py index 1606cb4ee..8dd059e31 100644 --- a/flow/environment.py +++ b/flow/environment.py @@ -16,6 +16,7 @@ import socket from functools import lru_cache +from deprecation import deprecated from signac.common import config from .directives import ( @@ -34,10 +35,11 @@ from .scheduling.base import JobStatus from .scheduling.fake_scheduler import FakeScheduler from .scheduling.lsf import LSFScheduler +from .scheduling.pbs import PBSScheduler from .scheduling.simple_scheduler import SimpleScheduler from .scheduling.slurm import SlurmScheduler -from .scheduling.torque import TorqueScheduler from .util import config as flow_config +from .version import __version__ logger = logging.getLogger(__name__) @@ -391,11 +393,11 @@ class SimpleSchedulerEnvironment(ComputeEnvironment): template = "simple_scheduler.sh" -class TorqueEnvironment(ComputeEnvironment): - """An environment with TORQUE scheduler.""" +class PBSEnvironment(ComputeEnvironment): + """An environment with PBS scheduler.""" - scheduler_type = TorqueScheduler - template = "torque.sh" + scheduler_type = PBSScheduler + template = "pbs.sh" class SlurmEnvironment(ComputeEnvironment): @@ -420,8 +422,8 @@ class NodesEnvironment(ComputeEnvironment): """ -class DefaultTorqueEnvironment(NodesEnvironment, TorqueEnvironment): - """Default environment for clusters with a TORQUE scheduler.""" +class DefaultPBSEnvironment(NodesEnvironment, PBSEnvironment): + """Default environment for clusters with a PBS scheduler.""" @classmethod def add_args(cls, parser): @@ -450,6 +452,16 @@ def add_args(cls, parser): ) +@deprecated( + deprecated_in="0.14", + removed_in="0.16", + current_version=__version__, + details="DefaultTorqueEnvironment has been renamed to DefaultPBSEnvironment", +) +class DefaultTorqueEnvironment(DefaultPBSEnvironment): # noqa: D101 + pass + + class DefaultSlurmEnvironment(NodesEnvironment, SlurmEnvironment): """Default environment for clusters with a SLURM scheduler.""" diff --git a/flow/scheduling/torque.py b/flow/scheduling/pbs.py similarity index 86% rename from flow/scheduling/torque.py rename to flow/scheduling/pbs.py index 45926323f..f3ba6419b 100644 --- a/flow/scheduling/torque.py +++ b/flow/scheduling/pbs.py @@ -1,9 +1,9 @@ # Copyright (c) 2018 The Regents of the University of Michigan # All rights reserved. # This software is licensed under the BSD 3-Clause License. -"""Implementation of the scheduling system for TORQUE schedulers. +"""Implementation of the scheduling system for PBS schedulers. -This module implements the Scheduler and ClusterJob classes for TORQUE. +This module implements the Scheduler and ClusterJob classes for PBS. """ import errno import getpass @@ -18,7 +18,7 @@ def _fetch(user=None): - """Fetch the cluster job status information from the TORQUE scheduler. + """Fetch the cluster job status information from the PBS scheduler. Parameters ---------- @@ -28,8 +28,8 @@ def _fetch(user=None): Yields ------ - :class:`~.TorqueJob` - Torque cluster job. + :class:`~.PBSJob` + PBS cluster job. """ if user is None: @@ -52,13 +52,13 @@ def _fetch(user=None): raise except OSError as error: if error.errno == errno.ENOENT: - raise RuntimeError("Torque not available.") + raise RuntimeError("PBS not available.") else: raise error -class TorqueJob(ClusterJob): - """Implementation of the abstract ClusterJob class for TORQUE schedulers.""" +class PBSJob(ClusterJob): + """Implementation of the abstract ClusterJob class for PBS schedulers.""" def __init__(self, node): self.node = node @@ -80,10 +80,10 @@ def status(self): return JobStatus.registered -class TorqueScheduler(Scheduler): - r"""Implementation of the abstract Scheduler class for TORQUE schedulers. +class PBSScheduler(Scheduler): + r"""Implementation of the abstract Scheduler class for PBS schedulers. - This class can submit cluster jobs to a TORQUE scheduler and query their + This class can submit cluster jobs to a PBS scheduler and query their current status. Parameters @@ -95,7 +95,7 @@ class TorqueScheduler(Scheduler): """ - # The standard command used to submit jobs to the TORQUE scheduler. + # The standard command used to submit jobs to the PBS scheduler. submit_cmd = ["qsub"] def __init__(self, user=None): @@ -106,7 +106,7 @@ def jobs(self): self._prevent_dos() nodes = _fetch(user=self.user) for node in nodes.findall("Job"): - yield TorqueJob(node) + yield PBSJob(node) def submit( self, script, *, after=None, hold=False, pretend=False, flags=None, **kwargs @@ -161,7 +161,7 @@ def submit( @classmethod def is_present(cls): - """Return True if a TORQUE scheduler is detected.""" + """Return True if a PBS scheduler is detected.""" try: subprocess.check_output(["qsub", "--version"], stderr=subprocess.STDOUT) except subprocess.CalledProcessError: diff --git a/flow/templates/torque.sh b/flow/templates/pbs.sh similarity index 100% rename from flow/templates/torque.sh rename to flow/templates/pbs.sh