Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/origin_save.py
Show First 20 Lines • Show All 523 Lines • ▼ Show 20 Lines | Returns: | ||||
- **type**: loading task type | - **type**: loading task type | ||||
- **arguments**: loading task arguments | - **arguments**: loading task arguments | ||||
- **id**: loading task database identifier | - **id**: loading task database identifier | ||||
- **backend_id**: loading task celery identifier | - **backend_id**: loading task celery identifier | ||||
- **scheduled**: loading task scheduling date | - **scheduled**: loading task scheduling date | ||||
- **ended**: loading task termination date | - **ended**: loading task termination date | ||||
- **status**: loading task execution status | - **status**: loading task execution status | ||||
- **visit_status**: Actual visit status | |||||
Depending on the availability of the task logs in the elasticsearch | Depending on the availability of the task logs in the elasticsearch | ||||
cluster of Software Heritage, the returned dictionary may also | cluster of Software Heritage, the returned dictionary may also | ||||
contain the following keys: | contain the following keys: | ||||
- **name**: associated celery task name | - **name**: associated celery task name | ||||
- **message**: relevant log message from task execution | - **message**: relevant log message from task execution | ||||
- **duration**: task execution time (only if it succeeded) | - **duration**: task execution time (only if it succeeded) | ||||
Show All 13 Lines | ) -> Dict[str, Any]: | ||||
task_run = task_run[0] if task_run else None | task_run = task_run[0] if task_run else None | ||||
if task_run is None: | if task_run is None: | ||||
return {} | return {} | ||||
task_run["type"] = task["type"] | task_run["type"] = task["type"] | ||||
task_run["arguments"] = task["arguments"] | task_run["arguments"] = task["arguments"] | ||||
task_run["id"] = task_run["task"] | task_run["id"] = task_run["task"] | ||||
del task_run["task"] | del task_run["task"] | ||||
del task_run["metadata"] | del task_run["metadata"] | ||||
# Enrich the task run with the loading visit status | |||||
task_run["visit_status"] = save_request.visit_status | |||||
es_workers_index_url = config.get_config()["es_workers_index_url"] | es_workers_index_url = config.get_config()["es_workers_index_url"] | ||||
if not es_workers_index_url: | if not es_workers_index_url: | ||||
return task_run | return task_run | ||||
es_workers_index_url += "/_search" | es_workers_index_url += "/_search" | ||||
if save_request.visit_date: | if save_request.visit_date: | ||||
min_ts = save_request.visit_date | min_ts = save_request.visit_date | ||||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |