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

proto: refactor timestamp to starttimestamp #371

Merged
merged 1 commit into from
Feb 7, 2024
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
2 changes: 1 addition & 1 deletion src/proto/faabric.proto
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ message Message {

string snapshotKey = 12;

int64 timestamp = 14 [json_name = "start_ts"];
int64 startTimestamp = 14 [json_name = "start_ts"];
string resultKey = 15;
bool executesLocally = 16;
string statusKey = 17;
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/FunctionCallServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void FunctionCallServer::recvExecuteFunctions(std::span<const uint8_t> buffer)

// This host has now been told to execute these functions no matter what
for (int i = 0; i < parsedMsg.messages_size(); i++) {
parsedMsg.mutable_messages()->at(i).set_timestamp(
parsedMsg.mutable_messages()->at(i).set_starttimestamp(
faabric::util::getGlobalClock().epochMillis());
parsedMsg.mutable_messages()->at(i).set_executedhost(
faabric::util::getSystemConfig().endpointHost);
Expand Down
4 changes: 2 additions & 2 deletions src/util/func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ unsigned int setMessageId(faabric::Message& msg)
}

// Set the timestamp if it doesn't have one
if (msg.timestamp() <= 0) {
if (msg.starttimestamp() <= 0) {
Clock& clock = faabric::util::getGlobalClock();
msg.set_timestamp(clock.epochMillis());
msg.set_starttimestamp(clock.epochMillis());
}

std::string resultKey = resultKeyFromMessageId(messageId);
Expand Down
2 changes: 1 addition & 1 deletion tests/test/planner/test_planner_endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ TEST_CASE_METHOD(PlannerEndpointExecTestFixture,
// If the request is succesful, check that the response has the fields
// we expect
if (expectedReturnCode == beast::http::status::ok) {
REQUIRE(msgResult.timestamp() > 0);
REQUIRE(msgResult.starttimestamp() > 0);
REQUIRE(msgResult.finishtimestamp() > 0);
REQUIRE(!msgResult.executedhost().empty());
REQUIRE(!msgResult.mainhost().empty());
Expand Down
6 changes: 3 additions & 3 deletions tests/test/util/test_exec_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test MPI execution graph", "[scheduler]")
for (int rank = 0; rank < worldSize; rank++) {
messages.at(rank) = faabric::util::messageFactory("mpi", "hellompi");
messages.at(rank).set_id(0);
messages.at(rank).set_timestamp(0);
messages.at(rank).set_starttimestamp(0);
messages.at(rank).set_finishtimestamp(0);
messages.at(rank).set_resultkey("");
messages.at(rank).set_statuskey("");
Expand Down Expand Up @@ -190,14 +190,14 @@ TEST_CASE_METHOD(MpiBaseTestFixture, "Test MPI execution graph", "[scheduler]")
// Unset the fields that we can't recreate
actual.rootNode.msg.set_id(0);
actual.rootNode.msg.set_finishtimestamp(0);
actual.rootNode.msg.set_timestamp(0);
actual.rootNode.msg.set_starttimestamp(0);
actual.rootNode.msg.set_resultkey("");
actual.rootNode.msg.set_statuskey("");
actual.rootNode.msg.set_outputdata("");
for (auto& node : actual.rootNode.children) {
node.msg.set_id(0);
node.msg.set_finishtimestamp(0);
node.msg.set_timestamp(0);
node.msg.set_starttimestamp(0);
node.msg.set_resultkey("");
node.msg.set_statuskey("");
node.msg.set_outputdata("");
Expand Down
10 changes: 5 additions & 5 deletions tests/test/util/test_func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ TEST_CASE("Test timestamp added to message")
SECTION("Existing timestamp")
{
long expectedTimestamp = 999888;
msg.set_timestamp(expectedTimestamp);
msg.set_starttimestamp(expectedTimestamp);

faabric::util::setMessageId(msg);
REQUIRE(msg.timestamp() == expectedTimestamp);
REQUIRE(msg.starttimestamp() == expectedTimestamp);
}

SECTION("Zero existing timestamp")
{
msg.set_timestamp(0);
msg.set_starttimestamp(0);
faabric::util::setMessageId(msg);
REQUIRE(msg.timestamp() > baselineTimestamp);
REQUIRE(msg.starttimestamp() > baselineTimestamp);
}

SECTION("No existing timestamp")
{
faabric::util::setMessageId(msg);
REQUIRE(msg.timestamp() > baselineTimestamp);
REQUIRE(msg.starttimestamp() > baselineTimestamp);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test/util/test_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class JsonTestFixture
faabric::util::setMessageId(msg);

REQUIRE(msg.id() > 0);
REQUIRE(msg.timestamp() > 0);
REQUIRE(msg.starttimestamp() > 0);
}

protected:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/message_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void checkMessageEquality(const faabric::Message& msgA,
REQUIRE(msgA.function() == msgB.function());
REQUIRE(msgA.executedhost() == msgB.executedhost());

REQUIRE(msgA.timestamp() == msgB.timestamp());
REQUIRE(msgA.starttimestamp() == msgB.starttimestamp());
REQUIRE(msgA.snapshotkey() == msgB.snapshotkey());
REQUIRE(msgA.funcptr() == msgB.funcptr());

Expand Down
Loading