def google.appengine.api.taskqueue.taskqueue.Queue.__init__ |
( |
|
self, |
|
|
|
name = _DEFAULT_QUEUE |
|
) |
| |
Initializer.
Args:
name: Name of this queue. If not supplied, defaults to the default queue.
Raises:
InvalidQueueNameError if the queue name is invalid.
def google.appengine.api.taskqueue.taskqueue.Queue.add |
( |
|
self, |
|
|
|
task, |
|
|
|
transactional = False |
|
) |
| |
Adds a Task or list of Tasks into this Queue.
If a list of more than one Tasks is given, a raised exception does not
guarantee that no tasks were added to the queue (unless transactional is set
to True). To determine which tasks were successfully added when an exception
is raised, check the Task.was_enqueued property.
Push tasks, i.e. those with method not equal to PULL, may not be added to
queues in pull mode. Similarly, pull tasks may not be added to queues in
push mode.
If a TaskAlreadyExistsError or TombstonedTaskError is raised, the caller can
be guaranteed that for each one of the provided tasks, either the
corresponding task was successfully added, or a task with the given name was
successfully added in the past.
Args:
task: A Task instance or a list of Task instances that will be added to
the queue.
transactional: If True, adds the task(s) if and only if the enclosing
transaction is successfully committed. It is an error for transactional
to be True in the absence of an enclosing transaction. If False, adds
the task(s) immediately, ignoring any enclosing transaction's success or
failure.
Returns:
The Task or list of tasks that was supplied to this method.
Raises:
BadTaskStateError: if the Task(s) has already been added to a queue.
BadTransactionStateError: if the transactional argument is true but this
call is being made outside of the context of a transaction.
DuplicateTaskNameError: if a Task name is repeated in the request.
InvalidTaskNameError: if a Task name is provided but is not legal.
InvalidTaskError: if both push and pull tasks exist in the task list.
InvalidQueueModeError: if a task with method PULL is added to a queue in
push mode, or a task with method not equal to PULL is added to a queue
in pull mode.
TaskAlreadyExistsError: if a task with the same name as a given name has
previously been added to the queue.
TombstonedTaskError: if a task with the same name as a given name has
previously been added to the queue and deleted.
TooManyTasksError: if task contains more than MAX_TASKS_PER_ADD tasks.
TransactionalRequestTooLargeError: if transactional is True and the total
size of the tasks and supporting request data exceeds
MAX_TRANSACTIONAL_REQUEST_SIZE_BYTES.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.add_async |
( |
|
self, |
|
|
|
task, |
|
|
|
transactional = False , |
|
|
|
rpc = None |
|
) |
| |
Asynchronously adds a Task or list of Tasks into this Queue.
This function is identical to add() except that it returns an asynchronous
object. You can call get_result() on the return value to block on the call.
Args:
task: A Task instance or a list of Task instances that will be added to
the queue.
transactional: If True, adds the task(s) if and only if the enclosing
transaction is successfully committed. It is an error for transactional
to be True in the absence of an enclosing transaction. If False, adds
the task(s) immediately, ignoring any enclosing transaction's success or
failure.
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain the Task
or list of tasks that was supplied to this method.
Raises:
BadTaskStateError: if the Task(s) has already been added to a queue.
BadTransactionStateError: if the transactional argument is true but this
call is being made outside of the context of a transaction.
DuplicateTaskNameError: if a Task name is repeated in the request.
InvalidTaskError: if both push and pull tasks exist in the task list.
InvalidTaskNameError: if a Task name is provided but is not legal.
TooManyTasksError: if task contains more than MAX_TASKS_PER_ADD tasks.
TransactionalRequestTooLargeError: if transactional is True and the total
size of the tasks and supporting request data exceeds
MAX_TRANSACTIONAL_REQUEST_SIZE_BYTES.
def google.appengine.api.taskqueue.taskqueue.Queue.delete_tasks |
( |
|
self, |
|
|
|
task |
|
) |
| |
Deletes a Task or list of Tasks in this Queue.
When multiple tasks are specified, an exception will be raised if any
individual task fails to be deleted. Check the task.was_deleted property.
Task name is the only task attribute used to select tasks for deletion. If
there is any task with was_deleted property set to True, or without a task
name, a BadTaskStateError will be raised immediately.
Args:
task: A Task instance or a list of Task instances that will be deleted
from the Queue.
Returns:
The Task or list of tasks passed into this call.
Raises:
BadTaskStateError: if the Task(s) to be deleted do not have task names or
have already been deleted.
DuplicateTaskNameError: if a Task is repeated in the request.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.delete_tasks_async |
( |
|
self, |
|
|
|
task, |
|
|
|
rpc = None |
|
) |
| |
Asynchronously deletes a Task or list of Tasks in this Queue.
This function is identical to delete_tasks() except that it returns an
asynchronous object. You can call get_result() on the return value to block
on the call.
Args:
task: A Task instance or a list of Task instances that will be deleted
from the Queue.
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain the Task
or list of tasks passed into this call.
Raises:
BadTaskStateError: if the Task(s) to be deleted do not have task names or
have already been deleted.
DuplicateTaskNameError: if a Task is repeated in the request.
def google.appengine.api.taskqueue.taskqueue.Queue.delete_tasks_by_name |
( |
|
self, |
|
|
|
task_name |
|
) |
| |
Deletes a Task or list of Tasks in this Queue, by name.
When multiple tasks are specified, an exception will be raised if any
individual task fails to be deleted.
Args:
task_name: A string corresponding to a task name, or an iterable of
strings corresponding to task names.
Returns:
If an iterable (other than string) is provided as input, a list of of
Task objects, one for each task name in the order requested. The
Task.was_deleted property will be True for each task deleted by this call,
and will be False for unknown and tombstoned tasks.
Otherwise, if a single string was provided as input, a single Task object.
Raises:
DuplicateTaskNameError: if a Task name is repeated in the request.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.delete_tasks_by_name_async |
( |
|
self, |
|
|
|
task_name, |
|
|
|
rpc = None |
|
) |
| |
Asynchronously deletes a Task or list of Tasks in this Queue, by name.
This function is identical to delete_tasks_by_name() except that it returns
an asynchronous object. You can call get_result() on the return value to
block on the call.
Args:
task_name: A string corresponding to a task name, or an iterable of
strings corresponding to task names.
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain the
result.
If an iterable (other than string) is provided as input, the result will
be a list of of Task objects, one for each task name in the order
requested. The Task.was_deleted property will be True for each task
deleted by this call, and will be False for unknown and tombstoned tasks.
Otherwise, if a single string was provided as input, then the result will
be a single Task object.
Raises:
DuplicateTaskNameError: if a Task name is repeated in the request.
def google.appengine.api.taskqueue.taskqueue.Queue.fetch_statistics |
( |
|
self, |
|
|
|
deadline = 10 |
|
) |
| |
Get the current details about this queue.
Args:
deadline: The maximum number of seconds to wait before aborting the
method call.
Returns:
A QueueStatistics instance containing information about this queue.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.fetch_statistics_async |
( |
|
self, |
|
|
|
rpc = None |
|
) |
| |
Asynchronously get the current details about this queue.
Args:
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain a
QueueStatistics instance containing information about this queue.
def google.appengine.api.taskqueue.taskqueue.Queue.lease_tasks |
( |
|
self, |
|
|
|
lease_seconds, |
|
|
|
max_tasks, |
|
|
|
deadline = 10 |
|
) |
| |
Leases a number of tasks from the Queue for a period of time.
This method can only be performed on a pull Queue. Any non-pull tasks in
the pull Queue will be converted into pull tasks when being leased. If
fewer than max_tasks are available, all available tasks will be returned.
The lease_tasks method supports leasing at most 1000 tasks for no longer
than a week in a single call.
Args:
lease_seconds: Number of seconds to lease the tasks.
max_tasks: Max number of tasks to lease from the pull Queue.
deadline: The maximum number of seconds to wait before aborting the
method call.
Returns:
A list of tasks leased from the Queue.
Raises:
InvalidLeaseTimeError: if lease_seconds is not a valid float or integer
number or is outside the valid range.
InvalidMaxTasksError: if max_tasks is not a valid integer or is outside
the valid range.
InvalidQueueModeError: if invoked on a queue that is not in pull mode.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.lease_tasks_async |
( |
|
self, |
|
|
|
lease_seconds, |
|
|
|
max_tasks, |
|
|
|
rpc = None |
|
) |
| |
Asynchronously leases a number of tasks from the Queue.
This function is identical to lease_tasks() except that it returns an
asynchronous object. You can call get_result() on the return value to block
on the call.
Args:
lease_seconds: Number of seconds to lease the tasks.
max_tasks: Max number of tasks to lease from the pull Queue.
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain the list
of tasks leased from the Queue.
Raises:
InvalidLeaseTimeError: if lease_seconds is not a valid float or integer
number or is outside the valid range.
InvalidMaxTasksError: if max_tasks is not a valid integer or is outside
the valid range.
def google.appengine.api.taskqueue.taskqueue.Queue.lease_tasks_by_tag |
( |
|
self, |
|
|
|
lease_seconds, |
|
|
|
max_tasks, |
|
|
|
tag = None , |
|
|
|
deadline = 10 |
|
) |
| |
Leases a number of tasks from the Queue for a period of time.
This method can only be performed on a pull Queue. Any non-pull tasks in
the pull Queue will be converted into pull tasks when being leased. If
fewer than max_tasks are available, all available tasks will be returned.
The lease_tasks method supports leasing at most 1000 tasks for no longer
than a week in a single call.
Args:
lease_seconds: Number of seconds to lease the tasks.
max_tasks: Max number of tasks to lease from the pull Queue.
tag: The to query for, or None to group by the first available tag.
deadline: The maximum number of seconds to wait before aborting the
method call.
Returns:
A list of tasks leased from the Queue.
Raises:
InvalidLeaseTimeError: if lease_seconds is not a valid float or integer
number or is outside the valid range.
InvalidMaxTasksError: if max_tasks is not a valid integer or is outside
the valid range.
InvalidQueueModeError: if invoked on a queue that is not in pull mode.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.lease_tasks_by_tag_async |
( |
|
self, |
|
|
|
lease_seconds, |
|
|
|
max_tasks, |
|
|
|
tag = None , |
|
|
|
rpc = None |
|
) |
| |
Asynchronously leases a number of tasks from the Queue.
This function is identical to lease_tasks_by_tag() except that it returns an
asynchronous object. You can call get_result() on the return value to block
on the call.
Args:
lease_seconds: Number of seconds to lease the tasks.
max_tasks: Max number of tasks to lease from the pull Queue.
tag: The to query for, or None to group by the first available tag.
rpc: An optional UserRPC object.
Returns:
A UserRPC object, call get_result to complete the RPC and obtain the list
of tasks leased from the Queue.
Raises:
InvalidLeaseTimeError: if lease_seconds is not a valid float or integer
number or is outside the valid range.
InvalidMaxTasksError: if max_tasks is not a valid integer or is outside
the valid range.
def google.appengine.api.taskqueue.taskqueue.Queue.modify_task_lease |
( |
|
self, |
|
|
|
task, |
|
|
|
lease_seconds |
|
) |
| |
Modifies the lease of a task in this queue.
Args:
task: A task instance that will have its lease modified.
lease_seconds: Number of seconds, from the current time, that the task
lease will be modified to. If lease_seconds is 0, then the task lease
is removed and the task will be available for leasing again using
the lease_tasks method.
Raises:
TypeError: if lease_seconds is not a valid float or integer.
InvalidLeaseTimeError: if lease_seconds is outside the valid range.
Error-subclass on application errors.
def google.appengine.api.taskqueue.taskqueue.Queue.name |
( |
|
self | ) |
|
Returns the name of this queue.
def google.appengine.api.taskqueue.taskqueue.Queue.purge |
( |
|
self | ) |
|
Removes all the tasks in this Queue.
This function takes constant time to purge a Queue and some delay may apply
before the call is effective.
Raises:
Error-subclass on application errors.
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/api/taskqueue/taskqueue.py