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

[WIP] Feature: Send stdout and stderr to Galaxy while job is running #345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gecage952
Copy link

Hey,
So this is related to this pr in the main Galaxy repo: galaxyproject/galaxy#16975.
The changes facilitate sending both stdout and stderr to Galaxy while a job is running for the purposes of displaying said stdout inside of Galaxy while the job is running.

The main changes include adding two parameters to the app.yml config: send_stdout_update which is a boolean, and stdout_update_interval which is a float. The first controls whether Pulsar will send stdout/stderr or not, the second is the interval (in seconds) between updates.

The way that the files is sent is through the files endpoint in Galaxy. In order to not send the entire file each time, in a dict I keep track of the position in the stdout/stderr file that the last update read up to. I then only send the new part of the stdout file.

After the job is finished, I send any stdout/stderr left that has not been sent. In the final status message send over the broker, instead of including stdout there, I set the stdout and stderr fields there to None, so that it doesn't send the whole file again. In Galaxy, there are a couple of changes in the Pulsar job runner that check if those fields are None, and if so load the stdout from the job directory there.

Like with the other pr, this was done mostly with the intent of not messing around with existing functionality, which is why we didn't want to use messages to send it. Also, like the other pr, any feedback is welcome.

postprocess_success = postprocess(job_directory, self.__postprocess_action_executor)
except Exception:
log.exception("Failed to postprocess results for job id %s" % job_id)
final_status = status.COMPLETE if postprocess_success else status.FAILED
if job_directory.has_metadata(JOB_FILE_PREPROCESSING_FAILED):
final_status = status.FAILED
self.__state_change_callback(final_status, job_id)
self.__stdout_file_pointer_map.pop(job_id)
self.__stderr_file_pointer_map.pop(job_id)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to persist this somehow for this to work properly? If Pulsar restarts it is going to lose the current position right? Is that a problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants