# -*- coding: utf-8 -*-
'''
Management of the Salt scheduler
==============================================

.. code-block:: yaml

    job3:
      schedule.present:
        - function: test.ping
        - seconds: 3600
        - splay: 10

    This will schedule the command: test.ping every 3600 seconds
    (every hour) splaying the time between 0 and 10 seconds

    job2:
      schedule.present:
        - function: test.ping
        - seconds: 15
        - splay:
            - start: 10
            - end: 20

    This will schedule the command: test.ping every 3600 seconds
    (every hour) splaying the time between 10 and 20 seconds

    job1:
      schedule.present:
        - function: state.sls
        - job_args:
          - httpd
        - job_kwargs:
            test: True
        - when:
            - Monday 5:00pm
            - Tuesday 3:00pm
            - Wednesday 5:00pm
            - Thursday 3:00pm
            - Friday 5:00pm

    This will schedule the command: state.sls httpd test=True at 5pm on Monday,
    Wednesday and Friday, and 3pm on Tuesday and Thursday.  Requires that
    python-dateutil is installed on the minion.

    job1:
      schedule.present:
        - function: state.sls
        - job_args:
          - httpd
        - job_kwargs:
            test: True
        - cron: '*/5 * * * *'

    Scheduled jobs can also be specified using the format used by cron.  This will
    schedule the command: state.sls httpd test=True to run every 5 minutes.  Requires
    that python-croniter is installed on the minion.

    job1:
      schedule.present:
        - function: state.sls
        - job_args:
          - httpd