AsyncJob¶
Classes:
AsyncJob (id[, vector_client]) |
Base class that provides helpers to access information about asynchronous jobs produced when interacting with a FeatureCollection . |
CopyJob (id[, vector_client]) |
Job for copying Features from one FeatureCollection to a new FeatureCollection . |
DeleteJob (id[, vector_client]) |
Job for deleting Features from a FeatureCollection |
-
class
AsyncJob
(id, vector_client=None)[source]¶ Base class that provides helpers to access information about asynchronous jobs produced when interacting with a
FeatureCollection
.Attributes:
created
UTC time that the job was created in ISO 8601 format. ended
UTC time that the job stopped running in ISO 8601 format. errors
Rrrors encountered when running the job, if there were any. started
UTC time that the job started running in ISO 8601 format. state
The state of the job, possible values are PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Methods:
refresh
()Refresh the job information. wait_for_completion
([timeout])Wait for a job operation to complete. -
wait_for_completion
(timeout=None)[source]¶ Wait for a job operation to complete. Copies occur asynchronously and can take a long time to complete. Features will not be accessible in the FeatureCollection until the copy completes.
If the job ran, but failed, a FailedJobError is raised. If a timeout is specified and the timeout is reached, a WaitTimeoutError is raised. A BadRequestError is raised if the job could not begin execution.
Parameters: timeout (int) – Number of seconds to wait before the wait times out. If not specified, will wait indefinitely.
Raises: - FailedJobError – Raised when the copy job fails to complete successfully.
- NotFoundError – Raised if the product or status cannot be found.
- RateLimitError – Raised when too many requests have been made within a given time period.
- ServerError – Raised when a unknown error occurred on the server.
- WaitTimeoutError – Raised when the timeout is exceeded before the job completes.
Example
>>> from descarteslabs.vectors import FeatureCollection >>> aoi_geometry = { ... 'type': 'Polygon', ... 'coordinates': [[[-109, 31], [-102, 31], [-102, 37], [-109, 37], [-109, 31]]]} >>> fc = FeatureCollection('d1349cc2d8854d998aa6da92dc2bd24') >>> fc.filter(geometry=aoi_geometry) >>> delete_job = fc.delete_features() >>> delete_job.wait_for_completion()
-
property
created
¶ UTC time that the job was created in ISO 8601 format.
Type: str
-
property
ended
¶ UTC time that the job stopped running in ISO 8601 format.
Type: str
-
property
errors
¶ Rrrors encountered when running the job, if there were any.
Type: list(str)
-
property
started
¶ UTC time that the job started running in ISO 8601 format.
Type: str
-
property
state
¶ The state of the job, possible values are
PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Type: str
-
-
class
CopyJob
(id, vector_client=None)[source]¶ Job for copying
Features
from oneFeatureCollection
to a newFeatureCollection
.-
id
¶ The unique identifier for the FeatureCollection the job is creating.
Type: str
-
state
¶ The state of the job, possible values are``PENDING``,
RUNNING
,DONE
,SUCCESS
andFAILED
.Type: str
-
created
¶ UTC time that the job was created.
Type: datetime
-
started
¶ UTC time that the job started running.
Type: datetime
-
ended
¶ UTC time that the job stopped running.
Type: datetime
-
errors
¶ List of errors encountered when running the job, if there were any.
Type: list(str)
Example
>>> from descarteslabs.vectors.async_job import CopyJob >>> job = CopyJob('d1349cc2d8854d998aa6da92dc2bd24')
Attributes:
created
UTC time that the job was created in ISO 8601 format. ended
UTC time that the job stopped running in ISO 8601 format. errors
Rrrors encountered when running the job, if there were any. started
UTC time that the job started running in ISO 8601 format. state
The state of the job, possible values are PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Methods:
refresh
()Refresh the job information. wait_for_completion
([timeout])Wait for a job operation to complete. -
refresh
()[source]¶ Refresh the job information.
Raises: - NotFoundError – Raised if the product or status cannot be found.
- RateLimitError – Raised when too many requests have been made within a given time period.
- ServerError – Raised when a unknown error occurred on the server.
-
wait_for_completion
(timeout=None)¶ Wait for a job operation to complete. Copies occur asynchronously and can take a long time to complete. Features will not be accessible in the FeatureCollection until the copy completes.
If the job ran, but failed, a FailedJobError is raised. If a timeout is specified and the timeout is reached, a WaitTimeoutError is raised. A BadRequestError is raised if the job could not begin execution.
Parameters: timeout (int) – Number of seconds to wait before the wait times out. If not specified, will wait indefinitely.
Raises: - FailedJobError – Raised when the copy job fails to complete successfully.
- NotFoundError – Raised if the product or status cannot be found.
- RateLimitError – Raised when too many requests have been made within a given time period.
- ServerError – Raised when a unknown error occurred on the server.
- WaitTimeoutError – Raised when the timeout is exceeded before the job completes.
Example
>>> from descarteslabs.vectors import FeatureCollection >>> aoi_geometry = { ... 'type': 'Polygon', ... 'coordinates': [[[-109, 31], [-102, 31], [-102, 37], [-109, 37], [-109, 31]]]} >>> fc = FeatureCollection('d1349cc2d8854d998aa6da92dc2bd24') >>> fc.filter(geometry=aoi_geometry) >>> delete_job = fc.delete_features() >>> delete_job.wait_for_completion()
-
property
created
UTC time that the job was created in ISO 8601 format.
Type: str
-
property
ended
UTC time that the job stopped running in ISO 8601 format.
Type: str
-
property
errors
Rrrors encountered when running the job, if there were any.
Type: list(str)
-
property
started
UTC time that the job started running in ISO 8601 format.
Type: str
-
property
state
The state of the job, possible values are
PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Type: str
-
-
class
DeleteJob
(id, vector_client=None)[source]¶ Job for deleting
Features
from aFeatureCollection
-
id
¶ The unique identifier for the FeatureCollection whose
Features
the job id deleting.Type: str
-
state
¶ The state of the job, possible values are
PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Type: str
-
created
¶ UTC time that the job was created.
Type: datetime
-
started
¶ UTC time that the job started running.
Type: datetime
-
ended
¶ UTC time that the job stopped running.
Type: datetime
-
errors
¶ List of errors encountered when running the job, if there were any.
Type: list(str)
Attributes:
created
UTC time that the job was created in ISO 8601 format. ended
UTC time that the job stopped running in ISO 8601 format. errors
Rrrors encountered when running the job, if there were any. started
UTC time that the job started running in ISO 8601 format. state
The state of the job, possible values are PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Methods:
refresh
()Refresh the job information. wait_for_completion
([timeout])Wait for a job operation to complete. -
refresh
()[source]¶ Refresh the job information.
Raises: - NotFoundError – Raised if the product cannot be found.
- RateLimitError – Raised when too many requests have been made within a given time period.
- ServerError – Raised when a unknown error occurred on the server.
-
wait_for_completion
(timeout=None)¶ Wait for a job operation to complete. Copies occur asynchronously and can take a long time to complete. Features will not be accessible in the FeatureCollection until the copy completes.
If the job ran, but failed, a FailedJobError is raised. If a timeout is specified and the timeout is reached, a WaitTimeoutError is raised. A BadRequestError is raised if the job could not begin execution.
Parameters: timeout (int) – Number of seconds to wait before the wait times out. If not specified, will wait indefinitely.
Raises: - FailedJobError – Raised when the copy job fails to complete successfully.
- NotFoundError – Raised if the product or status cannot be found.
- RateLimitError – Raised when too many requests have been made within a given time period.
- ServerError – Raised when a unknown error occurred on the server.
- WaitTimeoutError – Raised when the timeout is exceeded before the job completes.
Example
>>> from descarteslabs.vectors import FeatureCollection >>> aoi_geometry = { ... 'type': 'Polygon', ... 'coordinates': [[[-109, 31], [-102, 31], [-102, 37], [-109, 37], [-109, 31]]]} >>> fc = FeatureCollection('d1349cc2d8854d998aa6da92dc2bd24') >>> fc.filter(geometry=aoi_geometry) >>> delete_job = fc.delete_features() >>> delete_job.wait_for_completion()
-
property
created
UTC time that the job was created in ISO 8601 format.
Type: str
-
property
ended
UTC time that the job stopped running in ISO 8601 format.
Type: str
-
property
errors
Rrrors encountered when running the job, if there were any.
Type: list(str)
-
property
started
UTC time that the job started running in ISO 8601 format.
Type: str
-
property
state
The state of the job, possible values are
PENDING
,RUNNING
,DONE
,SUCCESS
andFAILED
.Type: str
-