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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for periodtask-0.4.1.tar.gz
Algorithm Hash digest
SHA256 2586d26653527906cce323aec2da5f4e8e15d473f8dc3805dcaf3917fbd9e22c
MD5 a7753ad42d71de93d1669681f3d09410
BLAKE2b-256 23835c7408384c288b36a156a5df56ef317d201fc44896666ed7b12dcdc4144a

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