https://dagster.io/ logo
#ask-community
Title
# ask-community
y

Yang

07/21/2022, 9:16 PM
Hi all, I'm trying to write a test for a sensor, and I got this error. What does this mean?
Copy code
dagster._check.ParameterCheckError: Param "job_def" is not one of ['JobDefinition', 'PipelineDefinition']. Got UnresolvedAssetJobDefinition(name='daily_funds_job', selection=<dagster.core.definitions.asset_selection.KeysAssetSelection object at 0x1340d0550>, config=None, description=None, tags={}, partitions_def=None) which is type <class 'dagster.core.definitions.unresolved_asset_job_definition.UnresolvedAssetJobDefinition'>
My job def looks like this
Copy code
daily_funds_job = define_asset_job(
    "daily_funds_job",
    selection=AssetSelection.assets(fund_holdings_asset))
My sensor test
Copy code
for run_request in zbs.holdings_zip_sensor(scontext):
        assert validate_run_config(daily_funds_job, run_request.run_config)
j

jamie

07/22/2022, 2:56 PM
Hi @Yang this is a bit of an implementation detail, but on our end the return type of
define_asset_job
is an UnresolvedAssetJobDefinition. this is so we can supply resources later if the
with_resources
api is used. I believe you should be able to get a JobDefinition from using the
resolve()
method
Copy code
# use this one in your repository
daily_funds_job = define_asset_job(
    "daily_funds_job",
    selection=AssetSelection.assets(fund_holdings_asset))

# use this one in the sensor test
resolved_daily_funds_job = daily_funds_job.resolve()
y

Yang

07/22/2022, 3:49 PM
Oh great, I'll try that!
s

sandy

07/22/2022, 4:48 PM
what version are you using @Yang? in our latest version, you should be able to pass
define_asset_job
directly without using
resolve
we actually generally discourage use of
resolve
- it's mostly an internal method
y

Yang

07/22/2022, 4:53 PM
oh ok, I'm still on 0.15.4 I'll upgrade then!
upgraded to 0.15.7, but it doesn't work. I'm just checking config fields manually instead of using validate_run_config
s

sandy

07/22/2022, 6:33 PM
what error are you seeing?
y

Yang

07/22/2022, 6:33 PM
Copy code
dagster._check.ParameterCheckError: Param "job_def" is not one of ['JobDefinition', 'PipelineDefinition']. Got UnresolvedAssetJobDefinition(name='daily_funds_job', selection=<dagster.core.definitions.asset_selection.KeysAssetSelection object at 0x10afa1fd0>, config=None, description=None, tags={}, partitions_def=None, executor_def=None) which is type <class 'dagster.core.definitions.unresolved_asset_job_definition.UnresolvedAssetJobDefinition'>.
s

sandy

07/22/2022, 6:33 PM
this is with
@sensor
?
agh just looked and the code and that is indeed missing
so I think
resolve
is your best bet until we fix that 😞
ohhh this is with
validate_run_config
. I'm an idiot. @jamie - you were right. ok yes I think
resolve
is your best bet right now
y

Yang

07/22/2022, 9:10 PM
oh ok, got it thanks!!
14 Views