-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Breeze adding exec command #23052
Breeze adding exec command #23052
Conversation
@potiuk Could you explain to me what will happen in this command? I tried executing
But when executed via the Lines 3512 to 3513 in 3a2eb96
Do I have to execute the |
The error states that it cannot find any configuration file. Check that you are running it in the right location where it can discover the config. |
thanks @joppevos yes |
params = BuildCiParams() | ||
ci_image_name = params.airflow_image_name | ||
check_docker_resources(verbose, ci_image_name) | ||
cmd = [str(dc_run_file), 'ps'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should really run docker-compose ps
here. The bash attempted to use the generated dc_run file which is not needed any more,
But what we need we need exactly the same parameters that are used by ShellParams in shell commmand. Otherwise docker-compose
does not know which file and which configuration should be used.
When we run docker-compose in Shell command we add 👍
- COMPOSE_FILE variable
- Some environment variables for PORTs etc.
only when we use the same parameters and COMPOSE_FILE that we used for "breeze shell" we will be able to find running processes with "docker-compose ps" command.
So in short:
- don't use dc_run (it's the way docker compose command was run in Breeze)
- run docker-compose same way as in "shell" command (with the same env variables etc).
- and be a bit smarter when finding containers. I have not used the right filterring when I run the command , but it can be done a bit "smarter" with
--filter
command to only filter runningairflow
container. - in order to test all the filtering, it might actually be nice to implement
docker-compose
command from the old Breeze. This command started docker-compose (same way as Shell command) and passed all the extra arguments passed directly to docker-compose command - this might be nice way to test various filtering strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@potiuk Could you tell me how i can filter running airflow
container? I can filter the running container, but specifically to get only the airflow
container which property of the running container i could rely upon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure entirely ;) . Docker and Docker compose filters are pretty weakly documented. But filter "give me container of the aiflow
service" is what we are looking for. In the base.yml
we have:
version: "3.7"
services:
airflow:
image: ${AIRFLOW_CI_IMAGE_WITH_TAG}
So our container for airflow will always run as "airflow" service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see :) I will check this. I will also take this as an opportunity to contribute to docs in Docker-compose. Thanks @potiuk
That's becode dc_run_file from the old breeze already contains COMPOSE_FILE and all the environment variables that docker-compose needs to find out the definition of Breeze containers (see the other comment). This is precisely what we do in Shell command when we launch "docker-compose" - se we should use the same mechanism as in "shell" to get the variables and run docker-compose with all of them set. |
f037eea
to
9655a26
Compare
@potiuk Do I need to make any modifications in this PR wrt your current changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small corrections
Not really - I think the only change that I applied that woudl affect this one is a little bit "nicer" handling of run_command results: when check = False but we actually care about the success/failure (for example when I run parallel runs). I think in this case just printing output is fine (I commented it) as exec is really 'interactive only' but it would be nice to catch the process return code and sys.exit() with it: smth like:
|
I will fix the changes that you have suggested @potiuk |
Yep. Looks much better with the filter :) |
817e13f
to
70c4018
Compare
@potiuk Do i need to make bring any more changes to this command? Can you give your suggestion? |
I think the "exec" command has been "lost" during rebase :) - I removed all commands from the You need to re-add it :). I copied some changes from the previous version below:
|
It should be added in https://github.com/apache/airflow/blob/main/dev/breeze/src/airflow_breeze/commands/developer_commands.py - that's where all regular "development" commands were moved. |
The breeze.py looks like this now :).
|
@potiuk After rebasing the code, the code doesn't work properly. Could you help me to find the issue? |
I just tested it an well - it works well for me :) |
Just one static check error :) |
I thin you will need to rebase after I merged #23311 |
5c4110f
to
1125359
Compare
The PR is likely ready to be merged. No tests are needed as no important environment files, nor python files were modified by it. However, committers might decide that full test matrix is needed and add the 'full tests needed' label. Then you should rebase it to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
(cherry picked from commit 94c3203)
(cherry picked from commit 94c3203)
closes: #21104
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.