Giter VIP home page Giter VIP logo

zappa-call-later's Introduction

zappa-call-later

Description

A db driven way to run tasks at a future point in time, or at a regular interval, for Django Zappa projects (https://github.com/Miserlou/Zappa).

Installation

pip install zappa-call-later

To check for tasks every 4 minutes, add the below to zappa_settings.json:

{
  "dev": {
    "keep_warm": false,
    "events": [
      {
        "function": "zappa_call_later.zappa_check.now",
        "expression": "rate(4 minute)"
      }
    ]
  }
}

Usage

Low level currently, where you create and save your tasks straight to db.

def test_function(_arg1, _arg2, _kwarg1=1, _kwarg2=2):
    return _arg1, _arg2, _kwarg1, _kwarg2

call_later = CallLater()
call_later.function = test_function
call_later.args = (3, 4) # for the above function
call_later.kwargs = {'_kwarg1': 11, '_kwarg2': 22} # for the above function
call_later.time_to_run = timezone.now() + timedelta(minutes=8)
call_later.save()

You can also repeatedly call your task:

call_later_twice.every = timedelta(seconds=1)
call_later_twice.repeat = 2

There are 2 types of failure:

  • If a task fails to run, it is run on the next checking event. By default, there are 3 attempts to run a function.
  • If a task takes too long to run, it is again run on the next checking event. By default, there are 3 retries.

...the task is labelled as problematic after repeated fails.

zappa-call-later's People

Contributors

andytwoods avatar

Watchers

James Cloos avatar

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.