Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AN-349 AN-358 Fix cost status #7676

Merged
merged 8 commits into from
Jan 15, 2025
Merged

Conversation

jgainerdewar
Copy link
Collaborator

@jgainerdewar jgainerdewar commented Jan 13, 2025

Description

Fixes a bug that caused an incorrect workflow status to be returned in the /cost response when subworkflows were present. This happened because subworkflow status was leaking into the parent workflow response.

Also fixes some build issues resulting from GHA runners upgrading to Ubuntu 24.

Release Notes Confirmation

CHANGELOG.md

  • I updated CHANGELOG.md in this PR
  • I assert that this change shouldn't be included in CHANGELOG.md because it doesn't impact community users

Terra Release Notes

  • I added a suggested release notes entry in this Jira ticket
  • I assert that this change doesn't need Jira release notes because it doesn't impact Terra users

@jgainerdewar jgainerdewar requested a review from a team as a code owner January 13, 2025 20:45
@@ -347,7 +347,8 @@ class MetadataBuilderActorSpec
val subWorkflow1aId = WorkflowId(UUID.fromString("1a1a1a1a-f76d-4af3-b371-5ba580916729"))
val subWorkflow1bId = WorkflowId(UUID.fromString("1b1b1b1b-f76d-4af3-b371-5ba580916729"))

val workflowState = WorkflowSucceeded
val workflowSucceededState = WorkflowSucceeded
val workflowRunningState = WorkflowRunning
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that this test fails on develop


def isComplete = subWorkflowsMetadata.size == waitFor
final case class HasReceivedCostEventsData(target: ActorRef,
Copy link
Collaborator Author

@jgainerdewar jgainerdewar Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we used HasReceivedEventsData as the data object when collecting per-subworkflow results for either plain metadata or cost. I'm splitting it into two classes here for the two different use cases, so we can include workflow status in the cost one.

Opinions welcome on the naming - I find HasReceivedEventsData to be an unclear name for that object, but didn't want to introduce churn by changing it, so I tried to find a sensible-seeming name for a new parent trait.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, i find that leaving an inline comment before the parent trait and then before the class to be more useful than trying to name things perfectly

@@ -491,7 +512,7 @@ class MetadataBuilderActor(readMetadataWorkerMaker: () => Props,
if (newData.isComplete) {
buildCostAndStop(
data.originalQuery.workflowId,
extractFromJsAs[JsString](js, "status").map(_.value).getOrElse(""), // should never be empty
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very happy to delete this terrible line of code that past me wrote.

()
case GetCost(wfId) if wfId == subWorkflow1aId =>
sender() ! CostResponse(subWorkflow1aId, workflowState, MetadataLookupResponse(sub1aQuery, sub1aEvents))
sender() ! CostResponse(subWorkflow1aId,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing to do really and naming things are hard anyways, but I had to reread this 3 times before I noticed the 1, vs 1a, vs 1b, vs 2 😓


def isComplete = subWorkflowsMetadata.size == waitFor
final case class HasReceivedCostEventsData(target: ActorRef,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, i find that leaving an inline comment before the parent trait and then before the class to be more useful than trying to name things perfectly

@jgainerdewar jgainerdewar changed the title AN-349 Fix cost status AN-349 AN-358 Fix cost status Jan 14, 2025
@jgainerdewar jgainerdewar merged commit 83c69a3 into develop Jan 15, 2025
41 of 42 checks passed
@jgainerdewar jgainerdewar deleted the jd_AN-349_costCappingStatus branch January 15, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants