Skip to main content

Scheduled method execution for the Pico ecosystem: @scheduled(every=...) and @scheduled(cron=...) on components.

Project description

pico-scheduling

PyPI version License: MIT CI codecov Docs

Scheduled method execution for the pico ecosystem: @scheduled on component methods, powered by APScheduler.

Installation

pip install pico-scheduling

Auto-discovered by pico-boot; with plain pico-ioc add "pico_scheduling" to init(modules=[...]).

Quick start

from pico_ioc import component
from pico_scheduling import scheduled

@component
class Reports:
    @scheduled(every=300)          # every 5 minutes
    def refresh_cache(self): ...

    @scheduled(cron="0 3 * * *")   # 03:00 daily
    async def nightly_rollup(self): ...

Jobs start when the container starts and stop on container.shutdown(). Each run resolves the component through the container (prototype scope gives a fresh instance per run). A failing job is logged and does not stop the schedule. Sync and async methods both work.

Disable everything with config:

scheduling:
  enabled: false

Documentation

Full documentation: https://dperezcabrera.github.io/pico-scheduling/

License

MIT

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

pico_scheduling-0.1.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pico_scheduling-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pico_scheduling-0.1.0.tar.gz.

File metadata

  • Download URL: pico_scheduling-0.1.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pico_scheduling-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22ab877ab93c4476e9f52f8c00c1af56f883e9d35a1ae0321588c22a0338a3d0
MD5 d0e8e8f4de2865bc6ae8083486479c8a
BLAKE2b-256 14c800e1d86987d92ca65792eccb0f06aa9f4f555ac1b5bc09839fab4c0e58f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_scheduling-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-scheduling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for pico_scheduling-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6c6bf1e3d4be3229faaa45dfc61c3741c9b177c1241836a9dec1c7dc3eed4c4
MD5 fc5aa02d95da29a182f81c75b0fa42e4
BLAKE2b-256 7a34d8abcdc13b5742462aed5c8c8b5358c1df2218fa74d82675c40755b504e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pico_scheduling-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on dperezcabrera/pico-scheduling

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page