@@ -82,7 +82,10 @@ ArcDescriptor CpuCostModel::ResourceNodeToResourceNode(
8282}
8383
8484ArcDescriptor CpuCostModel::LeafResourceNodeToSink (ResourceID_t resource_id) {
85- return ArcDescriptor (0LL , FLAGS_max_tasks_per_pu, 0ULL );
85+ // ResourceID_t machine_res_id = MachineResIDForResource(resource_id);
86+ ResourceStatus* rs = FindPtrOrNull (*resource_map_, resource_id);
87+ ResourceTopologyNodeDescriptor* rtnd = rs->mutable_topology_node ();
88+ return ArcDescriptor (0LL , rtnd->resource_desc ().num_slots_below (), 0ULL );
8689}
8790
8891ArcDescriptor CpuCostModel::TaskContinuation (TaskID_t task_id) {
@@ -822,7 +825,7 @@ void CpuCostModel::AddMachine(ResourceTopologyNodeDescriptor* rtnd_ptr) {
822825 CHECK (rd.type () == ResourceDescriptor::RESOURCE_MACHINE);
823826 ResourceID_t res_id = ResourceIDFromString (rd.uuid ());
824827 vector<EquivClass_t> machine_ecs;
825- for (uint64_t index = 0 ; index < FLAGS_max_multi_arcs_for_cpu ; ++index) {
828+ for (uint64_t index = 0 ; index < rd. max_pods () ; ++index) {
826829 EquivClass_t multi_machine_ec = GetMachineEC (rd.friendly_name (), index);
827830 machine_ecs.push_back (multi_machine_ec);
828831 CHECK (InsertIfNotPresent (&ec_to_index_, multi_machine_ec, index));
@@ -898,7 +901,9 @@ FlowGraphNode* CpuCostModel::GatherStats(FlowGraphNode* accumulator,
898901 }
899902 // Running/idle task count
900903 rd_ptr->set_num_running_tasks_below (rd_ptr->current_running_tasks_size ());
901- rd_ptr->set_num_slots_below (FLAGS_max_tasks_per_pu);
904+ ResourceStatus* m_rs = FindPtrOrNull (*resource_map_, machine_res_id);
905+ ResourceTopologyNodeDescriptor* m_rtnd = m_rs->mutable_topology_node ();
906+ rd_ptr->set_num_slots_below (m_rtnd->resource_desc ().max_pods ());
902907 return accumulator;
903908 }
904909 } else if (accumulator->type_ == FlowNodeType::MACHINE) {
0 commit comments