Implementing a Custom Run Coordinator #29473
ldnicolasmay
started this conversation in
Ideas
Replies: 1 comment
-
@garethbrickman Probably worth moving it to a discussion? @ldnicolasmay Thank you for the writeup! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
I couldn't find an example of a Custom Run Coordinator anywhere, so I thought it might be helpful to share my solution with anyone else looking to implement their own custom run coordinator.
This may not be the most elegant solution, but it works.
If you have any trouble following this, please comment below and I'll revise when I find the time.
File Tree
I assume you have a working Dagster project with your own user code, here exemplified as the
my-user-code
directory andDockerfile.my_user_code
Dockerfile.I'll focus on the
my-dagster-customizations
directory, the Helmvalues.yaml
file, and both Dockerfiles.I suspect Kubernetes is the most common way to deploy Dagster instances, so my examples will assume you're using Kubernetes. This example can probably be easily adapted for different approaches.
Dockerfiles
You'll need to install your customizations into all the Docker images that are used in your deployment. That includes your user code image and the image used for both the Dagster daemon and webserver.
Daemon and Webserver
Here, we'll be installing the
my-dagster-customizations
package over Dagster'sdagster-k8s
image.We'll also need to install the package in the user code image.
Contents of
my-dagster-customizations
pyproject.toml
run_coordinator/__init__.py
Empty file.
run_coordinator/custom_run_coordinator.py
This module extends the Dagster's
QueuedRunCoordinator
class.Contents of
helm/dagster/
values.yaml
The portion of interest is the values of
dagsterDaemon.runCoordinator
.Wrap-up
If you want to add a
config
field to the custom run coordinator (for example, alongsidedagsterDaemon.runCoordinator.config.customRunCoordinator.config.tag_conccurreny_limits
), you'll need to add that as a property to theCustomRunCoordinator
andRunQueueConfig
classes inmy-dagster-customizations/run_coordinator/custom_run_coordinator.py
, and then account for how the property changessubmit_run
method's triggering ofDagsterRun
s.I hope this helps anyone looking to create their own run coordinator behavior get up to speed much faster than it took me.
If you're looking to customize Dagster's run launcher, here's a GitHub issue that should help: #15856. The process is pretty similar to customizing the run coordinator.
Beta Was this translation helpful? Give feedback.
All reactions