Fix ActionCommand Exception
Currently, the ActionComands are always throwing a ActionCommandFailedException exception.
File: theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt
private fun getExitCode(errChannelStream: ByteArrayOutputStream): Int {
val status: Status?
try {
status = Serialization.unmarshal(errChannelStream.toString(), Status::class.java)
} catch (e: Exception) {
throw ActionCommandFailedException("Could not determine the exit code, no information given")
}
if (status == null) {
throw ActionCommandFailedException("Could not determine the exit code, no information given")
}
return if (status.status.equals("Success")) {
0
} else status.details.causes.stream()
.filter { it.reason.equals("ExitCode") }
.map { it.message }
.findFirst()
.orElseThrow {
ActionCommandFailedException("Status is not SUCCESS but contains no exit code - Status: $status")
}.toInt()
}
Problem: Sometimes the commands do not contain sucess but still succeed. This for example leads to status code 1 != 0 -> exception Also status.details is null if real problem is there and therefore a null pointer exception is thrown.
Additional: More logging would be nice. It is not always easy to check if the commands are actually executed or not.
Quick Fix: use status.code (I think they use http codes?: succes = 200 )
return if (status.status.equals("Success")) {
0
} else {
return status.code
}
I will upload the samaza uc2 benchmark operator in order to make this testable.