5353
5454
5555class ModelRequest :
56- def __init__ (self , metrics , output_type , source = "rapl-sysfs" , node_type = - 1 , weight = False , trainer_name = "" , filter = "" , pipeline_name = "" , spec = None , loose_node_type = True ):
56+ def __init__ (self , metrics , output_type , source = "rapl-sysfs" , node_type = - 1 , weight = False , trainer_name = "" , filter = "" , pipeline_name = "" , machine_spec = None , loose_node_type = True ):
5757 # target source of power metric to be predicted (e.g., rapl-sysfs, acpi)
5858 self .source = convert_enery_source (source )
5959 # type of node to select a model learned from similar nodes (default: -1, applied universal model learned by all node_type (TODO))
@@ -71,9 +71,9 @@ def __init__(self, metrics, output_type, source="rapl-sysfs", node_type=-1, weig
7171 # specific pipeline (default: empty, selecting default pipeline)
7272 self .pipeline_name = pipeline_name
7373 # spec of requesting node to determine node_type
74- self .spec = NodeTypeSpec ()
75- if spec is not None :
76- self .spec = NodeTypeSpec (** spec )
74+ self .machine_spec = NodeTypeSpec ()
75+ if machine_spec is not None :
76+ self .machine_spec = NodeTypeSpec (** machine_spec )
7777 self .loose_node_type = loose_node_type
7878
7979# ModelListParams defines parameters for /best-models API
@@ -194,13 +194,13 @@ def get_model():
194194 pipeline_name = pipelineName [energy_source ]
195195 valid_group_path = get_model_group_path (model_toppath , output_type , fg , energy_source , pipeline_name = pipelineName [energy_source ])
196196 node_type = req .node_type
197- if req .node_type == any_node_type and req .spec is not None and not req .spec .is_none () and pipeline_name in nodeCollection :
198- node_type , uncertainty , looseness = nodeCollection [pipeline_name ].get_node_type (req .spec , loose_search = True )
197+ if req .node_type == any_node_type and req .machine_spec is not None and not req .machine_spec .is_none () and pipeline_name in nodeCollection :
198+ node_type , uncertainty , looseness = nodeCollection [pipeline_name ].get_node_type (req .machine_spec , loose_search = True )
199199 else :
200200 uncertainty = 0
201201 looseness = 0
202202 if os .path .exists (valid_group_path ):
203- best_candidate , response = select_best_model (req .spec , valid_group_path , filters , energy_source , req .pipeline_name , req .trainer_name , node_type , req .weight , loose_node_type = req .loose_node_type )
203+ best_candidate , response = select_best_model (req .machine_spec , valid_group_path , filters , energy_source , req .pipeline_name , req .trainer_name , node_type , req .weight , loose_node_type = req .loose_node_type )
204204 if best_candidate is None :
205205 continue
206206 if node_type != any_node_type and best_model is not None and get_node_type_from_name (best_model ['model_name' ]) == node_type :
0 commit comments