Ben Jeffrey
08/18/2023, 12:08 PM@asset
def asset_a(config: ObjectClassImUsing):
<http://logger.info|logger.info>(f'Received input: {config}')
...
return updated_object
@asset
def asset_b(config: ObjectClassImUsing, asset_a: ObjectClassImUsing):
<http://logger.info|logger.info>(f'Received input: {config}')
...
return updated_more_object
@asset_sensor(asset_key=AssetKey("asset_a"), job=job_b)
def job_b_sensor(context: SensorEvaluationContext, asset_event: EventLogEntry):
assert asset_event.dagster_event and asset_event.dagster_event.asset_key
<http://context.log.info|context.log.info>(asset_event)
yield RunRequest(
run_key=context.cursor,
run_config=RunConfig(
ops={
"asset_b": "What do I put here to kick off a run of job_b with the output of asset_a?"
}
)
)
Daniel Gafni
08/18/2023, 12:46 PMBen Jeffrey
08/18/2023, 12:55 PMsean
08/18/2023, 2:25 PMAs for loading the actual output, are you saying I could leave the RunRequest blank and asset B would obtain the output of asset A automatically?If you are using IO managers, yes. In general you do not need to explicitly pass the dependencies of an asset when it is materialized-- you either let the framework do it for you (IO managers), or you load them in the asset itself.
Ben Jeffrey
08/18/2023, 4:47 PMasset_a
to the input of asset_b
. But now how do I also manually trigger a run of job_b
by overriding the run config and passing my own values to the input of asset_b
?sean
08/18/2023, 4:55 PMRunConfig
object):
ops:
asset_b:
inputs:
asset_a:
value: foobar
Ben Jeffrey
08/18/2023, 5:13 PMsean
08/18/2023, 5:15 PMsean
08/18/2023, 5:30 PMfrom typing import Optional
from dagster import Config, asset
@asset
def asset_a() -> str:
return "foo"
class AssetBConfig(Config):
asset_a: Optional[str] = None
@asset
def asset_b(asset_a: str, config: AssetBConfig) -> str:
asset_a_value = config.asset_a or asset_a
return asset_a_value + "bar"
Ben Jeffrey
08/18/2023, 6:15 PM