|
@@ -42,29 +42,26 @@ def get_job_logs(job_id: int = None, params: Params=Depends(get_page), db: Sessi
|
|
|
res = []
|
|
|
for af_job_run in af_job_runs:
|
|
|
tasks = list(af_job_run.details['tasks'].values()) if len(list(af_job_run.details['tasks'].values()))>0 else []
|
|
|
- if len(tasks) > 0:
|
|
|
- task = tasks[-1]
|
|
|
- task.pop('log',None)
|
|
|
- job_id = af_to_datax[int(af_job_run.job_id)]
|
|
|
- execute_result = None
|
|
|
- if af_job_run.status <= 1:
|
|
|
- run_status = get_job_run_status(af_job_run.id)
|
|
|
- execute_result = run_status['data']['status']
|
|
|
- log = {
|
|
|
- "id": af_job_run.id,
|
|
|
- "job_id": job_id,
|
|
|
- "job_name": id_to_job[job_id].name,
|
|
|
- "job_type": id_to_job[job_id].type,
|
|
|
- "job_tag": id_to_job[job_id].tag,
|
|
|
- "af_job_id": int(af_job_run.job_id),
|
|
|
- "run_id": af_job_run.af_run_id,
|
|
|
- "trigger_time": af_job_run.start_time,
|
|
|
- "trigger_result": 1,
|
|
|
- "execute_time": task['start_time'] if task else 0,
|
|
|
- "execute_result": execute_result if execute_result else af_job_run.status,
|
|
|
- "end_time": task['end_time'] if task else 0,
|
|
|
- }
|
|
|
- res.append(log)
|
|
|
+ task = tasks[-1] if len(tasks) > 0 else None
|
|
|
+ job_id = af_to_datax[int(af_job_run.job_id)]
|
|
|
+ execute_result = None
|
|
|
+ if af_job_run.status <= 1:
|
|
|
+ run_status = get_job_run_status(af_job_run.id)
|
|
|
+ execute_result = run_status['data']['status']
|
|
|
+ log = {
|
|
|
+ "id": af_job_run.id,
|
|
|
+ "job_id": job_id,
|
|
|
+ "job_name": id_to_job[job_id].name,
|
|
|
+ "job_type": id_to_job[job_id].type,
|
|
|
+ "job_tag": id_to_job[job_id].tag,
|
|
|
+ "af_job_id": int(af_job_run.job_id),
|
|
|
+ "run_id": af_job_run.af_run_id,
|
|
|
+ "trigger_time": af_job_run.start_time,
|
|
|
+ "trigger_result": 1,
|
|
|
+ "execute_time": task['start_time'] if task else None,
|
|
|
+ "execute_result": execute_result if execute_result else af_job_run.status,
|
|
|
+ }
|
|
|
+ res.append(log)
|
|
|
return page_help(res,params['page'],params['size'],total)
|
|
|
|
|
|
@router.get("/logs")
|