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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for periodtask-0.4.2.tar.gz
Algorithm Hash digest
SHA256 0d4c4fb4e90f046bf826d9ecfaa49c4a996b3cc6404a64c42ba01a23d04d27dc
MD5 b84525f0f88dca8639c49cceda496f4f
BLAKE2b-256 5d127a06704e19b0dda3ee21a7ff3c3607e609df39698d7c3477e21f7f664935

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