How can I create a job from an op and a `define_as...
# ask-community
s
How can I create a job from an op and a
define_asset_job
? I have
build = define_asset_job(...)
and
@job def deploy(): clone_db()
(where clone_db is an op). I want
@job def build_and_deploy(): deploy(build())
. But this doesn't work because build is not callable (it's an UnresolvedAssetJobDefinition not a function). How can I achieve the desired result?
z
I don't think you can string together asset jobs and op-based jobs. The options I can think of for bridging the two would be 1) refactoring to two graph-based assets and then creating one asset job to encapsulate both of them or 2) using an AssetMaterializationSensor or RunStatusSensor to kick off a job when the asset job finishes
s
+1 to what Zach said. Any particular reason not to model
clone_db
as an asset?
s
Hey guys. I think you're right that
clone_db
should probably be another asset. That will just require a bit of a mental shift from myself– I hadn't thought of that! Thanks for your help 🙂