dbader / dbader/schedule

Seeing the same problem as seen in issue #58 with independent log output

Open
#255 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12.3k
Forks
999
PR merge metrics
No merged PRs in 30d

Description

Testing two jobs (one every 180 seconds and one every 10 minutes) and using parent code to generate log messages shows the wrong value for ``next_run`` every time after initial startup (meaning it's only correct when the last_run time is None).

We're running it from a daemon that forks a separate child for the run_pending loop which calls the function that runs the actual job command. It all runs fine, both jobs are executed but the timing of each job seen in the log can be + 30 secs or more after the "nominal" time it should execute.

The problem is that our "next job" timestamp is always equal to or behind the time of the job that just completed. The log time comes from calling next_run at the end of the above function *after* the actual job command returns (with and without time.sleep for one or two secs before the call to next_run).

The first TIMESTAMP entry is called at the beginning of the same function before the job command.

Here's an example:

```
TIMESTAMP:
2018-11-08 21:01:13 UTC
================================================================================
Starting Ansible Pull at 2018-11-08 16:01:18
/usr/lib/python-exec/python3.6/ansible-pull blah blah blah.yml
localhost | SUCCESS => {
"after": "555abd0f005c7e43fbf1aec40f70a283cb86bdf2",
"before": "555abd0f005c7e43fbf1aec40f70a283cb86bdf2",
"changed": false,
"remote_url_changed": false
}
Repository has not changed, quitting.

================================================================================
NEXT JOB:
2018-11-08 21:01:13 UTC
================================================================================
TIMESTAMP:
2018-11-08 21:04:42 UTC
================================================================================
Starting Ansible Pull at 2018-11-08 16:04:46
/usr/lib/python-exec/python3.6/ansible-pull blah blah blah.yml
localhost | SUCCESS => {
"after": "555abd0f005c7e43fbf1aec40f70a283cb86bdf2",
"before": "555abd0f005c7e43fbf1aec40f70a283cb86bdf2",
"changed": false,
"remote_url_changed": false
}
Repository has not changed, quitting.

================================================================================
NEXT JOB:
2018-11-08 21:04:41 UTC
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.