Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/origin_save.py
Show First 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | query = { | ||||
} | } | ||||
] | ] | ||||
} | } | ||||
} | } | ||||
try: | try: | ||||
response = requests.post(es_workers_index_url, | response = requests.post(es_workers_index_url, | ||||
json={'query': query, | json={'query': query, | ||||
'sort': ['@timestamp']}) | 'sort': ['@timestamp']}, | ||||
timeout=30) | |||||
results = json.loads(response.text) | results = json.loads(response.text) | ||||
if results['hits']['total'] >= 1: | if results['hits']['total'] >= 1: | ||||
task_run_info = results['hits']['hits'][-1]['_source'] | task_run_info = results['hits']['hits'][-1]['_source'] | ||||
if 'swh_logging_args_runtime' in task_run_info: | if 'swh_logging_args_runtime' in task_run_info: | ||||
duration = task_run_info['swh_logging_args_runtime'] | duration = task_run_info['swh_logging_args_runtime'] | ||||
task_run['duration'] = duration | task_run['duration'] = duration | ||||
if 'message' in task_run_info: | if 'message' in task_run_info: | ||||
task_run['message'] = task_run_info['message'] | task_run['message'] = task_run_info['message'] | ||||
Show All 13 Lines |