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

Move Asset user facing components to task_sdk #43773

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0c21f9c
feat(task_sdk): Move asset from Airflow core to task_sdk
Lee-W Nov 7, 2024
18f9cc7
feat(task_sdk): Move assets.metadata to task_sdk.definitions.asset
Lee-W Nov 7, 2024
7e4735f
fix(providers/amazon): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
c1506f7
fix(providers/google): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
7d10ad6
fix(providers/openlineage): fix common.compat provider ImportError ha…
Lee-W Nov 7, 2024
366325a
fix(provider/common/compat): fix common.compat provider ImportError h…
Lee-W Nov 7, 2024
9b871f8
feat(task_sdk): expose Model
Lee-W Nov 7, 2024
d05660c
docs(nesfragements): update how asset module should be imported
Lee-W Nov 7, 2024
dd45e4a
fix(task_sdk): fix 2_10 compatibility
Lee-W Nov 8, 2024
2631b65
feat(common.compat): use version to decide how to import assets inste…
Lee-W Nov 8, 2024
5dfb55f
feat(providers/common.compat): use airflow version instead of excepti…
Lee-W Nov 8, 2024
b67c7de
refactor(providers/common/compat): extract airflow version to __init__
Lee-W Nov 8, 2024
52201a7
fix(providers): use version compare to decide whether to import asset
Lee-W Nov 9, 2024
8705448
feat(decorators/asset): move @asset to task_sdk
Lee-W Nov 15, 2024
c93d9a2
refactor(asset): rename _AssetAliasCondition as AssetAliasCondition
Lee-W Nov 15, 2024
ba285c9
feat(task_sdk): make airflow.sdk.definitions.decoratos a package
Lee-W Nov 15, 2024
5e809bf
Revert "feat(task_sdk): make airflow.sdk.definitions.decoratos a pack…
Lee-W Nov 15, 2024
1fc9da5
feat(task_sdk): move asset related logic in airflow.sdk.definitions.d…
Lee-W Nov 15, 2024
79b8c0d
refactor(task_sdk): move @asset to airflow.sdk.definitions.asset.deco…
Lee-W Nov 16, 2024
149d660
test(providers/amazon): remove unnecessary compat handling
Lee-W Nov 16, 2024
d75b3b5
test(providers/google): remove unnecessary compat handling
Lee-W Nov 16, 2024
01426cd
test(openlineage): remove unnecessary compat handling
Lee-W Nov 16, 2024
eaec593
fix(provider/openlineage): fix how asset compat is handled
Lee-W Nov 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions airflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
"version": (".version", "", False),
# Deprecated lazy imports
"AirflowException": (".exceptions", "AirflowException", True),
"Dataset": (".assets", "Dataset", True),
"Dataset": (".sdk.definitions.asset", "Dataset", True),
Lee-W marked this conversation as resolved.
Show resolved Hide resolved
}
if TYPE_CHECKING:
# These objects are imported by PEP-562, however, static analyzers and IDE's
# have no idea about typing of these objects.
# Add it under TYPE_CHECKING block should help with it.
from airflow.assets import Asset, Dataset
from airflow.models.dag import DAG
from airflow.models.xcom_arg import XComArg
from airflow.sdk.definitions.asset import Asset, Dataset


def __getattr__(name: str):
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_connexion/endpoints/asset_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
queued_event_collection_schema,
queued_event_schema,
)
from airflow.assets import Asset
from airflow.assets.manager import asset_manager
from airflow.models.asset import AssetDagRunQueue, AssetEvent, AssetModel
from airflow.sdk.definitions.asset import Asset
from airflow.utils import timezone
from airflow.utils.api_migration import mark_fastapi_migration_done
from airflow.utils.db import get_query_count
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_fastapi/core_api/routes/public/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
QueuedEventResponse,
)
from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc
from airflow.assets import Asset
from airflow.assets.manager import asset_manager
from airflow.models.asset import AssetDagRunQueue, AssetEvent, AssetModel
from airflow.sdk.definitions.asset import Asset
from airflow.utils import timezone

assets_router = AirflowRouter(tags=["Asset"])
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_internal/endpoints/rpc_api_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
@functools.lru_cache
def initialize_method_map() -> dict[str, Callable]:
from airflow.api.common.trigger_dag import trigger_dag
from airflow.assets import expand_alias_to_assets
from airflow.assets.manager import AssetManager
from airflow.cli.commands.task_command import _get_ti_db_access
from airflow.dag_processing.manager import DagFileProcessorManager
Expand All @@ -76,6 +75,7 @@ def initialize_method_map() -> dict[str, Callable]:
_update_rtif,
_xcom_pull,
)
from airflow.sdk.definitions.asset import expand_alias_to_assets
from airflow.secrets.metastore import MetastoreBackend
from airflow.utils.cli_action_loggers import _default_action_log_internal
from airflow.utils.log.file_task_handler import FileTaskHandler
Expand Down
Loading
Loading