def wait_for_copy(self, timeout=None): """ Wait for a copy 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 product was not created using a copy job, a BadRequestError is raised. If the copy job ran, but failed, a FailedJobError is raised. If a timeout is specified and the timeout is reached, a WaitTimeoutError is raised. Parameters ---------- timeout : int Number of seconds to wait before the wait times out. If not specified, will wait indefinitely. Example ------- >>> from descarteslabs.vectors import FeatureCollection, properties as p >>> aoi_geometry = { ... 'type': 'Polygon', ... 'coordinates': [[[-109, 31], [-102, 31], [-102, 37], [-109, 37], [-109, 31]]]} >>> all_us_cities = FeatureCollection('d1349cc2d8854d998aa6da92dc2bd24') # doctest: +SKIP >>> filtered_cities = all_us_cities.filter(properties=(p.name.like("S%"))) # doctest: +SKIP >>> filtered_cities_fc = filtered_cities.copy(name='filtered-cities', ... title='My Filtered US Cities Vector Collection', ... description='A collection of cities in the US') # doctest: +SKIP >>> filtered_cities_fc.wait_for_copy(timeout=120) # doctest: +SKIP """ job = CopyJob(self.id, self.vector_client) job.wait_for_completion(timeout)
def wait_for_copy(self, timeout=None): """ Wait for a copy 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 product was not created using a copy job, a ``BadRequestError`` is raised. If the copy job ran, but failed, a FailedJobError is raised. If a timeout is specified and the timeout is reached, a ``WaitTimeoutError`` is raised. Parameters ---------- timeout : int Number of seconds to wait before the wait times out. If not specified, will wait indefinitely. Raises ------ ~descarteslabs.vectors.exceptions.FailedJobError Raised when the copy job fails to complete successfully. ~descarteslabs.client.exceptions.NotFoundError Raised if the product or status cannot be found. ~descarteslabs.client.exceptions.RateLimitError Raised when too many requests have been made within a given time period. ~descarteslabs.client.exceptions.ServerError Raised when a unknown error occurred on the server. ~descarteslabs.vectors.exceptions.WaitTimeoutError Raised when the copy job doesn't complete before the timeout is reached. Example ------- >>> from descarteslabs.vectors import FeatureCollection, properties as p >>> aoi_geometry = { ... 'type': 'Polygon', ... 'coordinates': [[[-109, 31], [-102, 31], [-102, 37], [-109, 37], [-109, 31]]]} >>> all_us_cities = FeatureCollection('d1349cc2d8854d998aa6da92dc2bd24') # doctest: +SKIP >>> filtered_cities = all_us_cities.filter(properties=(p.name.like("S%"))) # doctest: +SKIP >>> filtered_cities_fc = filtered_cities.copy(product_id='filtered-cities', ... title='My Filtered US Cities Vector Collection', ... description='A collection of cities in the US') # doctest: +SKIP >>> filtered_cities_fc.wait_for_copy(timeout=120) # doctest: +SKIP """ job = CopyJob(self.id, self.vector_client) job.wait_for_completion(timeout)