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

fix: improve tolerance for error handling multivariate anomaly detection #1991

Merged
merged 5 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ object MADUtils extends Logging {
val modelStatus = modelInfo("status").asInstanceOf[JsString].value.toLowerCase
modelStatus match {
case "failed" =>
val errors = modelInfo("errors").convertTo[Seq[DMAError]].toJson.compactPrint
val errors = modelInfo("errors").toJson.compactPrint
throw new RuntimeException(s"Caught errors during fitting: $errors")
case "created" | "running" =>
throw new RuntimeException(s"model $modelId is not ready yet")
Expand Down Expand Up @@ -258,7 +258,6 @@ trait MADHttpRequest extends HasURL with HasSubscriptionKey with HasAsyncReply {
}
} else {
val error = IOUtils.toString(response.entity.get.content, "UTF-8")
.parseJson.convertTo[DMAError].toJson.compactPrint
throw new RuntimeException(s"Caught error: $error")
}
}
Expand Down Expand Up @@ -514,7 +513,7 @@ class SimpleFitMultivariateAnomaly(override val uid: String) extends Estimator[S
val modelId = response("modelId").convertTo[String]

if (modelInfo("status").asInstanceOf[JsString].value.toLowerCase() == "failed") {
val errors = modelInfo("errors").convertTo[Seq[DMAError]].toJson.compactPrint
val errors = modelInfo("errors").toJson.compactPrint
throw new RuntimeException(s"Caught errors during fitting: $errors")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ case class DMASummary(status: String,

object DMAError extends SparkBindings[DMAError]

case class DMAError(code: String, message: String)
case class DMAError(code: Option[String], message: Option[String])
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this is unused can you remove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's still used in DMASummary


case class DMAVariableState(variable: Option[String],
filledNARatio: Option[Double],
Expand Down