Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor analytics
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
calibration
pycalibration
Commits
5b0304f0
Commit
5b0304f0
authored
4 years ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Finalize script in Python
parent
a435c457
No related branches found
No related tags found
1 merge request
!350
Simplify how batch jobs find Python tools
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/slurm_calibrate.sh
+1
-1
1 addition, 1 deletion
bin/slurm_calibrate.sh
xfel_calibrate/calibrate.py
+7
-9
7 additions, 9 deletions
xfel_calibrate/calibrate.py
with
8 additions
and
10 deletions
bin/slurm_calibrate.sh
+
1
−
1
View file @
5b0304f0
...
@@ -59,6 +59,6 @@ fi
...
@@ -59,6 +59,6 @@ fi
if
[
"
${
final
}
"
==
"FINAL"
]
if
[
"
${
final
}
"
==
"FINAL"
]
then
then
XFEL_CALIBRATE_PYTHON
=
"
${
python_path
}
"
${
finalize
}
$SLURM_JOB_ID
${
python_path
}
${
finalize
}
$SLURM_JOB_ID
fi
fi
killall
-9
cal_influx_feeder.sh
||
true
killall
-9
cal_influx_feeder.sh
||
true
This diff is collapsed.
Click to expand it.
xfel_calibrate/calibrate.py
+
7
−
9
View file @
5b0304f0
...
@@ -500,17 +500,15 @@ def create_finalize_script(fmt_args, temp_path, job_list):
...
@@ -500,17 +500,15 @@ def create_finalize_script(fmt_args, temp_path, job_list):
"""
"""
Create a finalize script to produce output report
Create a finalize script to produce output report
:param fmt_args: Dictionary of fmt arguments
:param fmt_args: Dictionary of fmt arguments
:param temp_path: Path to tem
o
pary folder to run slurm job
:param temp_path: Path to temp
or
ary folder to run slurm job
:param job_list: List of slurm jobs
:param job_list: List of slurm jobs
"""
"""
tmpl
=
Template
(
'''
tmpl
=
Template
(
'''
#!/bin/tcsh
import sys
source /etc/profile.d/modules.sh
from xfel_calibrate.finalize import finalize
module load texlive/2019
echo
'
Running finalize script
'
"
${XFEL_CALIBRATE_PYTHON}
"
-c
"
from xfel_calibrate.finalize import finalize;
finalize(joblist={{joblist}},
finalize(joblist={{joblist}},
finaljob=
$1
,
finaljob=
sys.argv[1]
,
run_path=
'
{{run_path}}
'
,
run_path=
'
{{run_path}}
'
,
out_path=
'
{{out_path}}
'
,
out_path=
'
{{out_path}}
'
,
project=
'
{{project}}
'
,
project=
'
{{project}}
'
,
...
@@ -525,7 +523,7 @@ def create_finalize_script(fmt_args, temp_path, job_list):
...
@@ -525,7 +523,7 @@ def create_finalize_script(fmt_args, temp_path, job_list):
'''
)
'''
)
fmt_args
[
'
joblist
'
]
=
job_list
fmt_args
[
'
joblist
'
]
=
job_list
f_name
=
os
.
path
.
join
(
temp_path
,
"
finalize.
sh
"
)
f_name
=
os
.
path
.
join
(
temp_path
,
"
finalize.
py
"
)
with
open
(
f_name
,
"
w
"
)
as
finfile
:
with
open
(
f_name
,
"
w
"
)
as
finfile
:
finfile
.
write
(
textwrap
.
dedent
(
tmpl
.
render
(
**
fmt_args
)))
finfile
.
write
(
textwrap
.
dedent
(
tmpl
.
render
(
**
fmt_args
)))
...
@@ -658,7 +656,7 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None,
...
@@ -658,7 +656,7 @@ def concurrent_run(temp_path, nb, nbname, args, cparm=None, cval=None,
'"
{}
"'
.
format
(
args
[
"
detector
"
].
upper
()),
'"
{}
"'
.
format
(
args
[
"
detector
"
].
upper
()),
'"
{}
"'
.
format
(
args
[
"
type
"
].
upper
()),
'"
{}
"'
.
format
(
args
[
"
type
"
].
upper
()),
"
FINAL
"
if
final_job
else
"
NONFINAL
"
,
"
FINAL
"
if
final_job
else
"
NONFINAL
"
,
"
.
{}/finalize.
sh
"
.
format
(
os
.
path
.
abspath
(
temp_path
)),
"
{}/finalize.
py
"
.
format
(
os
.
path
.
abspath
(
temp_path
)),
str
(
cluster_cores
)]
str
(
cluster_cores
)]
output
=
check_output
(
srun_base
).
decode
(
'
utf8
'
)
output
=
check_output
(
srun_base
).
decode
(
'
utf8
'
)
...
...
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