Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependent Jobs #120

Open
bassrock opened this issue Jan 13, 2015 · 4 comments
Open

Dependent Jobs #120

bassrock opened this issue Jan 13, 2015 · 4 comments

Comments

@bassrock
Copy link

Unless this exists and I can not find a cool new feature would be dependent jobs. Whereas a job will stay queued unless a job it depends on has finished executing.

@danhunsaker
Copy link

This can be tricky to implement. Useful, certainly, but tricky. What kind of dependency do you want, here? By job ID? By job class? Something else? If you're using the by-ID approach, it's not terribly hard to determine when the job is done, but if you want to support by-class, things get more complex. Would you want support for a job depending on multiple prior jobs, waiting for all of them to complete before running? That adds a bit more complexity as well.

You'd want to add dependent jobs to a separate Redis key (probably a set) until the job they depend on completes, using a hook or the job's teardown to move them onto the regular job queue when the dependency is met. The alternative is to have the job itself determine if its dependency is met, then requeue itself if not. This is a really inefficient approach, which makes it a bad option.

It can be done, but it'll take some thinking to do it right.

@bassrock
Copy link
Author

I was thinking by job id much like the JobQueueBundle. We should probably decide on tactics before someone starts coding it though.

@bassrock
Copy link
Author

Working on this and more management features with a db persistence here: https://github.com/DABSquared/BCCResqueBundle

@danhunsaker
Copy link

By-ID makes sense. I'd like to see multi-ID dependency support (job B needs job A to complete before it can start, but job D needs jobs B and C to both complete first), if possible.

Of course, I'd also like to see this upstream, in PHP-Resque proper. But getting code merged there is unlikely for now.

bassrock added a commit to Klinche/BCCResqueBundle that referenced this issue Feb 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants