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.3.tar.gz (8.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for periodtask-0.4.3.tar.gz
Algorithm Hash digest
SHA256 873036c367e0be97121f31e6741574b667e15da8b0b9db75e946df24727360b1
MD5 b389b926e5bebe2ac3516427d8b61934
BLAKE2b-256 e484ced21b143eff338cf17ca28e01a0e3e56e3294e1bf6f6d889b525c128fe1

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