Skip to content

Commit

Permalink
experiments on #1287 - cleanup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed Feb 3, 2025
1 parent 93ec0cb commit 2b78cd9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion otoroshi/app/next/workflow/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ case class WorkflowResult(returned: Option[JsValue], error: Option[WorkflowError
"error" -> error.map(_.json).getOrElse(JsNull).asValue,
"run" -> run.json
)
def lightJson: JsValue = Json.obj(
"returned" -> returned,
"error" -> error.map(_.json).getOrElse(JsNull).asValue,
"run" -> run.lightJson
)
}

case class WorkflowError(message: String, details: Option[JsObject], exception: Option[Throwable]) {
Expand Down Expand Up @@ -85,8 +90,9 @@ case class WorkflowRun(id: String) {
def json: JsValue = Json.obj(
"id" -> id,
"memory" -> memory.json,
// "log" -> runlog.json,
"log" -> runlog.json,
)
def lightJson: JsValue = json.asObject - "log"
}

trait WorkflowFunction {
Expand Down
2 changes: 1 addition & 1 deletion otoroshi/app/next/workflow/test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object WorkflowTest {
val node = Node.from(workflow)
Files.writeString(new File("./workflow_test.json").toPath, workflow.prettify)
engine.run(node, Json.obj("foo" -> Json.obj("bar" -> "qix"))).map { res =>
println(s"result: ${res.json.prettify}")
println(s"result: ${res.lightJson.prettify}")
}
}
}

0 comments on commit 2b78cd9

Please sign in to comment.