uranusjr commented on code in PR #24593:
URL: https://github.com/apache/airflow/pull/24593#discussion_r903275203
##########
airflow/providers/airbyte/operators/airbyte.py:
##########
@@ -67,14 +67,20 @@ def __init__(
def execute(self, context: 'Context') -> None:
"""Create Airbyte Job and wait to finish"""
- hook = AirbyteHook(airbyte_conn_id=self.airbyte_conn_id,
api_version=self.api_version)
- job_object =
hook.submit_sync_connection(connection_id=self.connection_id)
- job_id = job_object.json()['job']['id']
+ self.hook = AirbyteHook(airbyte_conn_id=self.airbyte_conn_id,
api_version=self.api_version)
+ job_object =
self.hook.submit_sync_connection(connection_id=self.connection_id)
+ self.job_id = job_object.json()['job']['id']
- self.log.info("Job %s was submitted to Airbyte Server", job_id)
+ self.log.info("Job %s was submitted to Airbyte Server", self.job_id)
if not self.asynchronous:
- self.log.info('Waiting for job %s to complete', job_id)
- hook.wait_for_job(job_id=job_id, wait_seconds=self.wait_seconds,
timeout=self.timeout)
- self.log.info('Job %s completed successfully', job_id)
+ self.log.info('Waiting for job %s to complete', self.job_id)
+ hook.wait_for_job(job_id=self.job_id,
wait_seconds=self.wait_seconds, timeout=self.timeout)
+ self.log.info('Job %s completed successfully', self.job_id)
- return job_id
+ return self.job_id
+
+
+ def on_kill(self):
+ if (self.job_id):
+ self.log.error('on_kill: cancelling airbyte Job %s', self.job_id)
Review Comment:
This should probably be a WARNING or even just INFO instead? Cancelling a
job doesn’t seem like an error to me. We don’t have a consistent rule on how
`on_kill` should log, but most operators I checked log an INFO here, or even
not at all.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]