ExportTask

Back to Vectors

class ExportTask(guid, tuid=None, client=None, result_attrs=None, key=None)[source]

An export task. Accessing any attributes before the task is completed (for example status) will block until the task completes.

If you want to check whether the attributes are available, use is_ready which will return True when attributes are available.

Do not create an ExportTask yourself; it is returned by FeatureCollection.export and FeatureCollection.list_exports.

Attributes:

exception Property indicating the name of the exception raised during the function execution, if any
exception_name Property indicating the name of the exception raised during the function execution, if any
failure_type The type of failure if this task did not succeed.
is_success Did this task succeeed?
log Property indicating the log output for this completed task.
peak_memory_usage Property indicating the peak memory usage for this completed task, in bytes.
ready Property indicating whether the task has completed
result Export tasks don’t have a result.
runtime Property indicating the time spent executing the function for this task, in seconds.
stacktrace Property indicating the stacktrace of the exception raised during the function execution, if any.
status const`FAILURE`) for this completed task.
traceback Property indicating the stacktrace of the exception raised during the function execution, if any.

Methods:

get_file(file_obj) Download the exported Storage object to a local file.
get_result([wait, timeout]) Attempt to load the result for this export task.
get_file(file_obj)[source]

Download the exported Storage object to a local file.

Parameters:file_obj (str) – A file-like object or name of file to download into.
Raises:TransientResultError – If the export hasn’t completed yet.
get_result(wait=False, timeout=None)[source]

Attempt to load the result for this export task. After returning from this method without an exception raised, the information for the task is available through the various properties.

Parameters:
  • wait (bool) – Whether to wait for the task to complete or raise a TransientResultError if the task hasn’t completed yet.
  • timeout (int) – How long to wait in seconds for the task to complete, or None to wait indefinitely.
Raises:
  • TransientResultError – When the result is not ready yet (and not waiting).
  • TimeoutError – When the timeout has been reached (if waiting and set).
property exception

Property indicating the name of the exception raised during the function execution, if any

Return type:str
Returns:The name of the exception or None
property exception_name

Property indicating the name of the exception raised during the function execution, if any

Return type:str
Returns:The name of the exception or None
property failure_type

The type of failure if this task did not succeed.

Return type:str
Returns:The failure type
property is_success

Did this task succeeed?

Return type:bool
Returns:Whether this task succeeded.
property log

Property indicating the log output for this completed task.

Return type:str
Returns:The log output
property peak_memory_usage

Property indicating the peak memory usage for this completed task, in bytes.

Return type:int
Returns:The peak memory usage
property ready

Property indicating whether the task has completed

Return type:bool
Returns:True if the upload task has completed and status is available, otherwise False.
property result

Export tasks don’t have a result.

Raises:AttributeError – No result available
property runtime

Property indicating the time spent executing the function for this task, in seconds.

Return type:int
Returns:The time spent executing the function
property stacktrace

Property indicating the stacktrace of the exception raised during the function execution, if any.

Return type:str
Returns:The stacktrace of the exception or None
property status

const`FAILURE`) for this completed task.

Return type:str
Returns:The status for this completed task.
Type:Property indicating the status (SUCCESS or
property traceback

Property indicating the stacktrace of the exception raised during the function execution, if any.

Return type:str
Returns:The stacktrace of the exception or None