Giter VIP home page Giter VIP logo

pyres's Introduction

Pyres - a Resque clone

Resque is a great implementation of a job queue by the people at github. It's written in ruby, which is great, but I primarily work in python. So I took on the task of porting over the code to python and PyRes was the result

Project Goals

Because of some differences between ruby and python, there are a couple of places where I chose speed over correctness. The goal will be to eventually take the application and make it more pythonic without sacrificing the awesome functionality found in resque. At the same time, I hope to stay within the bounds of the original api and web interface.

Travis CI

Currently, pyres is being tested via travis ci for python version 2.6, 2.7, and 3.3: Build Status

Running Tests

  1. Install nose: $ easy_install nose
  2. Start redis: $ redis-server [PATH_TO_YOUR_REDIS_CONFIG]
  3. Run nose: $ nosetests Or more verbosely: $ nosetests -v

##Mailing List

To join the list simply send an email to [email protected]. This will subscribe you and send you information about your subscription, include unsubscribe information.

The archive can be found at http://librelist.com/browser/.

Information

pyres's People

Contributors

adammeghji avatar bamco avatar binarymatt avatar c-oreills avatar cezarsa avatar chawco avatar dcosson avatar dsc avatar fakechris avatar guilhermef avatar heynemann avatar irae avatar iserko avatar james-m-henderson avatar jmhobbs avatar joeshaw avatar kracekumar avatar mjrusso avatar morpheu avatar msabramo avatar robhudson avatar sontek avatar wesrog avatar wwitzel3 avatar yashh avatar

Stargazers

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

Watchers

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

pyres's Issues

use bpop methods

instead of polling, use the bpop methods as part of redis 2.0

Further Failed Items Improvements

We're using the failed items queue quite a lot at the moment.

There are several things that would be useful:

  • Ability to reference failed jobs by a url/id
  • Javascript requeue/delete
  • Multi select and then requeue/delete

It'd also be good to remember the page you were on when you hit requeue/delete but that's probably because our error list is massive right now :)

Not sure what the consensus on using javascript is? Might be able to help out with a patch at some point.

Miscellaneous pyres_web features are broken

Use setproctitle

