Skip to content
Snippets Groups Projects
Commit 7834c6e4 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

update mdc

parent ffc390ef
No related branches found
No related tags found
1 merge request!345Deployed version as on 31.08.2020 on xcal
import yaml
import argparse
import yaml
from metadata_client.metadata_client import MetadataClient
parser = argparse.ArgumentParser(
description='Request dark characterization. Will wait on data transfers to complete first!')
parser.add_argument('--conf-file', type=str, help='Path to webcervice config', default='/home/xcal/calibration_webservice_deployed/webservice/webservice.yaml')
parser.add_argument('--flg', type=str, choices=["NA", "R", "A"], help='Status flag for MDC request')
description='Update run status at MDC for a given run id.')
parser.add_argument('--conf-file', type=str, help='Path to webservice config',
default='/home/xcal/calibration_webservice_deployed/webservice/webservice.yaml') # noqa
parser.add_argument('--flg', type=str, choices=["NA", "R", "A"],
help='Status flag for MDC request: NA - not available, R - running, A - available.') # noqa
parser.add_argument('--rid', type=int, help='Run id from MDC')
parser.add_argument('--msg', type=str, help='Message string to MDC')
parser.add_argument('--msg', type=str, help='Message string to MDC',
default='Error while job submission')
args = vars(parser.parse_args())
conf_file = args['conf_file']
......@@ -19,23 +21,24 @@ rid = args['rid']
flg = args['flg']
msg = args['msg']
with open(conf_file, "r") as f:
config = yaml.load(f.read(), Loader=yaml.FullLoader)
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'])
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'])
response = client_conn.update_run_api(rid, {'flg_cal_data_status': flg,
'cal_pipeline_reply': msg})
print(response, response.status_code)
if response.status_code == 200:
print('Run is updated')
else:
print(f'Update failed {response}')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment