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-142] Adding cost centaur test #7685

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Conversation

lucymcnatt
Copy link
Contributor

@lucymcnatt lucymcnatt commented Jan 31, 2025

Description

  • Adds the cost endpoint to the cromwell API and the scaffolding to call it within a centaur test
  • Adds 2 test cases to the centaur suite
    • Check the cost of a workflow is within 10% of an expected value
    • Check that the cost of a workflow is 0 if call-cached

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

@lucymcnatt lucymcnatt marked this pull request as ready for review February 5, 2025 16:00
@lucymcnatt lucymcnatt requested a review from a team as a code owner February 5, 2025 16:00
} yield ()
}

def validateNoCost(submittedWorkflow: SubmittedWorkflow): Test[Unit] =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe overkill, but I also added a test to verify that the cost is 0 when a workflow is call-cached

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like it!

@@ -0,0 +1,17 @@
In order to run a Cromwell instance locally, there are the some prerequisites:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a start from what I can remember, feel free to add/edit!

Copy link
Collaborator

@jgainerdewar jgainerdewar left a comment

Choose a reason for hiding this comment

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

This is really great, very nice job 🎉 Left some minor feedback and thoughts but the missing newlines and the reference.conf change are the only real problems.

@@ -0,0 +1,39 @@
task getAverage {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this exactly the same as the existing cacheBetweenWF.wdl? If so it's fine to use that one in the new test rather than duplicating it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I had issues with the cache ids not matching because I think they were pulling from the run ofcacheBetweenWf, I just had some fun creating a new WDL and pushed that up

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, makes sense!

} yield ()
}

def validateNoCost(submittedWorkflow: SubmittedWorkflow): Test[Unit] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like it!

}

/**
* Validate that the actual cost is within 10% of the expected cost
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be more flexible and reliable to let the test define a min cost and max cost... I think this is OK as it, though, up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I ran a bunch of test runs locally to validate that 10% seems to be a reasonable threshold (never hit or got very close to it). It would be also easy enough to increase that to 20% if we think it might cause flakiness. I can pretty much just as easily switch to a min/max strategy if we decide that's better though!

Some thoughts here, in my mind I guess the question becomes:
Are we testing that the cost is fairly consistent, in which case a threshold makes sense
OR
are we testing that a seemingly accurate cost is returned, then maybe a min/max makes sense?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're more testing for accuracy, rather than testing whether the cloud pricing has changed... but it's a subtle distinction.

core/src/main/resources/reference.conf Outdated Show resolved Hide resolved
@@ -337,6 +357,15 @@ object TestFormulas extends StrictLogging {
case _ => Test.invalidTestDefinition("Configuration not supported by PapiUpgradeTest", workflowDefinition)
}

def runSuccessfulWorkflowAndVerifyCost(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you consider updating the existing test format to optionally check cost (if it's provided in the test config)?

* `sbt "centaur / IntegrationTest / test"` - compiles Centaur and runs all tests via sbt directly. Tests are expected to be in the `centaur/src/main/standardTestCases` directory. This can be changed by modifying `reference.conf`.
* `sbt "centaur / IntegrationTest / test"` - compiles Centaur and runs all tests via sbt directly.
* Can also just run `centaur/ IntegrationTest / test` from the sbt terminal.
Tests are expected to be in the `centaur/src/main/standardTestCases` directory. In order to run a set of specific tests, create a new subdirectory that contains the tests to run, then modify the path in the centaur `reference.conf`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does -n below in Tags cover this application?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I swear I tried that early on and it wasn't working for me, but I just tried again and it did... I can remove this addition!

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