def claim_work(context):
"""Find and claim the next pending task in the queue, if any.
Args:
context (scriptworker.context.Context): the scriptworker context.
Returns:
dict: a dict containing a list of the task definitions of the tasks claimed.
"""
log.debug("Calling claimWork...")
payload = {
'workerGroup': context.config['worker_group'],
'workerId': context.config['worker_id'],
# Hardcode one task at a time. Make this a pref if we allow for
# parallel tasks in multiple `work_dir`s.
'tasks': 1,
}
try:
return await context.queue.claimWork(
context.config['provisioner_id'],
context.config['worker_type'],
payload
)
except (taskcluster.exceptions.TaskclusterFailure, aiohttp.ClientError) as exc:
log.warning("{} {}".format(exc.__class__, exc))
评论列表
文章目录