https://dagster.io/ logo
#dagster-support
Title
# dagster-support
d

Daniel Gafni

07/12/2022, 7:58 PM
The
with_resources
function doesn't work for
job
objects. Is it possible to define a
job
once and then provide different resources for different repositories (e.g. dev and prod)? Normally this could be done via defining a
job
from
graph
, but my job is defined using
build_assets_job
from assets. What's the best solution here?
s

sandy

07/12/2022, 8:00 PM
Hey Daniel - are you able to use
define_asset_job
?
d

Daniel Gafni

07/13/2022, 5:04 AM
Thanks, seems like this is what I need. However, it fails with
Copy code
dagster._check.CheckError: Invariant failed. Description: Assets defined for node 'catalog_session_events' have a partitions_def of Daily, starting 2022-05-01 Europe/Moscow., but job 'daily_etl' has non-matching partitions_def of Daily, starting 2022-05-31 Europe/Moscow..
These assets have a different start_date since some of the downstream assets depend on multiple partitions of the upstream assets (and therefore should start later). This error doesn't seem logical, especially considering I'm using partitions mapping and Dagster should know the assets are mapped correctly, but most importantly, this forbids sharing an asset between two jobs with different partitioning:. Consider: 1. Training job has a daily partitioning with an offset of 1 day, because we need the current partition to make targets for the previous one. 2. Inference job has a normal daily partitioning. Currently. it's impossible to share
data
and
model
assets between these two jobs (created via
define_asset_job
), because they required different partitioning. Anyway, after changing all the partitions_def to be the same just to try
define_asset_job
out, I got this error:
Copy code
dagster._check.CheckError: Invariant failed. Description: Duplicate definition found for daily_etl_partition_set
Seems like this is a bug (I can't find any duplicated definitions), I found it reported elsewhere. So seems like I'll have to go with
build_assets_job
for now (as it allows to override the asset partitioning when building the job). I'll just have to call it once per every
repository
, every time with different resources. Maybe
define_asset_job
should let the user to override the partitioning in the same way?
j

Jeremy

07/19/2022, 4:29 PM
@sandy I think something similar is happening with our dag. @Daniel Gafni did you resolve this?
s

sandy

07/19/2022, 11:57 PM
Hey @Jeremy - are you seeing an error like this?
Copy code
dagster._check.CheckError: Invariant failed. Description: Duplicate definition found for daily_etl_partition_set
if so, that's fixed in a recent version of Dagster
d

Daniel Gafni

07/20/2022, 7:12 AM
I didn't try this in the new version yet. Will do today.
Nope - still can't use assets with different partitions
start_date
for the same
define_asset_job
Copy code
dagster._check.CheckError: Invariant failed. Description: Assets defined for node 'line_items_stats_with_aggs' have a partitions_def of Daily, starting 2022-05-15 Europe/Moscow., but job 'daily_etl' has non-matching partitions_def of Daily, starting 2022-05-01 Europe/Moscow..
This means I can't use the same asset - ML model - both for training and inference jobs as they have different partitions
Copy code
dagster._check.CheckError: Invariant failed. Description: Assets defined for node 'ranking_model' have a partitions_def of Daily, starting 2022-05-29 Europe/Moscow. End offsetted by -1 partitions., but job 'catalog_ranking_inference' has non-matching partitions_def of Daily, starting 2022-05-01 Europe/Moscow..
j

Jeremy

07/20/2022, 2:22 PM
upgrading worked for me.
2 Views