Using Asset tag detection for conditional behavior #24302
clayheaton
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Why did you not set concurrency limitations for this particular asset? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a situation where I have an asset that needs to materialize every 15 minutes. It's OK if it skips one (or even two) of these slots. The main restriction is that it cannot materialize if another run is materializing assets that rely on the table that it generates.
My goal was to enable this frequently-updating asset to skip it's materialization if any active runs use the table it creates. Hence, I wanted a way to tag assets so that the frequent-updater could detect if they're running.
Note that I'm self-hosting Dagster and using a docker compose setup with multiple code locations. This works across code locations. I'm using the Snowflake IO Manager, but it should work with any IO Manager.
Here's what I did... I wrote this function (that might need some error-checking... not sure I'm catching all cases) that lives in each code location that needs to run this type of check. I have a
shared_functions
directory for stuff like this, though I should turn it into a module I can install. That's a story for another day.Then what I do is use the
tags
kwarg in the@asset
decorator, like this:In my frequent updater, I can do this:
It's quite convenient and I can see using it for other purposes. I'd prefer not to have to use the GraphQL API, but I couldn't figure out another way to do it.
Beta Was this translation helpful? Give feedback.
All reactions