35 lines
757 B
Python
35 lines
757 B
Python
import time
|
|
|
|
from dagster import AssetMaterialization, Output, config_mapping, job, op
|
|
|
|
|
|
@op(config_schema={"config_param": str})
|
|
def hello(context):
|
|
time.sleep(1)
|
|
print("halllo")
|
|
return Output(123, metadata={"aa": context.op_config["config_param"]})
|
|
|
|
|
|
@op
|
|
def goodbye(context, x: int):
|
|
time.sleep(2)
|
|
print("doooei", x)
|
|
context.log_event(
|
|
AssetMaterialization(
|
|
asset_key="my_asset",
|
|
metadata={"my_meta": 444},
|
|
description="A very useful value!",
|
|
)
|
|
)
|
|
return 2
|
|
|
|
|
|
@config_mapping(config_schema={"simplified_param": str})
|
|
def simplified_config(val):
|
|
return {"ops": {"hello": {"config": {"config_param": val["simplified_param"]}}}}
|
|
|
|
|
|
@job
|
|
def my_job():
|
|
goodbye(hello())
|