Fix toggling DAG suspension for DAGs with custom names #636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I find that toggling DAG suspension (i.e. "live") from frontend doesn't work when the DAG has a custom name defined:
Similar to #625, the frontend fix is extracting the file basename with out the
.yaml
bit as the DAG ID, and pass that to the backend for toggling.However, upon fruther inspection, I also found the backend rest API doesn't return the right suspension status on a DAG with custom name. Furthermore, the scheduler also assumes a DAG's "name" is always the filename when calling
client.IsSuspended()
. So I fixed those as well.It looks like
DAG.Name
is used quite a few times when actually aDAG.ID
should be used instead. Maybe we should consider adding a newID
field to theDAG
struct, which always stores the YAML filename, whileDAG.Name
can be overwritten with a custom name from the DAG spec.