Hi everyone, Is there there any built-in function ...
# ask-community
a
Hi everyone, Is there there any built-in function which help avoid having multiple instances of the same job for the same partition running in parallel? Or, even better, avoid having multiple instances of the op that materializes the same asset partition? Thanks.
s
@johann - is this possible to accomplish with the QueuedRunCoordinator?
j
avoid having multiple instances of the same job for the same partition running in parallel
I haven’t thought about this use case, but yeah it should be possible using the run queue. We tag partition runs with
dagster/partition:<name>
, and the run queue has a nifty
applyLimitPerUniqueValue
option
Something like
Copy code
# dagster.yaml
run_coordinator:
  module: dagster.core.run_coordinator
  class: QueuedRunCoordinator
  config:
    tag_concurrency_limits:
      - key: "dagster/partition"
        value:
          applyLimitPerUniqueValue: true
        limit: 1
should work. Note that this will restrict all runs on the instance with matching partition keys, including runs of different Jobs (if the partition sets had overlapping keys). It’s not currently possible to add an AND to the limit to filter it down to just the one parition set
even better, avoid having multiple instances of the op that materializes the same asset partition
op level concurrency limits are something we’ve prototyped a bunch but don’t currently support
a
Thanks @sandy @johann Do I need to send the tag
dagster/partition:<name>
when enqueueing jobs? Or it's added by Dagster by default?
s
It's added by default
a
Thanks
I have two partitioned assets, and it seemed that tag_concurrency_limits on
dagster/partition
prevented me from materialising the same partition (e.g: 2022-08-30) for those two assets at the same time. I guess the uniqueness is checked on the partition_key only, not the asset_key.
j
That’s correct. We don’t currently offer matching on both tags at the same time. Feel free to submit an issue. It also may be possible to hack in a unique suffix into your partition keys, but that’s not great
❤️ 1
a
Thanks @johann