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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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