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.131.tar.gz (7.2 kB view hashes)

Uploaded Source

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