Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persist copy_job output to DB and display it when task has completed. #397

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/backend/api/managers/copy_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ def retrieve(id):
else:
logging.error("Rabbitmq closed the connection. Failing silently")

try:
textFromDB = copy_job.progress_error.split("|^|")
try:
copy_job.progress_text
except:
if len(textFromDB) > 0:
copy_job.progress_text = textFromDB[0]
if len(textFromDB) > 1:
copy_job.progress_error_text = textFromDB[1]
except:
logging.error("no task output found in DB. Failing silently")

return copy_job


Expand Down
3 changes: 3 additions & 0 deletions src/backend/api/tasks/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def copy_job(self, task_id=None):
else:
copy_job.progress_state = 'FAILED'

# save copy stdout and stderr to DB #ZR
output_text = connection.copy_text(task_id) + "|^|" + connection.copy_error_text(task_id)
copy_job.progress_error = output_text

copy_job.progress_current = 100
copy_job.progress_execution_time = int(time.time() - start_time)
Expand Down