Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi77Qi committed Apr 24, 2020
1 parent 32c26e5 commit 705e070
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import org.broadinstitute.dsde.workbench.model.google.{parseGcsPath, EmailGcsEnt
import org.broadinstitute.dsde.workbench.service.Sam

import org.scalatest.tagobjects.Retryable
import org.scalatest.time.{Seconds, Span}
import org.scalatest.{DoNotDiscover, ParallelTestExecution}

import scala.concurrent.duration._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object GceMonitorState {
}

final case class MonitorContext(start: Instant, runtimeId: Long, traceId: TraceId) {
override def toString: String = s"runtimeId(${runtimeId}), traceId(${traceId.asString}))"
override def toString: String = s"${runtimeId}/${traceId.asString}"
}

final case class GceMonitorConfig(initialDelay: FiniteDuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,14 @@ class GceRuntimeMonitorInterp[F[_]: Timer: Parallel](
case Some(x) =>
logger
.info(
s"Runtime ${runtimeAndRuntimeConfig.runtime.projectNameString}'s tools(${toolsToCheck}) is not ready yet and has taken ${timeElapsed.toSeconds} seconds so far. Checking again in ${config.pollingInterval}. ${message
s"${monitorContext} | Runtime ${runtimeAndRuntimeConfig.runtime.projectNameString}'s tools(${toolsToCheck}) is not ready yet and has taken ${timeElapsed.toSeconds} seconds so far. Checking again in ${config.pollingInterval}. ${message
.getOrElse("")}"
)
.as(((), Some(CheckTools(x, runtimeAndRuntimeConfig, toolsToCheck))))
case None =>
logger
.info(
s"Runtime ${runtimeAndRuntimeConfig.runtime.projectNameString} is not in final state yet and has taken ${timeElapsed.toSeconds} seconds so far. Checking again in ${config.pollingInterval}. ${message
s"${monitorContext} | Runtime ${runtimeAndRuntimeConfig.runtime.projectNameString} is not in final state yet and has taken ${timeElapsed.toSeconds} seconds so far. Checking again in ${config.pollingInterval}. ${message
.getOrElse("")}"
)
.as(((), Some(Check(runtimeAndRuntimeConfig))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import org.broadinstitute.dsde.workbench.leonardo.monitor.LeoPubsubMessage._
import org.broadinstitute.dsde.workbench.leonardo.util._
import org.broadinstitute.dsde.workbench.model.google.{GcsObjectName, GcsPath}
import org.broadinstitute.dsde.workbench.model.{ErrorReport, TraceId, WorkbenchException}

import cats.effect.implicits._

import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -219,12 +219,14 @@ class LeoPubsubMessageSubscriber[F[_]: Timer: ContextShift](
_ <- logger.error(e)(s"Failed to create runtime ${msg.runtimeProjectAndName} in Google")
errorMessage = e match {
case leoEx: LeoException =>
ErrorReport.loggableString(leoEx.toErrorReport)
Some(ErrorReport.loggableString(leoEx.toErrorReport))
case ee: com.google.api.gax.rpc.AbortedException if ee.getStatusCode().getCode == 409 && ee.getMessage().contains("already exists") =>
None //this could happen when pubsub redelivers an event unexpectedly
case _ =>
s"Failed to create cluster ${msg.runtimeProjectAndName} due to ${e.getMessage}"
Some(s"Failed to create cluster ${msg.runtimeProjectAndName} due to ${e.getMessage}")
}
_ <- (clusterErrorQuery.save(msg.runtimeId, RuntimeError(errorMessage, -1, now)) >>
clusterQuery.updateClusterStatus(msg.runtimeId, RuntimeStatus.Error, now)).transaction[F]
_ <- errorMessage.traverse(m => (clusterErrorQuery.save(msg.runtimeId, RuntimeError(m, -1, now)) >>
clusterQuery.updateClusterStatus(msg.runtimeId, RuntimeStatus.Error, now)).transaction[F])
} yield ()
}
}
Expand Down

0 comments on commit 705e070

Please sign in to comment.