Skip to content
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

Composer_dags.py script (pause & unpause dags) is taking hours to finish #10805

Open
hejnal opened this issue Oct 25, 2023 · 2 comments
Open
Assignees
Labels
api: composer Issues related to the Cloud Composer API. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@hejnal
Copy link

hejnal commented Oct 25, 2023

In which file did you encounter the issue?

composer/tools/composer_dags.py

Did you change the file? If so, how?

No change

Describe the issue

I run the script for the environment of 500 dags. It is extremely slow, it takes more than 1-2min to do this for each dag. I has taken almost entire day and not yet finished. Is there a better way to batch those requests and pause multiple dags at once?
This has to be done before the snapshot can be created.

Example logs:
2023-10-25 15:49:30,718 - Executing shell command: CLOUDSDK_API_ENDPOINT_OVERRIDES_COMPOSER=https://composer.googleapis.com/ gcloud composer environments run composer-dev --project=whejna-dataops --location=europe-west3 dags pause -- export_task_reschedule_v1_0
Executing the command: [ airflow dags pause export_task_reschedule_v1_0 ]...
Command has been started. execution_id=3fa888b4-7cf4-4c0e-ab07-c54cccda24ac
Use ctrl-c to interrupt the command
2023-10-25 15:51:07,371 - Dag: export_task_reschedule_v1_0, paused: True

Thanks

@hejnal hejnal added priority: p2 Moderately-important priority. Fix may not be included in next release. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 25, 2023
@product-auto-label product-auto-label bot added api: composer Issues related to the Cloud Composer API. samples Issues that are directly related to samples. labels Oct 25, 2023
@leahecole leahecole assigned rafalbiegacz and unassigned rachael-ds Oct 26, 2023
@leahecole leahecole added api: composer Issues related to the Cloud Composer API. and removed api: composer Issues related to the Cloud Composer API. triage me I really want to be triaged. labels Oct 26, 2023
@shahar1
Copy link

shahar1 commented Jan 23, 2024

I encountered the same issue, and I assume that there's some overhead involved in authenticating to the Cloud Composer's GKE.
It seems that the best way to handle it for now would be to run an SQL query for bulk update within Airflow's internal database.
I also raised an issue in Airflow to extend Airflow's CLI abilities to support bulk pause/resume, you could follow here: apache/airflow#36956

@shahar1
Copy link

shahar1 commented Mar 18, 2024

Created a PR in Airflow's repository for un/pausing multiple DAGs support as part of its CLI: apache/airflow#38265

It could take a while until it's merged and a bit longer until the Cloud Composer image eventually supports it. Nevertheless, it would be nice to solve the overhead issue from Cloud Composer's CLI side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: composer Issues related to the Cloud Composer API. priority: p2 Moderately-important priority. Fix may not be included in next release. samples Issues that are directly related to samples. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants