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

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

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 datetime, timedelta

from indecro.rules import RunOnce


# Rule, theft control time when scheduled task would be executed


@scheduler.job(rule=RunOnce(at=datetime.now() + 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(at=datetime.now() + 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.102.tar.gz (6.5 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