lib/pallets/worker.rb in pallets-0.8.0 vs lib/pallets/worker.rb in pallets-0.9.0

- old
+ new

@@ -51,23 +51,23 @@ end @manager.remove_worker(self) rescue Pallets::Shutdown @manager.remove_worker(self) rescue => ex - Pallets.logger.error "#{ex.class.name}: #{ex.message}", wid: id - Pallets.logger.error ex.backtrace.join("\n"), wid: id unless ex.backtrace.nil? + Pallets.logger.error "#{ex.class.name}: #{ex.message}" + Pallets.logger.error ex.backtrace.join("\n") unless ex.backtrace.nil? @manager.replace_worker(self) end def process(job) begin job_hash = serializer.load(job) rescue # We ensure only valid jobs are created. If something fishy reaches this # point, just give up on it - backend.give_up(job, job) - Pallets.logger.error "Could not deserialize #{job}. Gave up job", wid: id + backend.discard(job) + Pallets.logger.error "Could not deserialize #{job}. Gave up job" return end context = Context[ serializer.load_context(backend.get_context(job_hash['wfid'])) @@ -101,19 +101,19 @@ )) if failures < job_hash['max_failures'] retry_at = Time.now.to_f + backoff_in_seconds(failures) backend.retry(new_job, job, retry_at) else - backend.give_up(new_job, job) + backend.give_up(job_hash['wfid'], new_job, job) end end def handle_job_return_false(job, job_hash) new_job = serializer.dump(job_hash.merge( 'given_up_at' => Time.now.to_f, 'reason' => 'returned_false' )) - backend.give_up(new_job, job) + backend.give_up(job_hash['wfid'], new_job, job) end def handle_job_success(context, job, job_hash) backend.save(job_hash['wfid'], job_hash['jid'], job, serializer.dump_context(context.buffer)) end