Skip to content

Add bundle_name and latest_bundle_version to dags list command #45646

Closed

Description

@jedcunningham

Body

We need to add bundle_name and latest_bundle_version to the dags list command

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Activity

  1. added
    kind:meta
    on Jan 14, 2025
  2. ambika-garg commented on Jan 16, 2025

    @ambika-garg
    Contributor

    Hey @jedcunningham, I can take this up. You can assign it to me.

  3. ambika-garg commented on Jan 17, 2025

    @ambika-garg
    Contributor

    Hey @jedcunningham, I have a quick question about creating DAG Bundles. I noticed several classes under dag_processing/bundles. How can we use them to create bundles locally?

  4. jedcunningham commented on Jan 17, 2025

    @jedcunningham
    MemberAuthor

    You set them in config. The default and example there should get you going, but feel free to reach back out if you get stuck!

  5. ambika-garg commented on Jan 18, 2025

    @ambika-garg
    Contributor

    I have created a draft PR (#45779) that adds the bundle name as an argument to the dags list command. Could you please review it to ensure it's on the right track? Once confirmed, I will proceed to add the bundle_version argument as well.

  6. jedcunningham commented on Jan 19, 2025

    @jedcunningham
    MemberAuthor

    Couple things:

  7. ambika-garg commented on Jan 19, 2025

    @ambika-garg
    Contributor

    Thankyou @jedcunningham for reviewing it, I'll go with the approach enabling DagBag(read_dags_from_db=True) and using the added columns in the output of cli command.

  8. ambika-garg commented on Jan 22, 2025

    @ambika-garg
    Contributor

    Hi @jedcunningham,

    I have a few questions:

    1. I was able to display the bundle name and version in the output as shown in the image. Let me know if this aligns with your expectations. You can also review the changes in the draft PR.
    Image
    1. I tested this on LocalBundle, but since it doesn’t support versions, I wanted to test it on GitBundle. However, I encountered an error. I updated the config.yml with the following changes but ran into issues. Could you guide me on whether any specific configurations are required?

    2. As per your suggestion, I attempted to use Dagbag(read_dags_from_db=True). While exploring this approach, I tried using the collect_dags_from_db function from dagbag file, It was unable to load any file from the db.

    Looking forward to your guidance!

  9. ambika-garg commented on Jan 22, 2025

    @ambika-garg
    Contributor

    Once we are good with list_dags command, we can extend the output functionality to the other CLI commands as well.

  10. jedcunningham commented on Jan 27, 2025

    @jedcunningham
    MemberAuthor
    1. I was able to display the bundle name and version in the output as shown in the image. Let me know if this aligns with your expectations. You can also review the changes in the [draft PR.](https://github.com/apache/airflow/pull/45779)
    
    Image

    Yep, exactly!

    2. I tested this on LocalBundle, but since it doesn’t support versions, I wanted to test it on GitBundle. However, I encountered an error. I updated the config.yml with the following changes but ran into issues. Could you guide me on whether any specific configurations are required?
    

    Without the error message, it's tough to say. There has been a bit of churn in GitHook and GitDagBundle recently. If you need a working config, let me know and I'll craft one to share.

    3. As per your suggestion, I attempted to use Dagbag(read_dags_from_db=True). While exploring this approach, I tried using the collect_dags_from_db function from [dagbag](https://github.com/apache/airflow/blob/main/airflow/models/dagbag.py) file, It was unable to load any file from the db.
    

    Hmm, in theory, you can just do:

    >>> from airflow.models.dagbag import DagBag
    >>> bag = DagBag(read_dags_from_db=True)
    >>> bag.collect_dags_from_db()
    [2025-01-26T19:00:50.726-0700] {dagbag.py:612} INFO - Filling up the DagBag from database
    ...
    >>> bag.dag_ids
    ['hello', 'mapping_always_short', 'ke_image_override']
    

    Did you get any errors? Or it was just empty?

  11. ambika-garg commented on Jan 27, 2025

    @ambika-garg
    Contributor

    Hmm, in theory, you can just do:

    >>> from airflow.models.dagbag import DagBag
    >>> bag = DagBag(read_dags_from_db=True)
    >>> bag.collect_dags_from_db()
    [2025-01-26T19:00:50.726-0700] {dagbag.py:612} INFO - Filling up the DagBag from database
    ...
    >>> bag.dag_ids
    ['hello', 'mapping_always_short', 'ke_image_override']
    

    Did you get any errors? Or it was just empty?

    Hey @jedcunningham , I get the following error upon trying it.

    Image
  12. ambika-garg commented on Jan 27, 2025

    @ambika-garg
    Contributor

    Could you also please share a working configuration for the GithubDagBundle?

  13. jedcunningham commented on Jan 28, 2025

    @jedcunningham
    MemberAuthor

    Sounds like your db isn't migrated.

    Here is an example. First you need to set up a connection:

    AIRFLOW_CONN_AIRFLOW_GIT_CONN='{"host": "https://github.com/apache/airflow.git"}'
    

    Then, add this to your config:

    [dag_processor]
    dag_bundle_config_list = [
            {
                "name": "airflow_example_dags",
                "classpath": "airflow.dag_processing.bundles.git.GitDagBundle",
                "kwargs": {"tracking_ref": "main", "git_conn_id": "airflow_git_conn", subdir="airflow/example_dags"}
            }
        ]
    

    However, something is broken right now and the processor is getting stuck on servicing the sockets. I'll have to dig into this tomorrow. In the meantime, you can safely go into the db and just put a string in the dag.bundle_version column. That will unblock you for now.

    (edit: added .git to the host - we need that!)

  14. added this to the Airflow 3.0.0 milestone on Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:CLIarea:dag-bundleskind:meta

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions