Re: [PR] remove volumes when performing `breeze cleanup` [airflow]
potiuk merged PR #45967: URL: https://github.com/apache/airflow/pull/45967 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] remove volumes when performing `breeze cleanup` [airflow]
potiuk commented on code in PR #45967: URL: https://github.com/apache/airflow/pull/45967#discussion_r1929868671 ## dev/breeze/src/airflow_breeze/utils/docker_command_utils.py: ## @@ -592,15 +592,16 @@ def fix_ownership_using_docker(quiet: bool = False): def remove_docker_networks(networks: list[str] | None = None) -> None: """ -Removes specified docker networks. If no networks are specified, it removes all unused networks. +Removes specified docker networks. If no networks are specified, it removes all networks created by breeze. +Any network with label "com.docker.compose.project=breeze" are removed when no networks are specified. Errors are ignored (not even printed in the output), so you can safely call it without checking if the networks exist. :param networks: list of networks to remove """ if networks is None: run_command( -["docker", "network", "prune", "-f"], +["docker", "network", "prune", "-f", "-a", "--filter", "label=com.docker.compose.project=breeze"], Review Comment: Nice! -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] remove volumes when performing `breeze cleanup` [airflow]
rawwar commented on code in PR #45967: URL: https://github.com/apache/airflow/pull/45967#discussion_r1929723539 ## dev/breeze/src/airflow_breeze/utils/docker_command_utils.py: ## @@ -592,15 +592,16 @@ def fix_ownership_using_docker(quiet: bool = False): def remove_docker_networks(networks: list[str] | None = None) -> None: """ -Removes specified docker networks. If no networks are specified, it removes all unused networks. +Removes specified docker networks. If no networks are specified, it removes all networks created by breeze. +Any network with label "com.docker.compose.project=breeze" are removed when no networks are specified. Errors are ignored (not even printed in the output), so you can safely call it without checking if the networks exist. :param networks: list of networks to remove """ if networks is None: run_command( -["docker", "network", "prune", "-f"], +["docker", "network", "prune", "-f", "-a", "--filter", "label=com.docker.compose.project=breeze"], Review Comment: @potiuk , I changed this after you approved the PR. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] remove volumes when performing `breeze cleanup` [airflow]
potiuk commented on code in PR #45967: URL: https://github.com/apache/airflow/pull/45967#discussion_r1929614382 ## dev/breeze/src/airflow_breeze/utils/docker_command_utils.py: ## @@ -613,6 +613,29 @@ def remove_docker_networks(networks: list[str] | None = None) -> None: ) +def remove_docker_volumes(volumes: list[str] | None = None) -> None: +""" +Removes specified docker volumes. If no volumes are specified, it removes all unused volumes. +Errors are ignored (not even printed in the output), so you can safely call it without checking +if the volumes exist. + +:param volumes: list of volumes to remove +""" +if volumes is None: +run_command( +["docker", "volume", "prune", "-f", "-a", "--filter", "label=com.docker.compose.project=breeze"], Review Comment: Yep. Why not. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
