Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
847c82c8
Commit
847c82c8
authored
9 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Task #8437: Parse job id returned by sbatch correctly
parent
48c60ad2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MAC/Services/src/PipelineControl.py
+12
-4
12 additions, 4 deletions
MAC/Services/src/PipelineControl.py
with
12 additions
and
4 deletions
MAC/Services/src/PipelineControl.py
+
12
−
4
View file @
847c82c8
...
...
@@ -70,6 +70,7 @@ from lofar.messaging.RPC import RPC, RPCTimeoutException
import
subprocess
import
datetime
import
os
import
re
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -139,11 +140,18 @@ class Slurm(object):
cmdline
=
"
ssh %s %s
"
%
(
self
.
headnode
,
cmdline
)
runCommand
(
cmdline
)
def
s
chedule
(
self
,
jobName
,
cmdline
,
sbatch_params
=
None
):
def
s
ubmit
(
self
,
jobName
,
cmdline
,
sbatch_params
=
None
):
if
sbatch_params
is
None
:
sbatch_params
=
[]
self
.
_runCommand
(
"
sbatch --job-name=%s %s bash -c
'
%s
'"
%
(
jobName
,
"
"
.
join
(
sbatch_params
),
cmdline
))
stdout
=
self
.
_runCommand
(
"
sbatch --job-name=%s %s bash -c
'
%s
'"
%
(
jobName
,
"
"
.
join
(
sbatch_params
),
cmdline
))
# Returns "Submitted batch job 3" -- extract ID
match
=
re
.
search
(
"
Submitted batch job (\d+)
"
,
stdout
)
if
not
match
:
return
None
return
match
.
group
(
1
)
def
cancel
(
self
,
jobName
):
stdout
=
self
.
_runCommand
(
"
scancel --jobname %s
"
%
(
jobName
,))
...
...
@@ -324,7 +332,7 @@ class PipelineControl(OTDBBusListener):
# Schedule runPipeline.sh
logger
.
info
(
"
Scheduling SLURM job for runPipeline.sh
"
)
slurm_job_id
=
self
.
slurm
.
s
chedule
(
parset
.
slurmJobName
(),
slurm_job_id
=
self
.
slurm
.
s
ubmit
(
parset
.
slurmJobName
(),
"
docker run --rm
"
"
--net=host
"
...
...
@@ -347,7 +355,7 @@ class PipelineControl(OTDBBusListener):
# Schedule pipelineAborted.sh
logger
.
info
(
"
Scheduling SLURM job for pipelineAborted.sh
"
)
slurm_cancel_job_id
=
self
.
slurm
.
s
chedule
(
"
%s-aborted
"
%
parset
.
slurmJobName
(),
slurm_cancel_job_id
=
self
.
slurm
.
s
ubmit
(
"
%s-aborted
"
%
parset
.
slurmJobName
(),
"
docker run --rm
"
"
--net=host
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment