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
db4399fc
Commit
db4399fc
authored
2 years ago
by
Cyril Danilevski
Committed by
Karim Ahmed
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Select partition based on beamtime dates
parent
098b3924
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!725
[webservice] Select partition based on beamtime dates
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webservice/webservice.py
+15
-1
15 additions, 1 deletion
webservice/webservice.py
with
15 additions
and
1 deletion
webservice/webservice.py
+
15
−
1
View file @
db4399fc
...
@@ -518,7 +518,8 @@ async def get_slurm_partition(
...
@@ -518,7 +518,8 @@ async def get_slurm_partition(
partition.
partition.
The partition is either upex-high (for darks) or upex-middle (for
The partition is either upex-high (for darks) or upex-middle (for
corrections) if the proposal is
'
R
'
eady or
'
A
'
ctive.
corrections) if the proposal is
'
R
'
eady or
'
A
'
ctive, and within the
beamtimes.
In other cases, the jobs default to the exfel partition.
In other cases, the jobs default to the exfel partition.
:param mdc: an authenticated MyMDC client
:param mdc: an authenticated MyMDC client
...
@@ -573,6 +574,19 @@ async def get_slurm_partition(
...
@@ -573,6 +574,19 @@ async def get_slurm_partition(
if
status_beamtime
in
[
'
R
'
,
'
A
'
]:
if
status_beamtime
in
[
'
R
'
,
'
A
'
]:
partition
=
'
upex-high
'
if
action
==
'
dark
'
else
'
upex-middle
'
partition
=
'
upex-high
'
if
action
==
'
dark
'
else
'
upex-middle
'
# A proposal can have several beamtimes during which data can be taken
# that are independent from the start and end dates.
beamtimes
=
response
.
json
().
get
(
'
beamtimes
'
,
[])
active_now
=
False
now
=
datetime
.
now
().
timestamp
()
for
beamtime
in
beamtimes
:
begin
=
datetime
.
fromisoformat
(
beamtime
[
'
begin_at
'
]).
timestamp
()
end
=
datetime
.
fromisoformat
(
beamtime
[
'
end_at
'
]).
timestamp
()
if
begin
<=
now
<=
end
:
active_now
=
True
break
partition
=
partition
if
active_now
else
'
exfel
'
# NOTE: non-zero at cycle index 4 (`str(cycle)[4]`) indicates commissioning
# NOTE: non-zero at cycle index 4 (`str(cycle)[4]`) indicates commissioning
if
run_id
and
cycle
and
str
(
cycle
)[
4
]
!=
'
0
'
:
if
run_id
and
cycle
and
str
(
cycle
)[
4
]
!=
'
0
'
:
response_run
=
await
shield
(
response_run
=
await
shield
(
...
...
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