-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Export Azure Container Instance log messages to XCOM #41142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export Azure Container Instance log messages to XCOM #41142
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
airflow/providers/microsoft/azure/operators/container_instances.py
Outdated
Show resolved
Hide resolved
|
static checks failing |
|
Thanks. I’ll look.
|
The bash and docker operators, among others, can export logs into XCOM to provide some feedback about the outcome of the command in the results. The AzureContainerInstancesOperator just detects if the container exits cleanly. This commit adds the ability to put either the last log message or all log messages into XCOM under the key 'logs' so it can be used in future operators to decide if it failed or succeded.
|
I believe I have fixed the issues from my code (currently re-running breeze static-checks), but when I run "breeze static-checks --all-files" it complains about a file I didn't change: Should I ignore this? |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
It was likely due to not rebased/rebuilt image with latest changes. Main succeeded, so all looks good. |
|
Thank you, @potiuk! |
|
I get the static-checks issue with a fresh checkout of main from the official repo. Is this likely to be a problem on my breeze install? An issue with the breeze config checked into the project? or an actual issue on main? I'm assuming it is one of the first two.
|
|
no idea. Generally the system is designed to be consistent when you a) rebase, b) build the image when asked . This is what CI check does a) checks out the latest version b) builds the latest image c) uses the latest image to run the tests. If any of the steps are missing or delayed, the end results might differ. So if you are in doubt - ABR - Always Be Rebased.
That should yield same results as CI build - but of course there are race conditions - someone could have pushed another change between the steps manually run. So again - if in doubt
Airflow has high traffic, things are chaning on hourly base ... so rebase, rebuild test is a recommended way. |
* Add ability to export log messages into XCOM The bash and docker operators, among others, can export logs into XCOM to provide some feedback about the outcome of the command in the results. The AzureContainerInstancesOperator just detects if the container exits cleanly. This commit adds the ability to put either the last log message or all log messages into XCOM under the key 'logs' so it can be used in future operators to decide if it failed or succeded. * Fix issues found by static checks * Update format to satisfy ruff-format
* Add ability to export log messages into XCOM The bash and docker operators, among others, can export logs into XCOM to provide some feedback about the outcome of the command in the results. The AzureContainerInstancesOperator just detects if the container exits cleanly. This commit adds the ability to put either the last log message or all log messages into XCOM under the key 'logs' so it can be used in future operators to decide if it failed or succeded. * Fix issues found by static checks * Update format to satisfy ruff-format
|
@perry2of5 & @potiuk would it be possible to additionally enhace the AzureContainerInstancesOperator with the :param do_xcom_push: If True, the content of the file /airflow/xcom/return.json in the container will also be pushed to an XCom when the container completes, which would be similar behavior to the KubernetesPODOperator ? |
|
That seems possible. I'm not sure if it is an optimal idea. Perhaps it would be better to push the file into some sort of store and return the location in a message and retrieve it that way? If you open an issue then you could get feedback on the idea. I doubt you'll get many people considering the idea in a closed PR. If you open an issue, feel free to tag me and I'll think about it more.
Message ID: ***@***.***>
|
This commit adds the capability to export log messages into XCOM on an optional basis. The existing behavior (no logs) is retained as the default making this an opt-in feature. Users of the operator can retrieve either all logs or only the last log message. In either case, the log messsages are presented as a list
The bash and docker operators, among others, can export logs into XCOM to provide some feedback about the outcome of the command in the results. The AzureContainerInstancesOperator just detects if the container exits cleanly and exits with either 0 (success) or 1 (failure). This commit adds the ability to put either the last log message or all log messages into XCOM under the key 'logs' so it can be used in future operators to decide if it the operation within the container failed or succeeded.