-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added resource specs to PBS executor, which were somehow missing.
Also split PBS executor into pbs_classic (the one using `:ppn` to specify processes per node) and the modern pbspro/openpbs (using `select=:ncpus=`).
- Loading branch information
Showing
8 changed files
with
159 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from distutils.version import StrictVersion | ||
|
||
from psij.descriptor import Descriptor | ||
|
||
|
||
__PSI_J_EXECUTORS__ = [Descriptor(name='pbs', nice_name='PBS Pro', aliases=['pbspro'], | ||
version=StrictVersion('0.0.2'), | ||
cls='psij.executors.batch.pbs.PBSJobExecutor'), | ||
Descriptor(name='pbs_classic', nice_name='PBS Classic', aliases=['torque'], | ||
version=StrictVersion('0.0.2'), | ||
cls='psij.executors.batch.pbs_classic.PBSClassicJobExecutor')] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
from psij.executors.batch.pbs_base import PBSExecutorConfig, GenericPBSJobExecutor | ||
from psij.executors.batch.script_generator import TemplatedScriptGenerator | ||
|
||
|
||
class PBSJobExecutor(GenericPBSJobExecutor): | ||
"""A :class:`~psij.JobExecutor` for PBS Pro and friends. | ||
This executor uses resource specifications specific to PBS Pro | ||
""" | ||
|
||
def __init__(self, url: Optional[str] = None, config: Optional[PBSExecutorConfig] = None): | ||
""" | ||
Parameters | ||
---------- | ||
url | ||
Not used, but required by the spec for automatic initialization. | ||
config | ||
An optional configuration for this executor. | ||
""" | ||
if not config: | ||
config = PBSExecutorConfig() | ||
generator = TemplatedScriptGenerator(config, Path(__file__).parent / 'pbspro' | ||
/ 'pbspro.mustache') | ||
super().__init__(generator, url=url, config=config) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
|
||
|
||
{{#job.name}} | ||
#PBS -N="{{.}}" | ||
{{/job.name}} | ||
|
||
{{#job.spec.inherit_environment}} | ||
#PBS -V | ||
{{/job.spec.inherit_environment}} | ||
|
||
{{#job.spec.resources}} | ||
{{#process_count}} | ||
#PBS -l nodes={{job.spec.resources.computed_node_count}}:ppn={{.}}{{#job.spec.resources.gpu_cores_per_process}}:gpus={{.}}{{/job.spec.resources.gpu_cores_per_process}} | ||
{{/process_count}} | ||
{{#exclusive_node_use}} | ||
#PBS -n | ||
{{/exclusive_node_use}} | ||
{{/job.spec.resources}} | ||
|
||
{{#formatted_job_duration}} | ||
#PBS -l walltime={{.}} | ||
{{/formatted_job_duration}} | ||
|
||
{{#job.spec.attributes}} | ||
{{#project_name}} | ||
#PBS -P {{.}} | ||
{{/project_name}} | ||
{{#queue_name}} | ||
#PBS -q {{.}} | ||
{{/queue_name}} | ||
{{!PBS uses specially named queues for reservations, so we send the job to the respective | ||
queue when a reservation ID is specified.}} | ||
{{#reservation_id}} | ||
#PBS -q {{.}} | ||
{{/reservation_id}} | ||
{{/job.spec.attributes}} | ||
|
||
{{#custom_attributes}} | ||
{{#pbs}} | ||
#PBS -{{key}} "{{value}}" | ||
{{/pbs}} | ||
{{/custom_attributes}} | ||
|
||
|
||
{{!since we redirect the output manually, below, tell pbs not to do its own thing, since it | ||
only results in empty files that are not cleaned up}} | ||
#PBS -e /dev/null | ||
#PBS -o /dev/null | ||
|
||
{{#job.spec.inherit_environment}} | ||
#PBS -V | ||
{{/job.spec.inherit_environment}} | ||
{{#env}} | ||
#PBS -v {{name}}={{value}} | ||
{{/env}} | ||
|
||
PSIJ_NODEFILE="$PBS_NODEFILE" | ||
export PSIJ_NODEFILE | ||
|
||
|
||
{{#job.spec.directory}} | ||
cd "{{.}}" | ||
{{/job.spec.directory}} | ||
|
||
exec &>> "{{psij.script_dir}}/$PBS_JOBID.out" | ||
|
||
{{#psij.launch_command}}{{.}} {{/psij.launch_command}} | ||
|
||
{{!we redirect to a file tied to the native ID so that we can reach the file with attach().}} | ||
echo "$?" > "{{psij.script_dir}}/$PBS_JOBID.ec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
from psij.executors.batch.pbs_base import PBSExecutorConfig, GenericPBSJobExecutor | ||
from psij.executors.batch.script_generator import TemplatedScriptGenerator | ||
|
||
|
||
class PBSClassicJobExecutor(GenericPBSJobExecutor): | ||
"""A :class:`~psij.JobExecutor` for classic PBS systems. | ||
This executor uses resource specifications specific to Open PBS. Specifically, | ||
this executor uses the `-l nodes=n:ppn=m` way of specifying nodes, which | ||
differs from the scheme used by PBS Pro. | ||
""" | ||
|
||
def __init__(self, url: Optional[str] = None, config: Optional[PBSExecutorConfig] = None): | ||
""" | ||
Parameters | ||
---------- | ||
url | ||
Not used, but required by the spec for automatic initialization. | ||
config | ||
An optional configuration for this executor. | ||
""" | ||
if not config: | ||
config = PBSExecutorConfig() | ||
generator = TemplatedScriptGenerator(config, Path(__file__).parent / 'pbs' | ||
/ 'pbs_classic.mustache') | ||
super().__init__(generator, url=url, config=config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters