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
9832cd6c
Commit
9832cd6c
authored
1 year ago
by
Thomas Kluyver
Browse files
Options
Downloads
Patches
Plain Diff
Add script to update dark run status in myMdC
parent
29607770
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!923
Add script to update dark run status in myMdC
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webservice/update_mdc_darks.py
+46
-0
46 additions, 0 deletions
webservice/update_mdc_darks.py
with
46 additions
and
0 deletions
webservice/update_mdc_darks.py
0 → 100644
+
46
−
0
View file @
9832cd6c
import
argparse
from
pathlib
import
Path
from
metadata_client.metadata_client
import
MetadataClient
from
.config
import
webservice
as
config
parser
=
argparse
.
ArgumentParser
(
description
=
'
Update run status at MDC for a given run id.
'
)
# TODO: unify configuration argument names across the project
parser
.
add_argument
(
'
--conf-file
'
,
type
=
str
,
help
=
'
Path to webservice config
'
,
default
=
None
)
parser
.
add_argument
(
'
--flg
'
,
type
=
str
,
choices
=
[
"
IP
"
,
"
F
"
,
"
E
"
],
required
=
True
,
help
=
'
Status flag for MDC: In Progress/Finished/Error.
'
)
# noqa
parser
.
add_argument
(
'
id
'
,
type
=
int
,
help
=
'
Dark run id from MDC
'
)
parser
.
add_argument
(
'
--msg
'
,
type
=
str
,
help
=
'
Message string to MDC
'
,
default
=
'
Error while job submission
'
)
parser
.
add_argument
(
'
--really
'
,
action
=
'
store_true
'
,
help
=
"
Actually make changes (otherwise dry-run)
"
)
args
=
parser
.
parse_args
()
if
args
.
conf_file
is
not
None
:
config
.
configure
(
includes_for_dynaconf
=
[
Path
(
args
.
conf_file
).
absolute
()])
mdconf
=
config
[
'
metadata-client
'
]
client_conn
=
MetadataClient
(
client_id
=
mdconf
[
'
user-id
'
],
client_secret
=
mdconf
[
'
user-secret
'
],
user_email
=
mdconf
[
'
user-email
'
],
token_url
=
mdconf
[
'
token-url
'
],
refresh_url
=
mdconf
[
'
refresh-url
'
],
auth_url
=
mdconf
[
'
auth-url
'
],
scope
=
mdconf
[
'
scope
'
],
base_api_url
=
mdconf
[
'
base-api-url
'
])
print
(
f
"
Updating dark run
{
args
.
id
}
to status
{
args
.
flg
}
at
{
mdconf
[
'
base-api-url
'
]
}
"
)
if
args
.
really
:
response
=
client_conn
.
update_dark_run_api
(
args
.
id
,
{
'
dark_run
'
:
{
'
flg_status
'
:
args
.
flg
,
'
calcat_feedback
'
:
args
.
msg
}
})
if
response
.
status_code
==
200
:
print
(
'
Run is updated
'
)
else
:
print
(
f
'
Update failed
{
response
}
'
)
else
:
print
(
"
Add --really to actually make these changes
"
)
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