@@ -1853,7 +1853,6 @@ void MinLoadFirst::CalculateNodeSelectionInfoOfPartition_(
1853
1853
// Sort all running task in this node by ending time.
1854
1854
std::vector<std::pair<absl::Time, uint32_t >> end_time_task_id_vec;
1855
1855
1856
- std::vector<std::string> running_task_ids_str;
1857
1856
for (const auto & [task_id, res] : craned_meta->running_task_resource_map ) {
1858
1857
const auto & task = running_tasks.at (task_id);
1859
1858
@@ -1867,8 +1866,14 @@ void MinLoadFirst::CalculateNodeSelectionInfoOfPartition_(
1867
1866
absl::Time end_time = std::max (task->StartTime () + task->time_limit ,
1868
1867
now + absl::Seconds (1 ));
1869
1868
end_time_task_id_vec.emplace_back (end_time, task_id);
1869
+ }
1870
1870
1871
- running_task_ids_str.emplace_back (std::to_string (task_id));
1871
+ if constexpr (kAlgoTraceOutput ) {
1872
+ std::string running_task_ids_str;
1873
+ for (const auto & [end_time, task_id] : end_time_task_id_vec)
1874
+ running_task_ids_str.append (fmt::format (" {}, " , task_id));
1875
+ CRANE_TRACE (" Craned node {} has running tasks: {}" , craned_id,
1876
+ running_task_ids_str);
1872
1877
}
1873
1878
1874
1879
std::sort (
@@ -1888,8 +1893,8 @@ void MinLoadFirst::CalculateNodeSelectionInfoOfPartition_(
1888
1893
}
1889
1894
}
1890
1895
1891
- // Calculate delta resources at [now, first task end,
1892
- // second task end, ...] in this node.
1896
+ // Calculate how many resources are available at [now, first task end,
1897
+ // second task end, ...] in this node.
1893
1898
auto & time_avail_res_map =
1894
1899
node_selection_info_ref.node_time_avail_res_map [craned_id];
1895
1900
node_selection_info_ref.node_res_total_map [craned_id] =
@@ -1927,6 +1932,16 @@ void MinLoadFirst::CalculateNodeSelectionInfoOfPartition_(
1927
1932
*/
1928
1933
std::tie (cur_time_iter, ok) =
1929
1934
time_avail_res_map.emplace (end_time, cur_time_iter->second );
1935
+
1936
+ if constexpr (kAlgoTraceOutput ) {
1937
+ CRANE_TRACE (
1938
+ " Insert duration [now+{}s, inf) with resource: "
1939
+ " cpu: {}, mem: {}, gres: {}" ,
1940
+ absl::ToInt64Seconds (end_time - now),
1941
+ craned_meta->res_avail .allocatable_res .cpu_count ,
1942
+ craned_meta->res_avail .allocatable_res .memory_bytes ,
1943
+ util::ReadableDresInNode (craned_meta->res_avail ));
1944
+ }
1930
1945
}
1931
1946
1932
1947
/* *
@@ -2454,8 +2469,7 @@ CraneErr TaskScheduler::AcquireTaskAttributes(TaskInCtld* task) {
2454
2469
task_mem_per_cpu = part_meta.default_mem_per_cpu ;
2455
2470
} else if (part_meta.max_mem_per_cpu != 0 ) {
2456
2471
// If a task sets its memory bytes,
2457
- // check if memory/core ratio is greater than the partition's maximum
2458
- // value.
2472
+ // check if memory/core ratio is greater than the partition's maximum value.
2459
2473
task_mem_per_cpu =
2460
2474
std::min (task_mem_per_cpu, (double )part_meta.max_mem_per_cpu );
2461
2475
}
0 commit comments