This repository was archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
This repository was archived by the owner on Feb 1, 2024. It is now read-only.
Can't assign dispatch deadline #93
Copy link
Copy link
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: cloudtasksIssues related to the googleapis/python-tasks API.Issues related to the googleapis/python-tasks API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
The tasks I create are killed by "(504) DEADLINE_EXCEEDED" if it exceeds 60 seconds. So I try to increase the deadline to the maximum like this:
def send_task(payload, queue, uri, *args):
url = f'https://www.mywebsite.com/{uri}'
payload = json.dumps(payload)
payload = payload.encode()
parent = client.queue_path(project=project, location=location, queue=queue)
service_account_email = 'myaccount.com'
# Construct the request body.
td = timedelta(minutes=30)
duration = duration_pb2.Duration()
time = duration.FromTimedelta(td)
task = {
'http_request': { # Specify the type of request.
'http_method': tasks.HttpMethod.POST,
'url': url,
'body': payload, # Convert dictionary to string
'headers': { # Add custom header
'Content-Type': 'application/json'
},
'oidc_token': {'service_account_email': service_account_email}
}
}
task['dispatch_deadline'] = time
response = client.create_task(request={"parent": parent, "task": task})
I tried to do it with timestamp_pb2
as well, no luck. Is this a bug or am I missing something?
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: cloudtasksIssues related to the googleapis/python-tasks API.Issues related to the googleapis/python-tasks API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.