question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make runtime output metadata available to downstream ops

See original GitHub issue

Requests for this:

Workaround for now, if you’re using software-defined assets and you want to access it in the IO manager:

def handle_output(self, context):
    context.add_output_metadata({"foo": "bar"})

def load_input(self, context):
    asset_key = context.asset_key
    event_log_entry = context.step_context.instance.get_latest_materialization_event(asset_key)
    metadata = event_log_entry.dagster_event.event_specific_data.materialization.metadata
    foo_value = metadata["foo"].value
    assert foo_entry.text == "bar"

Workaround for now, if you’re using software-defined assets and you want to access it in the downstream asset body:

@asset(non_argument_deps={AssetKey("some_upstream_asset")})
def downstream_asset(context):
    event_log_entry = context.instance.get_latest_materialization_event(AssetKey("some_upstream_asset"))
    metadata = event_log_entry.dagster_event.event_specific_data.materialization.metadata
    foo_value = metadata["foo"].value
    assert foo_entry.text == "bar"

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
dpeng817commented, Oct 24, 2022

If you want to figure out the latest materialization event for a particular partition key:

@asset(non_argument_deps={AssetKey("some_upstream_asset")})
def downstream_asset(context):
    event_log_record = context.instance.get_event_records(EventRecordsFilter(asset_key=AssetKey("some_upstream_asset"), asset_partitions=["some_partition"]), ascending=False)
    event_log_entry = event_log_record.event_log_entry
    metadata = event_log_entry.dagster_event.event_specific_data.materialization.metadata
    foo_value = metadata["foo"].value
    assert foo_entry.text == "bar"
0reactions
sryzacommented, Dec 2, 2022

@sryza I am using assets and I mean context.add_input_metadata

So you want add_input_metadata during load_input and then access it within @asset?

You should be able to do something like

@asset
def downstream_asset(context, upstream_asset):
    latest_observation_record = context.instance.get_event_records(
        EventRecordsFilter(
            event_type=DagsterEventType.ASSET_OBSERVATION,
            asset_key=AssetKey(["upstream_asset"]),
        ),
        ascending=False,
        limit=1,
    )[0]
    metadata = latest_observation_record.event_log_entry.dagster_event.event_specific_data.asset_observation.metadata
Read more comments on GitHub >

github_iconTop Results From Across the Web

Make runtime output metadata available to downstream ops ...
An orchestration platform for the development, production, and observation of data assets. - Make runtime output metadata available to downstream ops ...
Read more >
IO Managers - Dagster Docs
IOManagers are user-provided objects that are responsible for storing the output of an asset or op and loading it as input to downstream...
Read more >
Delta Live Tables concepts | Databricks on AWS
You can publish your tables to make them available for discovery and querying by downstream consumers. Pipeline updates. After you create the ...
Read more >
Troubleshoot Azure Stream Analytics outputs - Microsoft Learn
This article describes techniques to troubleshoot your output connections in Azure Stream Analytics jobs.
Read more >
MetaData in the DeepStream SDK
It is still available in the Gst Buffer. New metadata fields¶. The NvDsObjectMeta structure from DeepStream 5.0 GA release has three bbox info ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found