In Gearman, the send_fail () function does not accept any parameters, just tell the job server that this job was not completed on this worker, so the server can try again or something else.
If you are executing your procedure synchronously, the best way would be to execute "retry or not" on the client side.
If you are executing your asynchronous procedure, I think you can use the sendException function. (in the installed gearman module for python on my computer, this is send_job_exception ().) This function can take exception data arguments for your client information.
And finally, you can just just make it so simple: (but your intermediary client will receive A GEARMAN_SUCCESS "RETURNS CODE!)
#some codes while retries > 0: with settings(warn_only=True): result = run(cmd) output = output + str(result) if result.failed: if retries == 1: #job.send_fail() output = "FAILED_JOB" + "some_return_str" break else: next else: break retries = retries - 1 return output
this link will also help you.
source share