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

Fix detached test tasks names so they do not exceed 250 chars #1464

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tatiana
Copy link
Collaborator

@tatiana tatiana commented Jan 14, 2025

Since we introduced detached test tasks in #1433 (released in 1.8.0), users started facing issues due to very long task names exceeding Airflow's limits.

Example of Python traceback reported by user:

     Traceback (most recent call last):
      File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py", line 968, in __init__
        validate_key(task_id)
      File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/helpers.py", line 55, in validate_key
        raise AirflowException(f"The key has to be less than {max_length} characters")
    airflow.exceptions.AirflowException: The key has to be less than 250 characters

This PR fixes this issue. In case the name exceeds Airflow's limit (250 ATM), it will name the detached test using:

  • "detached_{incremental unique number}_test"

Closes: #1440

Since we introduced detached test tasks in #1433 (released in 1.8.0) users started facing issues due to very long task names exceeding Airflow's limits.

Example of stacktrace reported by user:
```
 Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.12/site-packages/airflow/models/baseoperator.py", line 968, in __init__
    validate_key(task_id)
  File "/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/helpers.py", line 55, in validate_key
    raise AirflowException(f"The key has to be less than {max_length} characters")
airflow.exceptions.AirflowException: The key has to be less than 250 characters
```

This PR fixes this issue. In case the name exceeds Airflow's limit (250 ATM), it will name the detached test using:
- "detached_{incremental unique number}_test"

Closes: #1440
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 14, 2025
Copy link

Deploying astronomer-cosmos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5941642
Status: ✅  Deploy successful!
Preview URL: https://614211b3.astronomer-cosmos.pages.dev
Branch Preview URL: https://issue-1440.astronomer-cosmos.pages.dev

View logs

@dosubot dosubot bot added the area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc label Jan 14, 2025
Copy link

netlify bot commented Jan 14, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit 5941642
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/67864e69cb1f560008b5a942

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.95%. Comparing base (768a0b9) to head (5941642).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1464   +/-   ##
=======================================
  Coverage   96.94%   96.95%           
=======================================
  Files          73       73           
  Lines        4355     4363    +8     
=======================================
+ Hits         4222     4230    +8     
  Misses        133      133           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tatiana tatiana mentioned this pull request Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] The key has to be less than 250 characters
1 participant