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 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e992402
[AN-142] Adding cost centaur test
lucymcnatt Jan 31, 2025
a476d05
formatting ...
lucymcnatt Jan 31, 2025
1a9db97
remove test files
lucymcnatt Jan 31, 2025
4c52851
extra line breaks
lucymcnatt Jan 31, 2025
e314da6
cleanup
lucymcnatt Feb 3, 2025
60bc2ba
edit name
lucymcnatt Feb 3, 2025
3edb81c
disable call-caching
lucymcnatt Feb 4, 2025
5e6f36d
documentation updates
lucymcnatt Feb 4, 2025
1714d0a
add no cost test
lucymcnatt Feb 5, 2025
e44409f
update name
lucymcnatt Feb 5, 2025
cbd73b1
Update CentaurTestCase.scala
lucymcnatt Feb 5, 2025
5dd597e
fmt
lucymcnatt Feb 5, 2025
215ff98
update doc
lucymcnatt Feb 5, 2025
83028d7
fix comment
lucymcnatt Feb 5, 2025
0cbcbab
update cache test
lucymcnatt Feb 5, 2025
2a83163
fixes
lucymcnatt Feb 5, 2025
9aabb3d
Merge branch 'develop' into AN-142-cost-test
aednichols Feb 5, 2025
79e256b
try changing application.conf
lucymcnatt Feb 6, 2025
0c63680
small fixes
lucymcnatt Feb 7, 2025
0205711
remove old mysql test
lucymcnatt Feb 7, 2025
a459a7a
switch to cost range
lucymcnatt Feb 8, 2025
a9263f0
oops
lucymcnatt Feb 8, 2025
b181c03
fmt
lucymcnatt Feb 8, 2025
5ef83f3
update docs
lucymcnatt Feb 8, 2025
dcd3dd3
config fmt
lucymcnatt Feb 11, 2025
2b9e7f7
tweaks
lucymcnatt Feb 11, 2025
af74cad
missing paren
lucymcnatt Feb 11, 2025
9106c96
adding application default to google auths for batch + papi
lucymcnatt Feb 11, 2025
d6fa136
Merge branch 'develop' into AN-142-cost-test
lucymcnatt Feb 11, 2025
642fead
add google auth to papi provider conf
lucymcnatt Feb 12, 2025
b6954b0
actually add AD
lucymcnatt Feb 12, 2025
ce5249a
add google auth in different config
lucymcnatt Feb 12, 2025
67ccddd
add requester pays SA
lucymcnatt Feb 12, 2025
ca07382
Merge branch 'develop' into AN-142-cost-test
lucymcnatt Feb 12, 2025
a06a102
add application creds to papi test file
lucymcnatt Feb 12, 2025
378f32e
add back 8.0
lucymcnatt Feb 12, 2025
8421765
wrong branch
lucymcnatt Feb 12, 2025
43f10b7
different cost for papi vs. batch
lucymcnatt Feb 12, 2025
1e2d004
cleanup
lucymcnatt Feb 12, 2025
3044ab0
fix test names
lucymcnatt Feb 13, 2025
9d686f9
try papi v2?
lucymcnatt Feb 13, 2025
0d98adc
try only mode
lucymcnatt Feb 13, 2025
0cfdad0
try defining horicromtal tests separately
lucymcnatt Feb 13, 2025
e2bd976
fmt
lucymcnatt Feb 14, 2025
bcea4db
Merge branch 'develop' into AN-142-cost-test
lucymcnatt Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 18 additions & 30 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,40 @@ jobs:
matrix:
# Batch test fixes to land later
include:
- build_type: centaurPapiV2beta
build_mysql: 5.6
friendly_name: Life Sciences, MySQL 5.6 (current Terra production)
- build_type: centaurPapiV2beta
build_mysql: 5.7
friendly_name: Life Sciences, MySQL 5.7
- build_type: centaurPapiV2beta
build_mysql: 8.0
friendly_name: Life Sciences, MySQL 8.0 (required Terra production)
friendly_name: Life Sciences, MySQL 8.0
- build_type: centaurPapiV2beta
build_mysql: 8.4
friendly_name: Life Sciences, MySQL 8.4 (aspirational Terra production)
- build_type: centaurGcpBatch
build_mysql: 5.6
friendly_name: GCP Batch, MySQL 5.6
- build_type: centaurGcpBatch
build_mysql: 5.7
friendly_name: GCP Batch, MySQL 5.7
friendly_name: Life Sciences, MySQL 8.4 (current Terra production)
- build_type: centaurGcpBatch
build_mysql: 8.0
friendly_name: GCP Batch, MySQL 8.0
- build_type: centaurGcpBatch
build_mysql: 8.4
friendly_name: GCP Batch, MySQL 8.4
- build_type: centaurPapiV2betaRestart
build_mysql: 5.7
build_mysql: 8.4
friendly_name: Centaur Papi V2 Beta (restart)
- build_type: dbms
friendly_name: DBMS
- build_type: centaurTes
build_mysql: 5.7
friendly_name: Centaur TES with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur TES with MySQL 8.4
- build_type: centaurLocal
build_mysql: 5.7
friendly_name: Centaur Local with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur Local with MySQL 8.4
- build_type: checkPublish
friendly_name: Check Publish
- build_type: centaurAws
build_mysql: 5.7
friendly_name: Centaur AWS with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur AWS with MySQL 8.4
- build_type: centaurDummy
build_mysql: 5.7
friendly_name: Centaur Dummy with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur Dummy with MySQL 8.4
- build_type: centaurHoricromtalPapiV2beta
build_mysql: 5.7
friendly_name: Centaur Horicromtal PapiV2 Beta with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur Horicromtal PapiV2 Beta with MySQL 8.4
- build_type: horicromtalDeadlock
friendly_name: Horicromtal Deadlock
- build_type: singleWorkflowRunner
Expand All @@ -89,15 +77,15 @@ jobs:
build_postgresql: 11.3
friendly_name: Centaur Local with PostgreSQL 11.3
- build_type: centaurEngineUpgradeLocal
build_mysql: 5.7
friendly_name: Centaur Engine Upgrade Local with MySQL 5.7
build_mysql: 8.4
friendly_name: Centaur Engine Upgrade Local with MySQL 8.4
- build_type: referenceDiskManifestBuilderApp
friendly_name: Reference Disk Manifest Builder App
- build_type: centaurSlurm
build_mysql: 5.7
friendly_name: "Centaur Slurm with MySQL 5.7"
build_mysql: 8.4
friendly_name: "Centaur Slurm with MySQL 8.4"
- build_type: centaurBlob
build_mysql: 5.7
build_mysql: 8.4
friendly_name: Centaur Blob
name: ${{ matrix.friendly_name }}
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 88 Release Notes

### Mysql 8 & 8.4

Cromwell now supports MySQL 8.0 and 8.4 and 8.0 and 8.4-compatible databases. Older versions of MySQL are no longer officially supported or tested, but they are not explicitly forbidden from use.

### New feature: Prevent Job start during Cloud Quota exhaustion

This optional feature prevents Cromwell from starting new jobs in a group that is currently experiencing
Expand Down
2 changes: 2 additions & 0 deletions centaur/src/it/scala/centaur/CentaurTestSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ object CentaurTestSuite extends StrictLogging {

def isPapiUpgradeTest(testCase: CentaurTestCase): Boolean = testCase.containsTag("papi_upgrade")

def isHoricromtalTest(testCase: CentaurTestCase): Boolean = testCase.containsTag("horicromtal")

/** Horicromtality-related assertion config. */
val cromwellTracker: Option[CromwellTracker] = {

Expand Down
14 changes: 14 additions & 0 deletions centaur/src/it/scala/centaur/HoricromtalTestCaseSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package centaur

import centaur.test.standard.CentaurTestCase
import org.scalatest.DoNotDiscover

@DoNotDiscover
class HoricromtalTestCaseSpec(cromwellBackends: List[String]) extends AbstractCentaurTestCaseSpec(cromwellBackends) {

def this() = this(CentaurTestSuite.cromwellBackends)

def testType: String = "Horicromtal"

def isMatchingHoricromtalTest(testCase: CentaurTestCase): Boolean = CentaurTestSuite.isHoricromtalTest(testCase)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
task one {
Int vertAxis
command {
echo ${vertAxis/2}
}
output {
Float semiVertAxis = read_int(stdout())
}
runtime {
docker: "gcr.io/gcp-runtimes/ubuntu_16_0_4@sha256:53a002b59dfcd43b4d15e97c1acbeae035ddd1b31a106659a312e9fe65f00afa"
}
}

task two {
Int horAxis
command {
echo ${horAxis/2}
}
output {
Float semiHorAxis = read_int(stdout())
}
runtime {
docker: "gcr.io/gcp-runtimes/ubuntu_16_0_4@sha256:53a002b59dfcd43b4d15e97c1acbeae035ddd1b31a106659a312e9fe65f00afa"
}
}

task area{
Float semiVertAxis
Float semiHorAxis
Float pi = 3.14159

command {
echo ${semiHorAxis*semiVertAxis*pi}
}
output {
Float ellipseArea = read_float(stdout())
}
runtime {
docker: "ubuntu@sha256:71cd81252a3563a03ad8daee81047b62ab5d892ebbfbf71cf53415f29c130950"
}
}

workflow cacheBetweenWFNoCost {
call one {
input: vertAxis = 5
}
call two {
input: horAxis = 6
}
call area {
input: semiVertAxis = one.semiVertAxis, semiHorAxis = two.semiHorAxis
}
output {
area.ellipseArea
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: cacheBetweenWFNoCost
testFormat: runtwiceexpectingcallcachingnocost
backends: [Papi, GCPBATCH]

files {
workflow: cacheBetweenWF/cacheBetweenWFNoCost.wdl
options: common_options/cache_read_off_write_on.options
second-options: common_options/cache_read_on_write_on.options
}

metadata {
workflowName: cacheBetweenWFNoCost
status: Succeeded
"calls.cacheBetweenWFNoCost.one.callCaching.result": "Cache Hit: <<CACHE_HIT_UUID>>:cacheBetweenWFNoCost.one:-1"
"calls.cacheBetweenWFNoCost.two.callCaching.result": "Cache Hit: <<CACHE_HIT_UUID>>:cacheBetweenWFNoCost.two:-1"
"outputs.cacheBetweenWFNoCost.area.ellipseArea": 18.849539999999998
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"read_from_cache":false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: recursive_imports_cost_batch
testFormat: workflowsuccessandverifycost
backends: [GCPBATCH]

files {
workflow: recursive_imports/recursive_imports.wdl
imports: [
forkjoin/forkjoin.wdl,
sub_workflow_hello_world/sub_workflow_hello_world.wdl,
sub_workflow_hello_world/sub_workflow_hello_world_import.wdl,
sub_workflow_interactions/sub_workflow_interactions_import.wdl,
sub_workflow_interactions/sub_workflow_interactions.wdl
]
# Adds option to disable call-caching
options: recursive_imports/recursive_imports_cost.options
}

metadata {
workflowName: recursive_imports
status: Succeeded
}

cost: [0.0015, 0.0019]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: recursive_imports_cost_papi
testFormat: workflowsuccessandverifycost
backends: {
mode: "only",
list: [PapiV2]
}

files {
workflow: recursive_imports/recursive_imports.wdl
imports: [
forkjoin/forkjoin.wdl,
sub_workflow_hello_world/sub_workflow_hello_world.wdl,
sub_workflow_hello_world/sub_workflow_hello_world_import.wdl,
sub_workflow_interactions/sub_workflow_interactions_import.wdl,
sub_workflow_interactions/sub_workflow_interactions.wdl
]
# Adds option to disable call-caching
options: recursive_imports/recursive_imports_cost.options
}

metadata {
workflowName: recursive_imports
status: Succeeded
}

cost: [0.0035,0.0045]
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ object CentaurCromwellClient extends StrictLogging {
): IO[WorkflowMetadata] =
sendReceiveFutureCompletion(() => cromwellClient.metadata(id, args))

def cost(workflow: SubmittedWorkflow): IO[WorkflowCost] =
sendReceiveFutureCompletion(() => cromwellClient.cost(workflow.id))

def archiveStatus(id: WorkflowId): IO[String] =
sendReceiveFutureCompletion(() => cromwellClient.query(id)).map(_.results.head.metadataArchiveStatus)

Expand Down
48 changes: 48 additions & 0 deletions centaur/src/main/scala/centaur/test/Test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1060,4 +1060,52 @@
IO.raiseError(CentaurTestException(message, workflow))
}
}

def getExpectedCost(workflowCost: Option[List[BigDecimal]]): IO[List[BigDecimal]] =
workflowCost match {
case Some(cost) if cost(0) > cost(1) =>
IO.raiseError(
new Exception(s"Lower bound of expected cost cannot be higher than the upper bound (${cost(0)} - ${cost(1)})")

Check warning on line 1068 in centaur/src/main/scala/centaur/test/Test.scala

View check run for this annotation

Codecov / codecov/patch

centaur/src/main/scala/centaur/test/Test.scala#L1067-L1068

Added lines #L1067 - L1068 were not covered by tests
)
case Some(cost) => IO.pure(cost)
case None =>
IO.raiseError(new Exception("Expected cost range is required in the test config to validate the workflow cost"))

Check warning on line 1072 in centaur/src/main/scala/centaur/test/Test.scala

View check run for this annotation

Codecov / codecov/patch

centaur/src/main/scala/centaur/test/Test.scala#L1072

Added line #L1072 was not covered by tests
}

/**
* Validate that the actual cost is within the expected range
*/
def validateCost(actualCost: BigDecimal, expectedCost: List[BigDecimal]): IO[Unit] =
if (expectedCost(0) > actualCost || actualCost > expectedCost(1)) {
IO.raiseError(
new Exception(s"Expected cost within range ${expectedCost(0)} - ${expectedCost(1)} but got $actualCost")

Check warning on line 1081 in centaur/src/main/scala/centaur/test/Test.scala

View check run for this annotation

Codecov / codecov/patch

centaur/src/main/scala/centaur/test/Test.scala#L1080-L1081

Added lines #L1080 - L1081 were not covered by tests
)
} else {
IO.unit
}

def fetchAndValidateCost(workflowSpec: Workflow, submittedWorkflow: SubmittedWorkflow): Test[Unit] =
new Test[Unit] {

override def run: IO[Unit] =
for {
actualCost <- CentaurCromwellClient.cost(submittedWorkflow)
expectedCost <- getExpectedCost(workflowSpec.cost)
_ <- validateCost(actualCost.cost, expectedCost)
} 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!

new Test[Unit] {

override def run: IO[Unit] =
for {
actualCost <- CentaurCromwellClient.cost(submittedWorkflow)
_ =
if (actualCost.cost != 0)
IO.raiseError(new Exception(s"When using call caching, the cost must be 0, not ${actualCost.cost}"))

Check warning on line 1106 in centaur/src/main/scala/centaur/test/Test.scala

View check run for this annotation

Codecov / codecov/patch

centaur/src/main/scala/centaur/test/Test.scala#L1106

Added line #L1106 was not covered by tests
else IO.unit
} yield ()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ object TestFormulas extends StrictLogging {
} yield SubmitResponse(submittedWorkflow)

def runSuccessfulWorkflowAndVerifyMetadata(
workflowDefinition: Workflow
workflowDefinition: Workflow,
checkCost: Boolean = false
)(implicit cromwellTracker: Option[CromwellTracker]): Test[SubmitResponse] = for {
_ <- checkDescription(workflowDefinition, validityExpectation = Option(true))
_ <- timingVerificationNotSupported(workflowDefinition.maximumAllowedTime)
Expand All @@ -94,6 +95,7 @@ object TestFormulas extends StrictLogging {
_ <- validateLogs(metadata, submittedWorkflow, workflowDefinition)
_ = cromwellTracker.track(metadata)
_ <- validateDirectoryContentsCounts(workflowDefinition, submittedWorkflow, metadata)
_ <- if (checkCost) fetchAndValidateCost(workflowDefinition, submittedWorkflow) else Test.successful(())
} yield SubmitResponse(submittedWorkflow)

def runFailingWorkflowAndVerifyMetadata(
Expand All @@ -112,7 +114,8 @@ object TestFormulas extends StrictLogging {
} yield SubmitResponse(submittedWorkflow)

def runWorkflowTwiceExpectingCaching(
workflowDefinition: Workflow
workflowDefinition: Workflow,
checkCost: Boolean = false
)(implicit cromwellTracker: Option[CromwellTracker]): Test[SubmitResponse] =
for {
_ <- checkDescription(workflowDefinition, validityExpectation = Option(true))
Expand All @@ -128,6 +131,7 @@ object TestFormulas extends StrictLogging {
_ = cromwellTracker.track(metadata)
_ <- validateNoCacheMisses(secondWf, metadata, workflowDefinition)
_ <- validateDirectoryContentsCounts(workflowDefinition, secondWf, metadata)
_ <- if (checkCost) validateNoCost(secondWf) else Test.successful(())
} yield SubmitResponse(secondWf)

def runWorkflowThriceExpectingCaching(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ case class CentaurTestCase(workflow: Workflow,
def testFunction: Test[SubmitResponse] = this.testFormat match {
case WorkflowSuccessTest => TestFormulas.runSuccessfulWorkflowAndVerifyMetadata(workflow)
case WorkflowSuccessAndTimedOutputsTest => TestFormulas.runSuccessfulWorkflowAndVerifyTimeAndOutputs(workflow)
case WorkflowSuccessAndVerifyCostTest => TestFormulas.runSuccessfulWorkflowAndVerifyMetadata(workflow, true)
case WorkflowFailureTest => TestFormulas.runFailingWorkflowAndVerifyMetadata(workflow)
case RunTwiceExpectingCallCachingTest => TestFormulas.runWorkflowTwiceExpectingCaching(workflow)
case RunTwiceExpectingCallCachingNoCostTest => TestFormulas.runWorkflowTwiceExpectingCaching(workflow, true)
case RunThriceExpectingCallCachingTest => TestFormulas.runWorkflowThriceExpectingCaching(workflow)
case RunTwiceExpectingNoCallCachingTest => TestFormulas.runWorkflowTwiceExpectingNoCaching(workflow)
case RunFailingTwiceExpectingNoCallCachingTest => TestFormulas.runFailingWorkflowTwiceExpectingNoCaching(workflow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ sealed abstract class CentaurTestFormat(val name: String) {
def testSpecString: String = this match {
case WorkflowSuccessTest => "successfully run"
case WorkflowSuccessAndTimedOutputsTest => "successfully run"
case WorkflowSuccessAndVerifyCostTest => "successfully run and verify cost"
case WorkflowFailureTest => "fail during execution"
case RunTwiceExpectingCallCachingTest => "call cache the second run of"
case RunTwiceExpectingCallCachingNoCostTest => "call cache the second run and verify no cost of"
case RunThriceExpectingCallCachingTest => "call cache the third run of"
case RunTwiceExpectingNoCallCachingTest => "NOT call cache the second run of"
case RunFailingTwiceExpectingNoCallCachingTest => "Fail the first run and NOT call cache the second run of"
Expand Down Expand Up @@ -49,8 +51,10 @@ object CentaurTestFormat {

case object WorkflowSuccessTest extends CentaurTestFormat("WorkflowSuccess")
case object WorkflowSuccessAndTimedOutputsTest extends CentaurTestFormat("WorkflowSuccessAndTimedOutputs")
case object WorkflowSuccessAndVerifyCostTest extends CentaurTestFormat("WorkflowSuccessAndVerifyCost")
case object WorkflowFailureTest extends CentaurTestFormat("WorkflowFailure")
case object RunTwiceExpectingCallCachingTest extends CentaurTestFormat("RunTwiceExpectingCallCaching")
case object RunTwiceExpectingCallCachingNoCostTest extends CentaurTestFormat("RunTwiceExpectingCallCachingNoCost")
case object RunThriceExpectingCallCachingTest extends CentaurTestFormat(name = "RunThriceExpectingCallCaching")
case object RunTwiceExpectingNoCallCachingTest extends CentaurTestFormat("RunTwiceExpectingNoCallCaching")
case object RunFailingTwiceExpectingNoCallCachingTest
Expand Down Expand Up @@ -127,8 +131,10 @@ object CentaurTestFormat {
List(
WorkflowSuccessTest,
WorkflowSuccessAndTimedOutputsTest,
WorkflowSuccessAndVerifyCostTest,
WorkflowFailureTest,
RunTwiceExpectingCallCachingTest,
RunTwiceExpectingCallCachingNoCostTest,
RunThriceExpectingCallCachingTest,
RunTwiceExpectingNoCallCachingTest,
RunFailingTwiceExpectingNoCallCachingTest,
Expand Down
Loading
Loading