Skip to content

Commit

Permalink
Perhaps improve log fetching?
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Dec 2, 2023
1 parent ccee090 commit 8346732
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions etl_server/pipelines/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ def __get_logs(self, id):
ti = finished_tis[-1]

if ti is not None:
dag = dagbag.get_dag(id)
if dag:
ti.task = dag.get_task(ti.task_id)
logs, _ = handler.read(ti, None, metadata={})
else:
logs = []
# dag = dagbag.get_dag(id)
# if dag:
# ti.task = dag.get_task(ti.task_id)
logs, _ = handler.read(ti, None, metadata={})
# else:
# logs = []
prefix = [f'*** STATE: {ti.state} EXECUTION DATE: {ti.execution_date} RUN ID: {ti.run_id} ***']
if isinstance(logs, list):
try:
logs = logs[0][0][1].split('\n')
logs = logs[-1][0][1].split('\n')
except:
logs = []
pre, post = logs[:50], logs[50:]
Expand Down

0 comments on commit 8346732

Please sign in to comment.