Skip to content

Commit 1f6c8ec

Browse files
author
mahendrapaipuri
committed
Use f strings in oar scheduler. Add entry for oar in docs
1 parent 805b358 commit 1f6c8ec

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

docs/config_reference.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ System Partition Configuration
218218
If not, you should consider using the ``squeue`` backend below.
219219
- ``squeue``: Jobs will be launched using the `Slurm <https://www.schedmd.com/>`__ scheduler.
220220
This backend does not rely on job accounting to retrieve job statuses, but ReFrame does its best to query the job state as reliably as possible.
221+
- ``oar``: Jobs will be launched using the `OAR <https://oar.imag.fr/>`__ scheduler.
221222

222223
.. versionadded:: 3.7.2
223224
Support for the SGE scheduler is added.

docs/tutorial_tips_tricks.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,10 @@ The following is an example of ``.gitlab-ci.yml`` file that does exactly that:
552552
It defines two stages.
553553
The first one, called ``generate``, will call ReFrame to generate the pipeline specification for the desired tests.
554554
All the usual `test selection options <manpage.html#test-filtering>`__ can be used to select specific tests.
555-
ReFrame will process them as usual, but instead of running the selected tests, it will generate the correct steps for running each test individually as a Gitlab job.
556-
We then pass the generated CI pipeline file to second phase as an artifact and we are done!
555+
ReFrame will process them as usual, but instead of running the selected tests, it will generate the correct steps
556+
for running each test individually as a Gitlab job. We then pass the generated CI pipeline file to second phase as
557+
an artifact and we are done! If ``image`` keyword is defined in ``.gitlab-ci.yml``, the emitted pipeline will use
558+
the same image as the one defined in the parent pipeline.
557559

558560
The following figure shows one part of the automatically generated pipeline for the test graph depicted `above <#fig-deps-complex>`__.
559561

reframe/core/schedulers/oar.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ def emit_preamble(self, job):
7272
# Same reason as oarsub, we give full path to output and error files to
7373
# avoid writing them in the working dir
7474
preamble = [
75-
self._format_option('-n "%s"' % job.name),
76-
self._format_option('-O %s' %
77-
os.path.join(job.workdir, job.stdout)),
78-
self._format_option('-E %s' %
79-
os.path.join(job.workdir, job.stderr)),
75+
self._format_option(f'-n "{job.name}"'),
76+
self._format_option(f'-O {os.path.join(job.workdir, job.stdout)}'),
77+
self._format_option(f'-E {os.path.join(job.workdir, job.stderr)}'),
8078
]
8179

8280
if job.time_limit is not None:
@@ -102,7 +100,7 @@ def emit_preamble(self, job):
102100
preamble.append(self._format_option(opt))
103101

104102
# OAR starts the job in the home directory by default
105-
preamble.append('cd %s' % job.workdir)
103+
preamble.append(f'cd {job.workdir}')
106104
return preamble
107105

108106
def submit(self, job):
@@ -136,16 +134,10 @@ def poll(self, *jobs):
136134
return
137135

138136
for job in jobs:
139-
completed = osext.run_command(
137+
completed = _run_strict(
140138
f'oarstat -fj {job.jobid}'
141139
)
142140

143-
if completed.returncode != 0:
144-
raise JobSchedulerError(
145-
f'oarstat failed with exit code {completed.returncode} '
146-
f'(standard error follows):\n{completed.stderr}'
147-
)
148-
149141
# Store information for each job separately
150142
jobinfo = {}
151143

unittests/test_schedulers.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,14 @@ def _expected_oar_directives(job):
213213
num_nodes = job.num_tasks // job.num_tasks_per_node
214214
num_tasks_per_node = job.num_tasks_per_node
215215
return set([
216-
'#OAR -n "testjob"',
217-
'#OAR -O %s' % job.stdout,
218-
'#OAR -E %s' % job.stderr,
219-
'#OAR -l /host=%s/core=%s,walltime=0:5:0' % (num_nodes,
220-
num_tasks_per_node),
221-
'#OAR --account=spam',
222-
'#OAR --gres=gpu:4',
223-
'#DW jobdw capacity=100GB',
224-
'#DW stage_in source=/foo'
216+
f'#OAR -n "testjob"',
217+
f'#OAR -O {job.stdout}',
218+
f'#OAR -E {job.stderr}',
219+
f'#OAR -l /host={num_nodes}/core={num_tasks_per_node},walltime=0:5:0'
220+
f'#OAR --account=spam',
221+
f'#OAR --gres=gpu:4',
222+
f'#DW jobdw capacity=100GB',
223+
f'#DW stage_in source=/foo'
225224
])
226225

227226

0 commit comments

Comments
 (0)