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
2770ec66
Commit
2770ec66
authored
5 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
make max-pulses a list not a str
parent
b38be252
No related branches found
No related tags found
1 merge request
!174
Feat/range pulse idxs
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webservice/update_config.py
+11
-2
11 additions, 2 deletions
webservice/update_config.py
webservice/webservice.py
+17
-18
17 additions, 18 deletions
webservice/webservice.py
with
28 additions
and
20 deletions
webservice/update_config.py
+
11
−
2
View file @
2770ec66
...
...
@@ -10,7 +10,8 @@ available_options = {
"
blc-noise
"
:
bool
,
"
dont-zero-nans
"
:
bool
,
"
dont-zero-orange
"
:
bool
,
"
max-pulses
"
:
str
},
"
max-pulses
"
:
list
,
"
calfile
"
:
str
},
}
parser
=
argparse
.
ArgumentParser
(
...
...
@@ -41,7 +42,12 @@ detector = args["detector"]
if
detector
is
not
None
:
for
option
,
typ
in
available_options
[
detector
].
items
():
parser
.
add_argument
(
f
"
--
{
option
}
"
,
type
=
typ
)
if
typ
==
list
:
print
(
typ
)
nargs
=
'
+
'
else
:
nargs
=
None
parser
.
add_argument
(
f
"
--
{
option
}
"
,
type
=
typ
,
nargs
=
nargs
)
if
add_help
:
sys
.
argv
.
append
(
"
--help
"
)
...
...
@@ -61,6 +67,9 @@ new_conf = {task: {instrument: {detector: {}}}}
for
key
,
value
in
args
.
items
():
key
=
key
.
replace
(
"
_
"
,
"
-
"
)
if
key
in
available_options
[
detector
]
and
value
is
not
None
:
if
isinstance
(
value
,
list
):
for
v
in
value
:
value
[
value
.
index
(
v
)]
=
''
.
join
(
v
)
new_conf
[
task
][
instrument
][
detector
][
key
]
=
value
pyaml
=
yaml
.
dump
(
new_conf
,
default_flow_style
=
False
)
...
...
This diff is collapsed.
Click to expand it.
webservice/webservice.py
+
17
−
18
View file @
2770ec66
...
...
@@ -239,6 +239,18 @@ async def query_rid(conn, socket, rid):
socket
.
send
(
msg
.
encode
())
async
def
parse_config
(
cmd
,
config
):
for
key
,
value
in
config
.
items
():
if
isinstance
(
value
,
list
):
cmd
+=
[
"
--{}
"
.
format
(
key
)]
cmd
+=
[
str
(
v
)
for
v
in
value
]
elif
isinstance
(
value
,
bool
):
cmd
+=
[
"
--{}
"
.
format
(
key
)]
else
:
cmd
+=
[
"
--{}
"
.
format
(
key
),
str
(
value
)]
return
cmd
async
def
update_job_db
(
config
):
"""
Update the job database and send out updates to MDC
...
...
@@ -631,15 +643,8 @@ async def server_runner(config, mode):
if
len
(
run_config
):
dconfig
[
"
runs
"
]
=
"
,
"
.
join
(
run_config
)
for
key
,
value
in
dconfig
.
items
():
if
not
isinstance
(
value
,
bool
):
if
"
"
in
str
(
value
):
cmd
+=
[
"
--{}
"
.
format
(
key
)]
cmd
+=
[
str
(
v
)
for
v
in
value
.
split
(
"
"
)]
else
:
cmd
+=
[
"
--{}
"
.
format
(
key
),
str
(
value
)]
else
:
cmd
+=
[
"
--{}
"
.
format
(
key
)]
cmd
=
await
parse_config
(
cmd
,
dconfig
)
ret
=
await
run_correction
(
job_db
,
cmd
,
mode
,
proposal
,
wait_runs
[
0
],
rid
)
status
.
append
(
ret
)
...
...
@@ -685,15 +690,9 @@ async def server_runner(config, mode):
detector
,
_
=
detector
.
split
(
"
-
"
)
cmd
=
[
"
python
"
,
"
-m
"
,
"
xfel_calibrate.calibrate
"
,
detector
,
"
CORRECT
"
]
for
key
,
value
in
dconfig
.
items
():
if
not
isinstance
(
value
,
bool
):
if
"
"
in
str
(
value
):
cmd
+=
[
"
--{}
"
.
format
(
key
)]
cmd
+=
[
str
(
v
)
for
v
in
value
.
split
(
"
"
)]
else
:
cmd
+=
[
"
--{}
"
.
format
(
key
),
str
(
value
)]
else
:
cmd
+=
[
"
--{}
"
.
format
(
key
)]
cmd
=
await
parse_config
(
cmd
,
dconfig
)
if
priority
:
cmd
+=
[
"
--priority
"
,
str
(
priority
)]
ret
=
await
run_correction
(
job_db
,
cmd
,
mode
,
proposal
,
...
...
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