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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for periodtask-0.4.5.tar.gz
Algorithm Hash digest
SHA256 77fcfb237e4bf30341b2d73a16f4744cc2fe981562bf160dc7db2aeca4f7c337
MD5 dc4f459ee1b9ec10135025bd4e691762
BLAKE2b-256 f6f0f826be830f5c5139547019b9dc8295b467be745ad8bdc9092683d1376301

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