Skip to main content

Nameko cron extension

Project description

Nameko Cron

Nameko Cron entrypoint fires based on a cron expression. It is not cluster-aware and will fire on all service instances. The cron schedule is based on croniter.

Usage

from nameko_cron import cron


class Service:
    name ="service"

    @cron('*/5 * * * *')
    def ping(self):
        # executes every 5 minutes
        print("pong")

timezone-aware cron schedules are also available

from nameko_cron import cron


class Service:
    name ="service"

    @cron('0 12 * * *', tz='America/Chicago')
    def ping(self):
        # executes every day at noon America/Chicago time
        print("pong")

by default, if a worker takes longer than the next scheduled run the worker will wait until the task is complete before immediately launching a new worker. This behavior can be controlled via the concurrency keyword argument.

ConcurrencyPolicy.WAIT is that default behavior.

ConcurrencyPolicy.ALLOW will spawn a worker regardless of whether existing workers are still running.

ConcurrencyPolicy.SKIP will skip a run if the previous worker lapsed the next scheduled run.

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

nameko-cron-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

nameko_cron-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nameko-cron-0.1.0.tar.gz.

File metadata

  • Download URL: nameko-cron-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for nameko-cron-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e96877a60c96d788e99482ba81c7683d293cfdfa58e6584e452aec47081dfcb4
MD5 25886a71636924968c87d5830087c05f
BLAKE2b-256 3f92c73d1092aa2deb72dbae1d0408c1b1d216052424affed0cc507d362c983b

See more details on using hashes here.

File details

Details for the file nameko_cron-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nameko_cron-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for nameko_cron-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19f9f1590178c52bc29990c0751f55e8ecba674ed8549dc08b7f32fad1cc6a5f
MD5 2dec3fc9cab5971c89039c28ab7b61c1
BLAKE2b-256 00ab122017cceed8430d4b7d284d58cd8c60639ce7c71124a6f8f57865e5b6fc

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