get_current_job() doesn't work with async jobs #143

Closed
nvie opened this Issue Sep 19, 2012 · 3 comments

Comments

Projects
None yet
3 participants
Owner

nvie commented Sep 19, 2012

From looking through the code, it appears that the job is only saved to redis after it has completed, so any call to get_current_job() will fail on attempting to retrieve the job from redis.

(Thanks for reporting, @omarkhan)

jtsoi commented Sep 20, 2012

Hi Vincent,

Just forked your repo, great lib.

I think there is a related problem with job.is_finished
the worker manages the status of a job, so status is never updated for sync jobs.

Not sure how to fix this, but looking at your plans for concurrency, I would suggest a "SyncWorker".
The other way is to make sure the jobs handle their own state.

/JT

Collaborator

selwin commented Nov 1, 2012

@nvie yeah, I wrote the non async code before get_current_job was introduced. It seems like now we'd have to save the job to Redis before running it.

I think @jtsoi 's problem is slightly different. I think @jtsoi 's second suggestion (i.e jobs handling their own state when executing callables) seems like a cleaner approach to me .

Thoughts?

This was referenced Nov 25, 2012

Owner

nvie commented Nov 25, 2012

Fixed by #156, thanks @selwin.

@nvie nvie closed this Nov 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment