Skip to content

Using splay in cron schedule throws exception "unsupported operand type(s) for +: 'NoneType' and 'int'" #44583

Closed

Description

@creideiki

Description of Issue/Question

I want to add a scheduled job so that all my minions run a highstate every night. When I set a fixed time for the job, everything works. However, when I add a splay time, the scheduled jobs aren't executed, and the minion logs contain only:

2017-11-17 14:56:00,089 [salt.minion      ][ERROR   ][18156] Exception unsupported operand type(s) for +: 'NoneType' and 'int' occurred in scheduled job

I added logging output to utils/schedule.py which points to the error coming from this line, which adds the randomised splay time. When it runs, data['_next_fire_time'] is None, which obviously cannot be added to.

That None, in turn, is explicitly set a few lines before, in code added by @vutny in 6f967ac, which I do not know enough Salt internals to understand the rationale for.

Setup

nightly-highstate:
  schedule.present:
    - function: state.highstate
    - returner: pgjsonb
    - cron: '56 14 * * *'
    - splay: 10

Versions Report

Salt Version:
           Salt: 2017.7.2
 
Dependency Versions:
           cffi: 1.6.0
       cherrypy: unknown
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.24.6
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.24.2
         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.4.1708 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-693.2.2.el7.x86_64
         system: Linux
        version: CentOS Linux 7.4.1708 Core

Activity

  1. vutny commented on Nov 20, 2017

    @vutny
    Contributor

    Hi @creideiki

    It is very possible, that when I tried to fix one thing, I've broke another one.
    I rely on Salt's Job Scheduler very hard in my recent project, so I will try to look at this issue in the nearest future.

    Thanks for reporting.

  2. added this to the Approved milestone on Nov 20, 2017
  3. added
    bug
    severity-medium
    P2
    on Nov 20, 2017
  4. vutny commented on Nov 22, 2017

    @vutny
    Contributor

    @creideiki I have attempted to fix this in PR #44640, would you mind to test the patch? Thanks a lot.

  5. creideiki commented on Nov 22, 2017

    @creideiki
    ContributorAuthor

    With #44640 applied on the minions (but not on the master), the jobs now run, but all run at exactly the set time. Splay time is not applied.

  6. vutny commented on Nov 22, 2017

    @vutny
    Contributor

    @creideiki Okay, this appeared to be more complicated than I initially thought 😅
    I have pushed another fix in my PR, and I believe it should work with all type of schedules as well.
    Could you please make another test?

  7. creideiki commented on Nov 22, 2017

    @creideiki
    ContributorAuthor

    I ran ee9fedf with a schedule of

    cron: '*/5 * * * *'
    splay: 60
    

    Let it run for three iterations (15 minutes). Seems to work so far.

  8. vutny commented on Nov 22, 2017

    @vutny
    Contributor

    @creideiki Awesome! Thank you for the feedback.

  9. added a commit that references this issue on Nov 30, 2017
    06fb80b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bugseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions