Skip to main content

Periodic task with timezone

Project description

Periodic task with timezone

from periodtask import Task, Period, parse_cron, 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
    )

task = Task(
    name='test',
    command=('/periodtask/test_script.py',),
    periods=[
        Period(
            timezone='Europe/Budapest',
            minutes=list(range(0, 60)),
            seconds=list(range(0, 60, 5)),
        ),
        parse_cron('* * * * * Europe/Budapest * */5')
    ],
    run_on_start=True,
    mail_failure=True,
    mail_success=True,
    mail_skipped=True,
    wait_timeout=5,
    stop_signal=signal.SIGINT,
    send_mail_func=_send_mail,
    policy=SKIP
)
task.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.0.tar.gz (7.9 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for periodtask-0.4.0.tar.gz
Algorithm Hash digest
SHA256 64e296b106e630a8c70a6adf64e757c3be2ec5607e94dc53f86f807e7d504b36
MD5 fb0f1b5c0da377849f524de03cfe13cd
BLAKE2b-256 ba1401e460145fe6f5edd2eda361feba7326a7e5aa403b74779afb5cc03a529d

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