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 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1b1e76c
feat(task_sdk): Move asset from Airflow core to task_sdk
Lee-W Nov 7, 2024
14b9164
feat(task_sdk): Move assets.metadata to task_sdk.definitions.asset
Lee-W Nov 7, 2024
c6243de
fix(providers/amazon): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
9ff2ca7
fix(providers/google): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
c52e090
fix(providers/openlineage): fix common.compat provider ImportError ha…
Lee-W Nov 7, 2024
8fc4095
fix(provider/common/compat): fix common.compat provider ImportError h…
Lee-W Nov 7, 2024
9d97eaa
feat(task_sdk): expose Model
Lee-W Nov 7, 2024
8e1e1cd
docs(nesfragements): update how asset module should be imported
Lee-W Nov 7, 2024
4b5452f
fix(task_sdk): fix 2_10 compatibility
Lee-W Nov 8, 2024
f5a2f9a
feat(common.compat): use version to decide how to import assets inste…
Lee-W Nov 8, 2024
5e0fe68
feat(providers/common.compat): use airflow version instead of excepti…
Lee-W Nov 8, 2024
2d64067
refactor(providers/common/compat): extract airflow version to __init__
Lee-W Nov 8, 2024
dd2e888
fix(providers): use version compare to decide whether to import asset
Lee-W Nov 9, 2024
78e01c6
feat(decorators/asset): move @asset to task_sdk
Lee-W Nov 15, 2024
763a6d0
refactor(asset): rename _AssetAliasCondition as AssetAliasCondition
Lee-W Nov 15, 2024
9c6af0d
feat(task_sdk): make airflow.sdk.definitions.decoratos a package
Lee-W Nov 15, 2024
dc5cb6a
Revert "feat(task_sdk): make airflow.sdk.definitions.decoratos a pack…
Lee-W Nov 15, 2024
4d17aa0
feat(task_sdk): move asset related logic in airflow.sdk.definitions.d…
Lee-W Nov 15, 2024
952cdec
refactor(task_sdk): move @asset to airflow.sdk.definitions.asset.deco…
Lee-W Nov 16, 2024
6d86152
test(providers/amazon): remove unnecessary compat handling
Lee-W Nov 16, 2024
dd8bfd0
test(providers/google): remove unnecessary compat handling
Lee-W Nov 16, 2024
14af1b0
test(openlineage): remove unnecessary compat handling
Lee-W Nov 16, 2024
2dee5f5
fix(provider/openlineage): fix how asset compat is handled
Lee-W Nov 16, 2024
61b1402
feat(task_sdk/asset): expose extract_event_key
Lee-W Nov 18, 2024
0ea2258
test(providers/google): change Asset import back to common.compat
Lee-W Nov 18, 2024
1d06fe3
docs(newsfragments): fix error naming
Lee-W Nov 19, 2024
fdab604
docs(newsfragments): fix typo
Lee-W Nov 19, 2024
9331e85
docs(newsfragment): add missing metadata
Lee-W Nov 19, 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 @@ -53,7 +53,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_ti_heartbeat,
_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