Skip to content

Asset graph is not visible on the assets page #48789

@atul-astronomer

Description

@atul-astronomer

Apache Airflow version

3.0.0rc1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

Asset graph is not visible on the assets page

Image

Image

API server logs:

File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.9/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
File "/usr/local/lib/python3.9/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 967, in run
result = context.run(func, *args)
File "/opt/airflow/airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py", line 49, in get_dependencies
for dag, dependencies in sorted(SerializedDagModel.get_dag_dependencies().items()):
File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 102, in wrapper
return func(*args, session=session, **kwargs)
File "/opt/airflow/airflow-core/src/airflow/models/serialized_dag.py", line 656, in get_dag_dependencies
dag_depdendencies_by_dag = resolver.resolve()
File "/opt/airflow/airflow-core/src/airflow/models/serialized_dag.py", line 94, in resolve
dag_deps.extend(self.resolve_asset_name_ref_dag_dep(dep_data))
File "/opt/airflow/airflow-core/src/airflow/models/serialized_dag.py", line 180, in resolve_asset_name_ref_dag_dep
asset_id, asset_name = self.asset_ref_name_to_asset_id_name[dep_id]
KeyError: 'asset11_producer'

What you think should happen instead?

No response

How to reproduce

  1. Have a dag which is associated with an asset.
  2. Navigate to the assets page and see asset graph is not visible for any of the assets, even after creating an asset event.
from airflow.sdk.definitions.asset.decorators import asset

@asset(schedule=None, tags=["asset", "AIP-75"])
def conditional_asset1():
    pass

Looks like Asset.ref is creating this issue:

from __future__ import annotations

from airflow.decorators import dag, task
from airflow.sdk import Asset
from airflow.sdk.definitions.asset.decorators import asset


@asset(uri="s3://bucket/asset11_producer", schedule=None)
def producer1():
    pass


@asset(uri="s3://bucket/asset2_producer", schedule=None)
def producer2():
    pass

@asset(uri="abc", schedule=None)
def producer3():
    pass


@dag(
    schedule=Asset.ref(name="asset11_producer") & Asset.ref(name="asset2_producer"),
    catchup=False,
    tags=["asset"],
)
def consumer():
    @task()
    def process_nothing(triggering_asset_events):
        for a, events in triggering_asset_events.items():
            print(a.name, events)

consumer()

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

area:UIRelated to UI/UX. For Frontend Developers.area:corekind:bugThis is a clearly a bugpriority:highHigh priority bug that should be patched quickly but does not require immediate new release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions