HI, what is the equivalent for job.execute_in_proc...
# ask-community
t
HI, what is the equivalent for job.execute_in_process() for a job created with define_asset_job()?
j
can you try
Copy code
asset_job = defin_asset_job(.....)
asset_job.resolve().execute_in_process()
I haven't tested this myself yet, but i think it should work. Let me know if it doesn't and i'll help debug!
Wanted to give a quick follow up on this - in our latest version, the
resolve
call is unnecessary. So if you are able to update, that's the approach we recommend
t
Thanks for the feedback. I still need resolve() in 0.15.7. Can't test it properly though because I am still fighting with SourceAssets
I use
asset_job.ressolve(assets=[myasset], source_assets=[mysourceasset]).execute_in_process()
but I get the error that the key "foo" is not provided in the error
Copy code
AssetKey(s) {'foo'} were selected, but no AssetDefinition objects supply these keys.
even though
mysourceasset
definitely has this key. BTW: I get the same error when I add the stuff in a repo and open it with dagit. I think you have to enhance your SourceAssets example in the docs with a little bit more complex example which also uses jobs, ...
@jamie I extended your example a little into the direction of my code. (I use assets jobs because I have to inject configs and tags.) The below code is the minimal example for me which throws an error.
Copy code
from dagster import AssetKey, SourceAsset, asset, define_asset_job, repository


@asset
def repository_a_asset():
    return 5


job_a = define_asset_job(
    name="JOBA", selection=[repository_a_asset.key.to_user_string()]
)


@repository
def repository_a():
    return [job_a, repository_a_asset]


repository_a_source_asset = SourceAsset(key=repository_a_asset.key)


@asset
def repository_b_asset(repository_a_asset):
    return repository_a_asset + 6


job_b = define_asset_job(
    name="JOBB",
    selection=[repository_b_asset.key.to_user_string()]
    + [repository_a_source_asset.key.to_user_string()],
)


@repository
def repository_b():
    return [job_b, repository_b_asset, repository_a_source_asset]
j
hi! thanks or bringing this to our attention and opening a gh issue. It'll get added into our backlog! and thanks for also letting me know you still need resolve() in 0.15.7