Skip to content

Commit

Permalink
Merge pull request #2311 from DARMA-tasking/2307-fix-invalid-time-for…
Browse files Browse the repository at this point in the history
…mat-in-lbdatafile

#2307: Fix invalid `time` format in LBDatafile
  • Loading branch information
lifflander authored Jun 28, 2024
2 parents 3638817 + 83bea28 commit 07d404e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/balance/lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ std::unique_ptr<nlohmann::json> LBDataHolder::rankAttributesToJson() const {
void LBDataHolder::addInitialTask(nlohmann::json& j, std::size_t n) const {
j["tasks"][n]["resource"] = "cpu";
j["tasks"][n]["node"] = vt::theContext()->getNode();
j["tasks"][n]["time"] = 0;
j["tasks"][n]["time"] = 0.0;
outputEntity(
j["tasks"][n]["entity"], ElementIDStruct()
);
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/collection/test_lb_data_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,23 @@ TEST_F(TestLBDataHolder, test_lb_entity_attributes) {
EXPECT_EQ("abc", (*outJsonPtr)["tasks"][0]["attributes"]["stringSample"]);
}

TEST_F(TestLBDataHolder, test_default_time_format) {
using LBDataHolder = vt::vrt::collection::balance::LBDataHolder;

nlohmann::json json;
json["metadata"]["type"] = "LBDatafile";

addPhasesDataToJson(json, num_phases, {});

LBDataHolder testObj(json);
auto outJsonPtr = testObj.toJson(0);
ASSERT_TRUE(outJsonPtr != nullptr);

for (auto& task: (*outJsonPtr)["tasks"]) {
EXPECT_EQ(true, task["time"].is_number_float());
}
}

}}}} // end namespace vt::tests::unit::lb

#endif /*vt_check_enabled(lblite)*/

0 comments on commit 07d404e

Please sign in to comment.