I noticed that there is a package called setproctitle when gunicorn started using it recently. (See gunicorn commit: http://github.com/benoitc/gunicorn/commit/5afec8d7268b081ba2f1a806b08bd2418519aa59 and package details: http://pypi.python.org/pypi/setproctitle/ )

It would be very nice if the name of pyres workers (parents and children) took advantage of this to convey information. Examples from Resque:

$0 = "resque: Starting"

$0 = "resque: Forked #{@child} at #{Time.now.to_i}"

$0 = "resque: Processing #{job.queue} since #{Time.now.to_i}"

$0 = "resque: Paused"

$0 = "resque: Waiting for #{@queues.join(',')}"

create a 0.7 pyres package

need to create a new package with all the fixes/upgrades that have come in since 0.5. I'm going to update the package to version 0.7 because of the extra updates.

Failure Backend Support

I'm working on adding some failure backend support past the current redis-flavored failure handling. My first goal is hoptoad, but I might also build an email backend and some other stuff. Additionally, I'm going to offer the backend agnostic API that Resque currently features.

In line with project goals, I'm going for verisimilitude with Resque while striving to be pythonic, whatever that means.

refactor code

I'd like to remove most of the code in pyres from the init into modules where it makes sense. This is a style and maintenance thing for me. I also think this might help with the jobhook and extension issues.

NoneType has no perform method

I have a python project where I have {pyres, resweb, scripts} in resque folder. Whenever I put a job in the queue I do

>>> from resque.pyres import ResQ
>>> r = ResQ()
>>> r.enqueue(Someclass, "hello")

I am sure "Someclass" class has a perform method on it which prints the arg. But when the job is picked up it fails with error

NoneType has no perform method

When I have pyres in my project root it works. Just dont get why this is failing.

Crash when enqueuing job with more than one argument

(Thanks for fixing a previous logging bug with http://github.com/binarydud/pyres/commit/a5a0b603d059e6c11f3fd24c9a88e7001ca3919e)

There's another issue related to the logging of job arguments.

You would get this when trying to enqueue a job with more than one arg:

Traceback (most recent call last):
   ...
  File "/Users/mjr/Desktop/pyres/pyres/pyres/__init__.py", line 126, in enqueue
    logging.debug("job arguments: %s" % args)
TypeError: not all arguments converted during string formatting

(This happens because args is a tuple with length > 1.)

I modified a test to cause the current code to break, and checked in the fix to my fork here:

http://github.com/mjrusso/pyres/commit/e9440805f0268b73cecc377ad66dd20c6e1883e7

actual documentation

I need to get off my lazy ass and write some actual sphinx docs for this project. However, right now i will settle for a slightly better README.

Start multiple workers

Is there a way to start multiple workers.

$ ./pyres_worker queue1, queue2

Seems to start a worker which checks queue1, queue2 and sleep for 5. In production we need to have ability to start multiple workers / queue basis and keep the process under supervisord or some process monitor

redis reference inside job

I'd like to be able to easily access the redis instance that a job came from, within the perform method of the job class.

pypi package doesn't have pagage_data

recent builds put up on pypi seem to be lacking the package_data fro resweb. For now i've pointed the download to the github link for each version tag.

Ability to delete all items from the failed queue

It'd be nice to be able to delete all the items from the error queue rather than going through and deleting them individually (similarly it'd be good to be able to requeue all).

Not sure if this is in the pipeline or easy. I'm using pyres 0.8

actual logging

I was lazy and put print statement throughout the code. I need to modify the code to use the built-in logging module.

Pystache for ResWeb?

I saw this in the README: "I'd like to get this as close to the resque web interface as possible."

I've been meaning to port the Resque web interface over to use Mustache templates. If that happens, you could use Pystache and we could share both html and css.

I'd also volunteer to help work on the web interface, as I've been looking for excuses to do some on-the-side Python web hacking.

What do you think? Any interest in sharing templates and whatnot?

merge in scheduled tasks branch

the scheduled tasks branch is almost ready for master. I am going to try and add some more tests about the generators and the pop methods before I do the merge.

update logging for horde module

Inlcude better options than just logging to the console. Should have rotatable logs or logs that self rotate after a certain size.

migrate resweb to flask

Itty is nice for small webapps, but there are things that I'd like to do on resweb, such as flash messages. Flask is the first idea that popped into my head, but I would be willing to look at other options.

create job hooks

There needs to be a way to include before and after job hooks and perhaps after start and before end and such. This would allow for stuff like persistent db/socket/mail connections from workers.

pagination in resweb

certain views need pagination. Examples include the failures list and the queue listings

pyres_web doesn't work without package_data

When I switch to the v0.5.0 tag and install the pyres package via setup.py, pyres_web works fine.

When I switch to the current master and and install the pyres package via setup.py, pyres_web crashes when attempting to serve a page. Take a look:

$> pyres_web
itty starting up (using wsgiref)...
Listening on http://localhost:8080...
Use Ctrl-C to quit.

<type 'exceptions.IOError'> occurred on '/': [Errno 2] No such file or directory: '/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/templates/overview.mustache'
Traceback: Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/itty-0.6.4-py2.6.egg/itty.py", line 225, in handle_request
    response = callback(request, **kwargs)
  File "/Library/Python/2.6/site-packages/itty-0.6.4-py2.6.egg/itty.py", line 344, in new
    return method(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/server.py", line 23, in index
    return str(Overview(HOST).render())
  File "build/bdist.macosx-10.6-universal/egg/pystache/view.py", line 95, in render
    template = self.load_template()
  File "build/bdist.macosx-10.6-universal/egg/pystache/view.py", line 61, in load_template
    f = open(self.template_file, 'r')
IOError: [Errno 2] No such file or directory: '/Library/Python/2.6/site-packages/pyres-0.5.0-py2.6.egg/resweb/templates/overview.mustache'
localhost - - [22/Feb/2010 00:18:09] "GET / HTTP/1.1" 500 17

This might be related to issue #12.

I added the following line to setup.py and the interface now works fine:

package_data={'resweb': ['templates/*.mustache','media/*']},

Augment Queue view with more detail

This is a low-priority feature request, but it would be convenient to augment the Queue view to show the last x successfully completed jobs and last x failed jobs (in addition to just the pending jobs, as we have today).

pyres should be compatible with resque

I think that pyres should be compatible with resque.

I should be able to use pyres_worker to create Python workers that can subsequently be monitored via the resque web interface. Conversely, I should be able to use rake resque:work to create a Ruby worker that can then be monitored by the pyres web interface.

This is important because there are a number of alternative worker implementations being built against resque -- for example, in the C, C#, Scala languages.

Right now, I believe that the only issue barring compatibility is the timestamp format. The pyres web interface crashes if a job is created by a Ruby resque worker, because it reads a timestamp in a format it is not expecting. (The resque web interface reports all dates/times as NaN for all jobs created by Python pyres workers.)

This could trivially be fixed by changing the pyres timestamp format to match resque's.

I can make the change in my fork, but I would like to know if this will make it into the mainline.

klass vs class?

This is looking good! What's the reason for using klass in the payload instead of class?

Just asking because using class would make pyres compatible with Resque and the Scala version of Resque.

add kwargs to enqueue and enqueue_at

it would be nice to be able to use not only args, but also kwargs in the enqueue method. As far as I can tell, the only problem that might pop up would be enqueuing something with kwargs, but the job's perform method doesn't actually take any keyword arguments. Of course, this same issue applies to positional arguments as well.

delayed_queue_schedule_size() returns incorrect value

It seems that delayed_queue_schedule_size() relies on the cardinality of the resque:delayed_queue_schedule ZSET. This means that any jobs that occur within the same second/timestamp will only be counted as a single job, thereby producing an incorrect return value.

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.