django-beanstalkd's Introduction
Modification of django-beanstalkd (https://github.com/jonasvp/django-beanstalkd/) by jonasvp. New Features: Storing all jobs and the current statuses to the local db. - In an older version of beanstalk, the binlog functionality had issues, so this mitigated the risk when beanstalk is restarted. - Also if the beanstalk server goes down, no jobs will be lost. - There are jobs included that will requeue jobs that weren't processed. Proper shutdown of beanstalk workers. - The original method involved killing worker processes, but jobs can be killed midpoint leading to unexpected behaviour. Ability to run workers for specific django apps. MESSAGE PRODUCERS: How to create a new asynchronous job: 1.) In your django application, create a module called fdrasync_jobs.py (asynchronous jobs). Exact naming is necessary. 2.) Within that file define your business logic i.e @fdrasync_job def myBusinessLogic(args) #your business logic here Notes: 1.) You must annotate your business logic method with the @fdrasync_job decorator 2.) args will be returned as a json array Finally, call the asynchronous methods. 1.) The following control variables can be passed into your asynctask instance. @priority -> you can set a priority for your task, so the consumers can process it accordingly @delay -> you can set a delay, the default is 0 @ttr -> ttr value. see: http://github.com/kr/beanstalkd/wiki/faq 2.) Call the run method of BaseAsyncTask with the following parameters Mandatory Parameters @function -> the reference to the annotated asynchronous business logic function @args -> a json serializable list of parameters i.e: Subclassing the base tasks for domain specific behaviour class MyAsyncJobs(BaseAsyncTasks): def myBusinessLogicJob(self) : #myBusinessLogic is the actual business logic located somewhere. self.run( myBusinessLogic, {'arg1' : arg1}) @fdrasync_job def myBusinessLogic(args) #your business logic here MESSAGE CONSUMERS: run: python manage.py beanstalk_worker [app name] this will sit and wait for new work and process the tasks produced by the producers. specify a [app name] to spawn a worker that listens for jobs for a specific django application
django-beanstalkd's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.