You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "karunpoudel (via GitHub)" <gi...@apache.org> on 2023/06/06 21:37:19 UTC
[GitHub] [airflow] karunpoudel opened a new pull request, #31747: PythonVirtualenvOperator: termination error log in alert
karunpoudel opened a new pull request, #31747:
URL: https://github.com/apache/airflow/pull/31747
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
The error alert email from PythonVirtualenvOperator and ExternalPythonOperator only contain exit status code. It doesn't contain error messages similar to PythonOperator. This change add the error messages on these operators too.
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] karunpoudel commented on a diff in pull request #31747: PythonVirtualenvOperator: termination error message in alert
Posted by "karunpoudel (via GitHub)" <gi...@apache.org>.
karunpoudel commented on code in PR #31747:
URL: https://github.com/apache/airflow/pull/31747#discussion_r1220588789
##########
airflow/operators/python.py:
##########
@@ -423,11 +424,17 @@ def _execute_python_callable_in_subprocess(self, python_path: Path, tmp_dir: Pat
os.fspath(input_path),
os.fspath(output_path),
os.fspath(string_args_path),
+ os.fspath(termination_log_path),
]
)
except subprocess.CalledProcessError as e:
if e.returncode in self.skip_on_exit_code:
raise AirflowSkipException(f"Process exited with code {e.returncode}. Skipping.")
+ elif termination_log_path.exists() and termination_log_path.stat().st_size > 0:
+ error_msg = f"Process returned non-zero exit status {e.returncode}.\n"
+ with open(termination_log_path) as file:
+ error_msg += file.read()
+ raise AirflowException(error_msg) from None
Review Comment:
Is there better exception than `AirflowException` that we can raise here?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on a diff in pull request #31747: PythonVirtualenvOperator: termination error message in alert
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31747:
URL: https://github.com/apache/airflow/pull/31747#discussion_r1221945353
##########
airflow/operators/python.py:
##########
@@ -423,11 +424,17 @@ def _execute_python_callable_in_subprocess(self, python_path: Path, tmp_dir: Pat
os.fspath(input_path),
os.fspath(output_path),
os.fspath(string_args_path),
+ os.fspath(termination_log_path),
]
)
except subprocess.CalledProcessError as e:
if e.returncode in self.skip_on_exit_code:
raise AirflowSkipException(f"Process exited with code {e.returncode}. Skipping.")
+ elif termination_log_path.exists() and termination_log_path.stat().st_size > 0:
+ error_msg = f"Process returned non-zero exit status {e.returncode}.\n"
+ with open(termination_log_path) as file:
+ error_msg += file.read()
+ raise AirflowException(error_msg) from None
Review Comment:
Nope. AE is good. Can you please rebase as we fixed the failing tests caused by new versions of Python : https://github.com/apache/airflow/pull/31766
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk merged pull request #31747: PythonVirtualenvOperator: termination error message in alert
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #31747:
URL: https://github.com/apache/airflow/pull/31747
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org