MCPcopy Create free account
hub / github.com/feast-dev/feast / wait_for_redshift_statement

Function wait_for_redshift_statement

sdk/python/feast/infra/utils/aws_utils.py:129–146  ·  view source on GitHub ↗

Waits for the Redshift statement to finish. Raises RedshiftQueryError if the statement didn't succeed. We use exponential backoff for checking the query state until it's not running. The backoff starts with 0.1 seconds and doubles exponentially until reaching 30 seconds, at which point the

(redshift_data_client, statement: dict)

Source from the content-addressed store, hash-verified

127 reraise=True,
128)
129def wait_for_redshift_statement(redshift_data_client, statement: dict) -> None:
130 """Waits for the Redshift statement to finish. Raises RedshiftQueryError if the statement didn't succeed.
131
132 We use exponential backoff for checking the query state until it's not running. The backoff starts with
133 0.1 seconds and doubles exponentially until reaching 30 seconds, at which point the backoff is fixed.
134
135 Args:
136 redshift_data_client: Redshift Data API Service client
137 statement: The redshift statement to wait for (result of execute_redshift_statement)
138
139 Returns: None
140
141 """
142 desc = redshift_data_client.describe_statement(Id=statement["Id"])
143 if desc["Status"] in ("SUBMITTED", "STARTED", "PICKED"):
144 raise RedshiftStatementNotFinishedError # Retry
145 if desc["Status"] != "FINISHED":
146 raise RedshiftQueryError(desc) # Don't retry. Raise exception.
147
148
149def execute_redshift_statement(

Callers 1

Calls 1

RedshiftQueryErrorClass · 0.90

Tested by

no test coverage detected