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

yadage: starting times of jobs are missing in the database #235

Open
mdonadoni opened this issue Oct 7, 2022 · 1 comment
Open

yadage: starting times of jobs are missing in the database #235

mdonadoni opened this issue Oct 7, 2022 · 1 comment

Comments

@mdonadoni
Copy link
Member

The starting times of jobs are not saved in the database. Note that, instead, finishing times are correctly persisted.

How to reproduce:

  1. Execute one of the demo yadage workflows
  2. Connect to the database kubectl exec -it deployment/reana-db -- psql -U reana reana
  3. Check that started_at is not set to any value
reana=# select id_, started_at, finished_at, status from __reana.job;
                 id_                  |         started_at         |        finished_at         |  status  
--------------------------------------+----------------------------+----------------------------+----------
 bb50a2cc-0496-4d7d-9a70-e016e1bba386 |                            | 2022-10-07 08:20:17.793953 | finished
 14dc7493-91be-4eba-9e70-4f82ba34ad4d |                            | 2022-10-07 08:20:02.482219 | finished
@mdonadoni
Copy link
Member Author

This is due to the rate at which the workflow engine polls the status of the job:

WORKFLOW_TRACKING_UPDATE_INTERVAL_SECONDS = 15
LOG_INTERVAL_SECONDS = 15

If a job is fast enough, it can happen that its status goes from created to finished, without ever being running. The started_at time is thus never set (source):

@event.listens_for(Job.status, "set")
def job_status_change_listener(job, new_status, old_status, initiator):
    """Job status change listener."""
    if new_status != old_status:
        from .database import Session

        if new_status in [
            JobStatus.finished,
            JobStatus.failed,
        ]:
            job.finished_at = datetime.now()
        elif new_status in [JobStatus.running]:
            job.started_at = datetime.now()

        Session.commit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant