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

[Bug] missing attribute 'DbtSourceGcpCloudRunJobOperator' in new executionMode GCP_CLOUD_RUN_JOB #1276

Open
1 task
anai-s opened this issue Oct 23, 2024 · 4 comments · May be fixed by #1290
Open
1 task
Labels
area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc bug Something isn't working triage-needed Items need to be reviewed / assigned to milestone

Comments

@anai-s
Copy link

anai-s commented Oct 23, 2024

Astronomer Cosmos Version

1.7.0

dbt-core version

1.7.18

Versions of dbt adapters

1.4.0

LoadMode

DBT_LS_MANIFEST

ExecutionMode

DOCKER

InvocationMode

None

airflow version

2.9.1

Operating System

Windows 10

If a you think it's an UI issue, what browsers are you seeing the problem on?

No response

Deployment

Google Cloud Composer

Deployment details

No response

What happened?

I tried the new executionMode GCP_CLOUD_RUN_JOB but it raised the following issue:

Broken DAG (dags/cosmos_cloud_run_dag.py):
Traceback (most recent call last):
  File "/opt/python3.11/lib/python3.11/site-packages/cosmos/airflow/graph.py", line 258, in generate_task_or_group
    task_or_group = create_airflow_task(task_meta, dag, task_group=task_group)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python3.11/lib/python3.11/site-packages/cosmos/core/airflow.py", line 29, in get_airflow_task
    Operator = getattr(module, class_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'cosmos.operators.gcp_cloud_run_job' has no attribute 'DbtSourceGcpCloudRunJobOperator'

Relevant log output

No response

How to reproduce

I followed the jaffle_shop example in cosmos-example repository and add some configurations to my DAG:

def run_dbt_project() -> None:
    start_task = EmptyOperator(task_id="start-dbt-project")
    end_task = EmptyOperator(task_id="end-dbt-project")

    dbt_task_group = DbtTaskGroup(
        group_id="dbt-group",
        # dbt/cosmos-specific parameters
        project_config=project_config,
        profile_config=profile_config_yml,
        execution_config=ExecutionConfig(
            execution_mode=ExecutionMode.GCP_CLOUD_RUN_JOB
        ),
        render_config=RenderConfig(
            load_method=LoadMode.DBT_MANIFEST,
            source_rendering_behavior=SourceRenderingBehavior.WITH_TESTS_OR_FRESHNESS,
            select=["+tag:tag1+"],
        ),
        operator_args={
            "emit_datasets": False,  # Example of how to not set inlets and outlets
            "project_id": GCP_PROJECT_ID,
            "region": GCP_LOCATION,
            "job_name": GCP_CLOUD_RUN_JOB_NAME,
        },
    )

    start_task >> dbt_task_group >> end_task


run_dbt_project()

Anything else :)?

You should add GCP_CLOUD_RUN_JOB as executionMode

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Contact Details

No response

@anai-s anai-s added bug Something isn't working triage-needed Items need to be reviewed / assigned to milestone labels Oct 23, 2024
Copy link

dosubot bot commented Oct 23, 2024

The error you're encountering indicates that the DbtSourceGcpCloudRunJobOperator class is not defined in the cosmos.operators.gcp_cloud_run_job module. Based on the available information, this class does not exist in the module [1].

To resolve this issue, you should verify if the intended operator class is correctly named and exists in the module. If you intended to use a different operator, such as one of the existing ones like DbtRunGcpCloudRunJobOperator or DbtBuildGcpCloudRunJobOperator, you should update your code to use the correct class name. If DbtSourceGcpCloudRunJobOperator is a new or custom operator you expected to be available, you might need to implement it or check for updates in the repository that might have added this feature.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc label Oct 23, 2024
@tatiana
Copy link
Collaborator

tatiana commented Oct 29, 2024

@anai-s this is a bug, probably both features were introduced in the same Cosmos release and we missed this.
It should be a relatively small fix, would you be up for trying to contribute on this?

@anai-s
Copy link
Author

anai-s commented Oct 29, 2024

@tatiana Yes I can try to submit a PR to fix the bug

@tatiana
Copy link
Collaborator

tatiana commented Oct 29, 2024

Thanks a lot, @anai-s !

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 bug Something isn't working triage-needed Items need to be reviewed / assigned to milestone
Projects
None yet
2 participants