Reputation: 352
I am building a Python application that works with taskqueue in the following flow
taskqueue.add()
taskqueue.lease_tasks()
taskqueue.modify_task_lease()
The problem is, those 3 steps happen in different web sessions. At step 3, the modify_task_lease()
function need a task instance as argument, while I only have task_name in hand, which is passed from step 2 with web hooks.
So is there any way to retrieve a task with its name?
In the document, I found delete_tasks_by_name()
, but there is no modify_task_lease_by_name()
, which is exactly what I wanted to do.
Upvotes: 1
Views: 120
Reputation: 39824
The delete_tasks_by_name()
is just a wrapper around delete_tasks_by_name_async()
, which is implemented as
if isinstance(task_name, str):
return self.delete_tasks_async(Task(name=task_name), rpc)
else:
tasks = [Task(name=name) for name in task_name]
return self.delete_tasks_async(tasks, rpc)
So I guess you could similarly use the Task()
constructor to obtain the task instance needed by modify_task_lease()
:
modify_task_lease(Task(name=your_task_name), lease_seconds)
Upvotes: 2