diff --git a/src/vt/vrt/collection/balance/lb_data_holder.cc b/src/vt/vrt/collection/balance/lb_data_holder.cc index fdc1487606..5ed8b917c0 100644 --- a/src/vt/vrt/collection/balance/lb_data_holder.cc +++ b/src/vt/vrt/collection/balance/lb_data_holder.cc @@ -147,7 +147,7 @@ std::unique_ptr 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() ); diff --git a/tests/unit/collection/test_lb_data_holder.cc b/tests/unit/collection/test_lb_data_holder.cc index 8bee8042cb..d13f51fc6b 100644 --- a/tests/unit/collection/test_lb_data_holder.cc +++ b/tests/unit/collection/test_lb_data_holder.cc @@ -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)*/