Skip to content

Commit 17adcea

Browse files
authored
Fix handling of subprocess error handling in s3_file_transform and gcs (#9106)
As outlined in Issue 9104 the python subprocess return code can be less than 0. The previous version only captures errors of the subprocess itself, not the negative error codes, as cause by host SIGKILL, SIGHUP, ... see https://docs.python.org/3/library/subprocess.html#subprocess. CompletedProcess.returncode We now treat all non-zero returncodes as a script failure.
1 parent 9e0ccde commit 17adcea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

airflow/providers/amazon/aws/operators/s3_file_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def execute(self, context):
154154

155155
process.wait()
156156

157-
if process.returncode > 0:
157+
if process.returncode:
158158
raise AirflowException(
159159
"Transform script failed: {0}".format(process.returncode)
160160
)

airflow/providers/google/cloud/operators/gcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def execute(self, context: Dict):
609609
self.log.info(line.decode(self.output_encoding).rstrip())
610610

611611
process.wait()
612-
if process.returncode > 0:
612+
if process.returncode:
613613
raise AirflowException(
614614
"Transform script failed: {0}".format(process.returncode)
615615
)

0 commit comments

Comments
 (0)