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

Return JSON of result with successful status request #197

Merged
merged 4 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/endpoint/FaabricEndpointHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ std::pair<int, std::string> FaabricEndpointHandler::handleFunction(
if (result.type() == faabric::Message_MessageType_EMPTY) {
response = std::make_pair(0, "RUNNING");
} else if (result.returnvalue() == 0) {
response = std::make_pair(0, "SUCCESS: " + result.outputdata());
response =
std::make_pair(0, faabric::util::messageToJson(result));
} else {
response = std::make_pair(1, "FAILED: " + result.outputdata());
}
Expand Down
7 changes: 5 additions & 2 deletions tests/test/endpoint/test_endpoint_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ TEST_CASE_METHOD(EndpointApiTestFixture,
submitGetRequestToUrl(LOCALHOST, port, statusBody);

REQUIRE(statusResultAfter.first == 200);
REQUIRE(statusResultAfter.second ==
fmt::format("SUCCESS: Finished async message {}", msg.id()));
faabric::Message resultMsg =
faabric::util::jsonToMessage(statusResultAfter.second);
REQUIRE(resultMsg.returnvalue() == 0);
REQUIRE(resultMsg.outputdata() ==
fmt::format("Finished async message {}", msg.id()));

endpoint.stop();

Expand Down
2 changes: 1 addition & 1 deletion tests/test/endpoint/test_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TEST_CASE_METHOD(EndpointHandlerTestFixture,
msg.set_returnvalue(0);
sch.setFunctionResult(msg);

expectedOutput = "SUCCESS: " + errorMsg;
expectedOutput = faabric::util::messageToJson(msg);
}

msg.set_isstatusrequest(true);
Expand Down
3 changes: 0 additions & 3 deletions thread-sanitizer-ignorelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ signal:*

# TODO: Remove: There's something weird going on with MPI code I don't understand
race:faabric::scheduler::MpiWorld::*

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also remove this from here as discussed offline with jakub (don't think it is worth tagging them here).

# Known Bug num. 1 in #189
race:faabric::transport::PointToPointGroup::*