You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2023/10/31 02:04:58 UTC
(airflow) branch test-failing-composite-action updated (07c5312b51 -> 2328bcf4e8)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a change to branch test-failing-composite-action
in repository https://gitbox.apache.org/repos/asf/airflow.git
omit 07c5312b51 Produce proper exit status in case image has been built with timeout
new 2328bcf4e8 Produce proper exit status in case image has been built with timeout
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (07c5312b51)
\
N -- N -- N refs/heads/test-failing-composite-action (2328bcf4e8)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
dev/breeze/src/airflow_breeze/utils/parallel.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
(airflow) 01/01: Produce proper exit status in case image has been built with timeout
Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch test-failing-composite-action
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 2328bcf4e82bc4d06765667b4d3ecc5d64f71682
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Oct 30 21:31:12 2023 +0100
Produce proper exit status in case image has been built with timeout
When we build the image with timeout, we fork the process and set alarm
and create a new process group in order to be sure that all the parallel
build processes can be killed easily with sending termination signal to
process group on timeout. In order to wait for the forked process
to complete we used waitpid, but we did not handle the status code
properly, so if the build failed, we returned with 0 exit code.
This had the side effect that "Build CI image" did not fail, instead
the next step (generating source providers failed instead and it was
not obvious that the CI image build failing was the root cause.
This PR properly retrieves the wait status and converts it to
exit code - since we are still supporting Python 3.8 this is still
done using a bit nasty set of if statements - only in Python 3.9 we
have `os.waitstatus_to_exitcode` method to do it for us, but we cannot
use the method yet.
---
.../airflow_breeze/commands/ci_image_commands.py | 23 ++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
index f5ab0b2d0f..cd7c915d8b 100644
--- a/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/ci_image_commands.py
@@ -206,6 +206,20 @@ def kill_process_group(build_process_group_id: int):
pass
+def get_exitcode(status: int) -> int:
+ # In Python 3.9+ we will be able to use
+ # os.waitstatus_to_exitcode(status) - see https://github.com/python/cpython/issues/84275
+ # but until then we need to do this ugly conversion
+ if os.WIFSIGNALED(status):
+ return -os.WTERMSIG(status)
+ elif os.WIFEXITED(status):
+ return os.WEXITSTATUS(status)
+ elif os.WIFSTOPPED(status):
+ return -os.WSTOPSIG(status)
+ else:
+ return 1
+
+
@ci_image.command(name="build")
@option_python
@option_run_in_parallel
@@ -277,8 +291,13 @@ def build(
atexit.register(kill_process_group, pid)
signal.signal(signal.SIGALRM, handler)
signal.alarm(build_timeout_minutes * 60)
- os.waitpid(pid, 0)
- return
+ child_pid, status = os.waitpid(pid, 0)
+ exit_code = get_exitcode(status)
+ if exit_code:
+ get_console().print(f"[error]Exiting with exit code {exit_code}")
+ else:
+ get_console().print(f"[success]Exiting with exit code {exit_code}")
+ sys.exit(exit_code)
else:
# turn us into a process group leader
os.setpgid(0, 0)