Skip to content

AIP-103: Add Task SDK support for retrieving Asset State by name/uri #67200

@jroachgolf84

Description

@jroachgolf84

Description

Support AssetState mechanism in the Task SDK for use in things like BaseEventTrigger's, which don't have access to context.

from airflow.sdk import AssetState

asset_state = AssetState(name="my_asset")  # Pass in the name of the Asset (or uri)

asset_state.set("watermark": "1")         # Store a value
watermark = asset_state.get("watermark")  # Retrieve the value

print(watermark)  # Should output "1"

Use case/motivation

Allow for Asset State to be retrieved/set in BaseEventTrigger, useful for Asset-watching.

Related issues

PR: #66595 (comment)

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions