Skip to content

Commit

Permalink
Suppress scary stack traces when actor crashes are being handled prop…
Browse files Browse the repository at this point in the history
…erly. [force ci] (broadinstitute#4984)
  • Loading branch information
mcovarr authored May 22, 2019
1 parent 3fd870f commit 765d4e9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import cromwell.core.Dispatcher
import cromwell.services.keyvalue.KeyValueServiceActor._

import scala.concurrent.{Future, Promise}
import scala.util.control.NoStackTrace

trait StandardSyncExecutionActorParams extends StandardJobExecutionActorParams {
/** The class for creating an async backend. */
Expand Down Expand Up @@ -180,7 +181,7 @@ class StandardSyncExecutionActor(val standardParams: StandardSyncExecutionActorP
def jobFailingDecider: Decider = {
case exception: Exception =>
completionPromise.tryFailure(
new RuntimeException(s"${createAsyncRefName()} failed and didn't catch its exception.", exception))
new RuntimeException(s"${createAsyncRefName()} failed and didn't catch its exception. This condition has been handled and the job will be marked as failed.", exception) with NoStackTrace)
Stop
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import wom.expression.WomExpression
import wom.types.WomType
import wom.values.WomValue

import scala.util.control.NoStackTrace

final case class ValidatedRuntimeAttributes(attributes: Map[String, Any])

/**
Expand Down Expand Up @@ -59,7 +61,7 @@ trait ValidatedRuntimeAttributesBuilder {
val runtimeAttributesErrorOr: ErrorOr[ValidatedRuntimeAttributes] = validate(attrs)
runtimeAttributesErrorOr match {
case Valid(runtimeAttributes) => runtimeAttributes
case Invalid(nel) => throw new RuntimeException with MessageAggregation {
case Invalid(nel) => throw new RuntimeException with MessageAggregation with NoStackTrace {
override def exceptionContext: String = "Runtime attribute validation failed"

override def errorMessages: Traversable[String] = nel.toList
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: papi_fail_on_bad_attrs
testFormat: workflowfailure
backends: [Papi] # Only PAPI should object to the malformed disk attribute

files {
workflow: papi_fail_on_bad_attrs/papi_fail_on_bad_attrs.wdl
}

metadata {
workflowName: papi_fail_on_bad_attrs
status: Failed
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version 1.0

task hello {
input {
String addressee
}
command {
echo "Hello ${addressee}!"
}
output {
String salutation = read_string(stdout())
}
runtime {
docker: "ubuntu:latest"
disks: "10 HDD" # This disk specification string is malformed but Cromwell should handle that gracefully (i.e. fail not hang).
}
}

workflow papi_fail_on_bad_attrs {
call hello { input: addressee = "you" }
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AwsBatchJobExecutionActorSpec extends TestKitSuite("AwsBatchJobExecutionAc

parent.expectMsgPF(max = TimeoutDuration) {
case JobFailedNonRetryableResponse(_, throwable, _) =>
throwable.getMessage should be("AwsBatchAsyncBackendJobExecutionActor failed and didn't catch its exception.")
throwable.getMessage should be("AwsBatchAsyncBackendJobExecutionActor failed and didn't catch its exception. This condition has been handled and the job will be marked as failed.")
}
}

Expand Down Expand Up @@ -128,7 +128,7 @@ class AwsBatchJobExecutionActorSpec extends TestKitSuite("AwsBatchJobExecutionAc

parent.expectMsgPF(max = TimeoutDuration) {
case JobFailedNonRetryableResponse(_, throwable, _) =>
throwable.getMessage should be("AwsBatchAsyncBackendJobExecutionActor failed and didn't catch its exception.")
throwable.getMessage should be("AwsBatchAsyncBackendJobExecutionActor failed and didn't catch its exception. This condition has been handled and the job will be marked as failed.")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PipelinesApiJobExecutionActorSpec extends TestKitSuite("PipelinesApiJobExe

parent.expectMsgPF(max = TimeoutDuration) {
case JobFailedNonRetryableResponse(_, throwable, _) =>
throwable.getMessage should be("PipelinesApiAsyncBackendJobExecutionActor failed and didn't catch its exception.")
throwable.getMessage should be("PipelinesApiAsyncBackendJobExecutionActor failed and didn't catch its exception. This condition has been handled and the job will be marked as failed.")
}
}

Expand Down Expand Up @@ -97,7 +97,7 @@ class PipelinesApiJobExecutionActorSpec extends TestKitSuite("PipelinesApiJobExe

parent.expectMsgPF(max = TimeoutDuration) {
case JobFailedNonRetryableResponse(_, throwable, _) =>
throwable.getMessage should be("PipelinesApiAsyncBackendJobExecutionActor failed and didn't catch its exception.")
throwable.getMessage should be("PipelinesApiAsyncBackendJobExecutionActor failed and didn't catch its exception. This condition has been handled and the job will be marked as failed.")
}
}
}
Expand Down

0 comments on commit 765d4e9

Please sign in to comment.