Riccardo Tesselli
12/05/2022, 3:33 PMdefine_asset_job
and then I inject the job in a ScheduleDefinition
which I use in the repository. I’ve also found this but maybe there’s a workaroundowen
12/05/2022, 6:04 PM@asset_sensor
, which will kick off some arbitrary code (or even another job) whenever an asset materialization event occurs for a given key.Riccardo Tesselli
12/05/2022, 6:56 PMowen
12/06/2022, 11:29 PM@op
def do_asset_computation(input):
...
my_asset = AssetsDefinition.from_op(
do_asset_computation.with_hooks({some_hook_def}),
keys_by_input_name={"input": AssetKey("input")},
keys_by_output_name={"result": AssetKey("some_asset")},
)
which is pretty roundabout but should work.@asset
def my_asset():
result = None
try:
# ... do stuff
result = "something"
finally:
# things went as expected
if result is not None:
return result
else:
# ... do some error-related stuff
Riccardo Tesselli
12/07/2022, 4:13 PM