dstandish commented on a change in pull request #14492: URL: https://github.com/apache/airflow/pull/14492#discussion_r584094840
########## File path: airflow/providers/airbyte/hooks/airbyte.py ########## @@ -0,0 +1,92 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +import time +from typing import Optional + +from airflow.exceptions import AirflowException +from airflow.providers.http.hooks.http import HttpHook + + +class AirbyteJobController: + """Airbyte job status""" + + RUNNING = "running" + SUCCEEDED = "succeeded" + CANCELLED = "canceled" + PENDING = "pending" + FAILED = "failed" + ERROR = "error" + + +class AirbyteHook(HttpHook, AirbyteJobController): + """Hook for Airbyte API""" + + def __init__(self, airbyte_conn_id: str) -> None: + super().__init__(http_conn_id=airbyte_conn_id) + + def wait_for_job(self, job_id: str, wait_time: int = 3, timeout: Optional[int] = None) -> None: Review comment: yeah like an operator that is also a sensor? like it submits the job and immediately starts sensing it? is there an example of this you can point me to @turbaszek? this came to mind here, but you have to store job_id somewhere and i know folks ran into issues before where xcom clears itself when sensor wakes up again thus purging the job id. i'm curious how it has been implemented with google. maybe xcom persistence issue was resolved with introduction of xcom backends? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
