Skip to content

[BUG] schedule defined by time_elements is rescheduled every second when disabled (job or all jobs) #63699

Closed
@lufik

Description

Description
salt reschedule every second all disabled jobs which are defined using time_elements.

https://github.com/saltstack/salt/blob/master/salt/utils/schedule.py (eval function - runs every second):
def _handle_time_elements(data) - define _seconds every eval invocation
https://github.com/saltstack/salt/blob/master/salt/utils/schedule.py#L1553

also _skipped is set for every disabled job
https://github.com/saltstack/salt/blob/master/salt/utils/schedule.py#L1708

and this leads in final section to reschedule the scheduled job
https://github.com/saltstack/salt/blob/master/salt/utils/schedule.py#L1766

Documentation says nothing about this.
Current behavior makes us troubles when we use disabling jobs that some of them never runs.

Setup
salt version 3000 and higher including master (I haven't looked for exact change/commit for this change)

Steps to Reproduce the behavior
define salt schedule job e.g.:

test:
  enabled: true
  function: test.ping
  maxrunning: 1
  minutes: 5
  run_on_start: false

after that run:
$ salt-call schedule.show_next_fire_time test
$ salt-call schedule.show_next_fire_time test
$ salt-call schedule.disable
$ salt-call schedule.show_next_fire_time test
$ salt-call schedule.show_next_fire_time test

every schedule.show_next_fire_time call returns different fire time when disabled

Expected behavior
Scheduled job gets rescheduled only at time when it should run (or as close after due to disabling as possible). Not all the time while it's disabled.

Versions Report
master (at least since 3000)

Metadata

Labels

Bugbroken, incorrect, or confusing behaviorSulfur v3006.0release code name and version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions