GithubHelp home page GithubHelp logo

clepsydra's People

Contributors

tishka17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

t3m8ch amtp1

clepsydra's Issues

Task context

We need to pass some context to any task.
It should contain

  • scheduler instance
  • info about task run (run type, retry and so on)
  • custom global params
  • params from middlewares

One time and repetable tasks

Task can be planned for one time run or for periodic run.
For periodic tasks we expect:

  • delay (or time) before first run
  • period between repeats:
    • monthly on certan date
    • weekly
    • after certain number of days
    • every N seconds or minutes
    • cron-like syntax

Testing timers

You need to make a timer test feature

It' s especially useful for cron-timers, because their logic is the most complex.

Example API:

from datetime import datetime

import pytest
from clepsydra.testing import create_test_scheduler, TestScheduler
from clepsydra.rules import CronRule


def first_job(context: dict):
    context["tested"] = True


@pytest.fixture
def scheduler() -> TestScheduler:
    scheduler = create_test_scheduler()
    scheduler.task(first_job)

    scheduler.add_task(
        "first_job",
        CronRule(hour="*", minute=0, second=0)
    )


def test_first_job(scheduler: TestScheduler) -> None:
    context = scheduler.trigger_tasks(datetime(2021, 3, 3, 5, 0, 0))
    assert context.get("tested")

This API is really far from perfect, so I welcome the discussion.

Cuncurrent tasks

Tasks must be started concurrently with different limitation strategies: by number, by memory and so on

Missed jobs behavior

Configure interval per-scheduer and per-job when missed jobs can be executed.
Check different reasons of missing: because of other jobs or because of stopped scheduler

Distributed workers

Support to run multuple workers on different severs with single task storage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.