Skip to main content

Periodic task with timezone

Project description

Periodic task with timezone

from periodtask import Task, TaskList, Period, send_mail

def _send_mail(subject, message, html_message=None):
    return send_mail(
        subject, message,
        from_email='from@my.service',
        recipient_list=['admins@my.service'],
        html_message=html_message
    )

tasks = TaskList(
    Task(
      name='test',
      command=('/periodtask/test_script.py',),
      periods=[
          '* * * * * Europe/Budapest * */5',
          Period(
              timezone='Europe/Budapest',
              minutes=list(range(0, 60)),
              seconds=list(range(0, 60, 5)),
          ),
      ],
      run_on_start=True,
      mail_failure=True,
      mail_success=False,
      mail_skipped=True,
      wait_timeout=5,
      stop_signal=signal.SIGINT,
      send_mail_func=_send_mail,
      policy=SKIP
    )
)

tasks.start()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

periodtask-0.4.4.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file periodtask-0.4.4.tar.gz.

File metadata

  • Download URL: periodtask-0.4.4.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for periodtask-0.4.4.tar.gz
Algorithm Hash digest
SHA256 12322cd88dce2054397310982117fbfd29c915c9ab2f36b5eb296bc587e1a0e8
MD5 90faedcc06fbeed3def302e96837dca2
BLAKE2b-256 7a69d23c77f2aa3480f9e8312666684a63127269cc1ea208fc80494a96febcb1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page