build_worker

safir.arq.uws.build_worker(worker, config, logger)

Construct an arq worker for the provided backend function.

Builds an arq worker configuration that wraps the provided sync function and executes it on messages to the default arq queue. Messages to the UWS queue will be sent on job start and after job completion so that the UWS database can be updated.

Unfortunately, the built-in arq on_job_start and after_job_end hooks can’t be used because they don’t receive any arguments to the job and we need to tell the UWS handlers the job ID to act on. This means that we’ll send the UWS queue message before the results are recorded in Redis, so the UWS handler has to deal with that.

Parameters:
Return type:

WorkerSettings