Skip to content

Commit 69fa3e0

Browse files
authored
Merge branch 'main' into file_staging
2 parents 5fd72d7 + 91ad420 commit 69fa3e0

File tree

13 files changed

+57
-19
lines changed

13 files changed

+57
-19
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ psi_j_python.egg-info/
1717
venv*
1818
.venv*
1919
build/
20-
.packages/
20+
.packages/
21+
docs/.web-build
22+
web-build/

psij-ci-setup

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ check_email() {
217217
}
218218

219219
check_key() {
220-
if ! -f ~/.psij/key ; then
220+
if [ ! -f ~/.psij/key ]; then
221221
BASE_URL=`egrep '^[^#]*server_url.*' ./testing.conf |awk '{split($0, a, "="); print a[2]}'|xargs`
222222
AUTH_URL="${BASE_URL}/auth.html"
223223

@@ -311,6 +311,7 @@ else
311311
echo "Done"
312312
fi
313313

314+
export PYTHONPATH=`pwd`/.packages:$PYTHONPATH
314315

315316
HOUR=`echo $(($RANDOM % 24))`
316317
MINUTE=`echo $(($RANDOM % 60))`

src/psij/executors/batch/batch_scheduler_executor.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,12 @@ def _clean_submit_script(self, job: Job) -> None:
545545
assert isinstance(self.config, BatchSchedulerExecutorConfig)
546546
if not self.config.keep_files:
547547
submit_file_path = self.work_directory / (job.id + '.job')
548-
if submit_file_path.exists():
548+
try:
549549
submit_file_path.unlink()
550+
except FileNotFoundError:
551+
# this can reasonably happen for attached jobs when the main
552+
# job cleans up the script instead
553+
pass
550554
except Exception as ex:
551555
logger.warning('Job %s: failed clean submit script: %s', job.id, ex)
552556

@@ -611,7 +615,10 @@ def _delete_aux_file(self, job: Optional[Job] = None, suffix: Optional[str] = No
611615
assert suffix
612616
path = self.work_directory / (job.native_id + suffix)
613617
if force or path.exists():
614-
path.unlink()
618+
try:
619+
path.unlink()
620+
except FileNotFoundError:
621+
pass # see above; attached job may race with original job
615622

616623
def list(self) -> List[str]:
617624
"""Returns a list of jobs known to the underlying implementation.

src/psij/executors/batch/cobalt.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class CobaltJobExecutor(BatchSchedulerExecutor):
3636
monitor, and cancel jobs.
3737
3838
Creates a batch script with #COBALT directives when submitting a job.
39+
40+
Custom attributes prefixed with `cobalt.` are rendered as long-form directives in the script.
41+
For example, setting `custom_attributes['cobalt.m'] = 'co'` results in the `#COBALT --m=co`
42+
directive being placed in the submit script.
3943
"""
4044

4145
# see https://Cobalt.schedmd.com/squeue.html

src/psij/executors/batch/lsf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class LsfJobExecutor(BatchSchedulerExecutor):
3535
monitor, and cancel jobs.
3636
3737
Creates a batch script with #BSUB directives when submitting a job.
38+
39+
Renders all custom attributes of the form `lsf.<name>` into the corresponding
40+
LSF directive. For example, setting
41+
`job.spec.attributes.custom_attributes['lsf.core_isolation'] = '0' results in a
42+
`#BSUB -core_isolation 0` directive being placed in the submit script.
3843
"""
3944

4045
# see https://www.ibm.com/docs/en/spectrum-lsf/10.1.0?topic=bjobs-description

src/psij/executors/batch/pbs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ def __init__(self, url: Optional[str] = None, config: Optional[PBSExecutorConfig
2222
"""
2323
if not config:
2424
config = PBSExecutorConfig()
25-
generator = TemplatedScriptGenerator(config, Path(__file__).parent / 'pbspro'
25+
generator = TemplatedScriptGenerator(config, Path(__file__).parent / 'pbs'
2626
/ 'pbspro.mustache')
2727
super().__init__(generator, url=url, config=config)

src/psij/executors/batch/pbs/pbs_classic.mustache

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
{{/job.spec.inherit_environment}}
1111

1212
{{#job.spec.resources}}
13-
{{#process_count}}
14-
#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}}
15-
{{/process_count}}
13+
#PBS -l nodes={{computed_node_count}}:ppn={{computed_processes_per_node}}{{#gpu_cores_per_process}}:gpus={{.}}{{/gpu_cores_per_process}}
1614
{{#exclusive_node_use}}
1715
#PBS -n
1816
{{/exclusive_node_use}}
@@ -51,8 +49,9 @@ only results in empty files that are not cleaned up}}
5149
{{#job.spec.inherit_environment}}
5250
#PBS -V
5351
{{/job.spec.inherit_environment}}
52+
5453
{{#env}}
55-
#PBS -v {{name}}={{value}}
54+
export {{name}}={{value}}
5655
{{/env}}
5756

5857
exec &>> "{{psij.script_dir}}/$PBS_JOBID.out"

src/psij/executors/batch/pbs/pbspro.mustache

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
{{/job.spec.inherit_environment}}
1111

1212
{{#job.spec.resources}}
13-
{{#process_count}}
14-
#PBS -l select={{job.spec.resources.computed_node_count}}:ncpus={{.}}
15-
{{/process_count}}
13+
#PBS -l select={{computed_node_count}}:ncpus={{computed_processes_per_node}}:mpiprocs={{computed_processes_per_node}}
1614
{{#exclusive_node_use}}
1715
#PBS -l place=scatter:exclhost
1816
{{/exclusive_node_use}}
@@ -56,8 +54,9 @@ exec &>> "{{psij.script_dir}}/$PBS_JOBID.out"
5654
{{#job.spec.inherit_environment}}
5755
#PBS -V
5856
{{/job.spec.inherit_environment}}
57+
5958
{{#env}}
60-
#PBS -v {{name}}={{value}}
59+
export {{name}}={{value}}
6160
{{/env}}
6261

6362
{{> batch_lib}}

src/psij/executors/batch/pbs_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class GenericPBSJobExecutor(BatchSchedulerExecutor):
5858
monitor, and cancel jobs.
5959
6060
Creates a batch script with #PBS directives when submitting a job.
61+
62+
Custom attributes prefixed with `pbs.` are rendered as directives in the script.
63+
For example, setting `custom_attributes['pbs.c'] = 'n'` results in the `#PBS -c n`
64+
directive being placed in the submit script, which disables checkpointing.
6165
"""
6266

6367
def __init__(self, generator: TemplatedScriptGenerator, url: Optional[str] = None,

src/psij/executors/batch/slurm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class SlurmJobExecutor(BatchSchedulerExecutor):
2828
monitor, and cancel jobs.
2929
3030
Creates a batch script with #SBATCH directives when submitting a job.
31+
32+
Renders all custom attributes set on a job's attributes with a `slurm.` prefix into
33+
corresponding Slurm directives with long-form parameters. For example,
34+
`job.spec.attributes.custom_attributes['slurm.qos'] = 'debug'` causes a directive
35+
`#SBATCH --qos=debug` to be placed in the submit script.
3136
"""
3237

3338
# see https://slurm.schedmd.com/squeue.html

0 commit comments

Comments
 (0)