vsivsi / meteor-job-collection

A persistent and reactive job queue for Meteor, supporting distributed workers that can run anywhere.
https://atmospherejs.com/vsivsi/job-collection
Other
385 stars 68 forks source link

Is it necessary to call job.done() when job.progress() is 100%? #135

Closed a4xrbj1 closed 8 years ago

a4xrbj1 commented 8 years ago

I'm currently using job.progress() to show progress of several iterations until it's 100% finished. Only in those cases I'm currently not using job.done() to finish a job.

My question is a job.done() automatically executed from the system when the job.progress() reaches 100% completion?

Otherwise I quickly have to change my code before putting more load on the job worker (not sure what consequences a missing job.done() would have (on the stack for example).

vsivsi commented 8 years ago

You must eventually call either job.done() or job.fail() on every job that is issued to a worker via processJobs() or getWork(). If you don't, the job will become a "zombie" that never completes, or will be automatically failed and retried if you use the appropriate settings for auto-failing jobs when workers crash or lose connectivity.

job.progress() is optional, is meant for logging and UI purposes, and has no effect on the actual completion of jobs.

vsivsi commented 8 years ago

I should also note that calling job.done() automatically sets the progress to 100% if it isn't already, but the opposite isn't true as I said above. So unless you have some UI that shows the progress value, or some other internal mechanism that does something with it, the there is no need to make progress calls at all.

a4xrbj1 commented 8 years ago

Thanks Vaughn, will change my code immediately!

a4xrbj1 commented 8 years ago

Well, the job executes are very complicated and computation intensive function up to a couple hundred times. Keeping track of the progress is crucial I think, at least for now (once I have my own admin console ready it becomes obsolete or will be displayed in the admin console).

On Wed, Dec 9, 2015 at 5:27 PM, Vaughn Iverson notifications@github.com wrote:

I should also note that calling job.done() automatically sets the progress to 100% if it isn't already, but the opposite isn't true as I said above. So unless you have some UI that shows the progress value, or some other internal mechanism that does something with it, the there is no need to make progress calls at all.

— Reply to this email directly or view it on GitHub https://github.com/vsivsi/meteor-job-collection/issues/135#issuecomment-163180178 .