Skip to content

Can you launch a RunRequest while creating partition keys for a DynamicPartition #18283

Answered by clairelin135
dagsir[bot] bot asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it is possible. Here's an example:

stations_partition = DynamicPartitionsDefinition(name="stations")

@asset(partitions_def=stations_partition)
def my_asset():
    ...

@sensor(asset_selection=AssetSelection.keys(my_asset.key))
def stations_sensor(context):
    stations = ["1", "2", "3"]
    return SensorResult(
        run_requests=[RunRequest(run_key=None, tags={ASSET_PARTITION_RANGE_START_TAG: "1", ASSET_PARTITION_RANGE_END_TAG: "3"})],
        dynamic_partitions_requests=[stations_partition.build_add_request(stations)],
    )

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by clairelin135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant