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

Merged
merged 30 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f445027
feat(task_sdk): Move asset from Airflow core to task_sdk
Lee-W Nov 7, 2024
6ecdb1c
feat(task_sdk): Move assets.metadata to task_sdk.definitions.asset
Lee-W Nov 7, 2024
b32ca27
fix(providers/amazon): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
28d32e5
fix(providers/google): fix common.compat provider ImportError handling
Lee-W Nov 7, 2024
704bd0d
fix(providers/openlineage): fix common.compat provider ImportError ha…
Lee-W Nov 7, 2024
bb1c45f
fix(provider/common/compat): fix common.compat provider ImportError h…
Lee-W Nov 7, 2024
14f9aff
feat(task_sdk): expose Model
Lee-W Nov 7, 2024
233f13a
docs(nesfragements): update how asset module should be imported
Lee-W Nov 7, 2024
6718ea9
fix(task_sdk): fix 2_10 compatibility
Lee-W Nov 8, 2024
bfb5436
feat(common.compat): use version to decide how to import assets inste…
Lee-W Nov 8, 2024
58e620d
feat(providers/common.compat): use airflow version instead of excepti…
Lee-W Nov 8, 2024
0184d07
refactor(providers/common/compat): extract airflow version to __init__
Lee-W Nov 8, 2024
d4ea63a
fix(providers): use version compare to decide whether to import asset
Lee-W Nov 9, 2024
3196709
feat(decorators/asset): move @asset to task_sdk
Lee-W Nov 15, 2024
5248e27
refactor(asset): rename _AssetAliasCondition as AssetAliasCondition
Lee-W Nov 15, 2024
04572a5
feat(task_sdk): make airflow.sdk.definitions.decoratos a package
Lee-W Nov 15, 2024
83bb1b1
Revert "feat(task_sdk): make airflow.sdk.definitions.decoratos a pack…
Lee-W Nov 15, 2024
ed7d80d
feat(task_sdk): move asset related logic in airflow.sdk.definitions.d…
Lee-W Nov 15, 2024
5ddb8ce
refactor(task_sdk): move @asset to airflow.sdk.definitions.asset.deco…
Lee-W Nov 16, 2024
bcc9759
test(providers/amazon): remove unnecessary compat handling
Lee-W Nov 16, 2024
4c98fdc
test(providers/google): remove unnecessary compat handling
Lee-W Nov 16, 2024
f1f8484
test(openlineage): remove unnecessary compat handling
Lee-W Nov 16, 2024
ab7ac9d
fix(provider/openlineage): fix how asset compat is handled
Lee-W Nov 16, 2024
1ad9f7b
feat(task_sdk/asset): expose extract_event_key
Lee-W Nov 18, 2024
1c16db0
test(providers/google): change Asset import back to common.compat
Lee-W Nov 18, 2024
45ac702
docs(newsfragments): fix error naming
Lee-W Nov 19, 2024
120d0f3
docs(newsfragments): fix typo
Lee-W Nov 19, 2024
6ea7347
docs(newsfragment): add missing metadata
Lee-W Nov 19, 2024
c726e30
fixup! feat(task_sdk): Move asset from Airflow core to task_sdk
Lee-W Nov 20, 2024
93ab795
fixup! feat(task_sdk): Move asset from Airflow core to task_sdk
Lee-W Nov 20, 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