Skip to main content

Python scheduler with task independency from scheduler, executor and others

Project description

Intro

Indecro is a simple framework for job scheduling

All parts are designed to be replaceable.

Main ideas are:

  • Task creator doesn't need to know how tasks are implemented or executed
  • Persistence may be implemented
  • You can choose how jobs will be parallelized and whether they will be parallelized at all
  • Not only time-based scheduling rules! Magic filters and bool-based rules is available

Currently project is in the design stage and any APIs are to be changed

How to install:

Install using pip

pip install indecro

How to use:

Create scheduler

from indecro import Scheduler
from indecro.executor import Executor
from indecro.storage.memory_storage import MemoryStorage

scheduler = Scheduler(
    executor=Executor(),
    storage=MemoryStorage()
)

Schedule job using decorator-based shortcut (custom job name can be provided for compatibility)

from datetime import timedelta

from indecro.rules import RunOnce


# Rule, theft control time when scheduled task would be executed
@scheduler.job(rule=RunOnce(after=timedelta(seconds=10)))
async def some_job():
    print('Executing some job..')

Schedule job using direct function

async def some_another_job():
    print('Executing some another job..')


scheduler.add_job(
    some_another_job,
    rule=RunOnce(after=timedelta(seconds=20))
)

Run scheduler:

await scheduler.run()

More examples of using framework you can find in examples directory

cd examples
ls

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

indecro-0.135.tar.gz (9.7 kB view details)

Uploaded Source

File details

Details for the file indecro-0.135.tar.gz.

File metadata

  • Download URL: indecro-0.135.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for indecro-0.135.tar.gz
Algorithm Hash digest
SHA256 b9bfe223f894cf6127303dbc33ef2725ab973f4478f73c4b6ca600b2a928bbfa
MD5 bf6ce72a482b551b6d25148fba1123de
BLAKE2b-256 957cfd4f164fde181163c1da99497f68b7823e0cfffadbaff7bbc3c8e03e231b

See more details on using hashes here.

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