1212DATAPATH=/path/to/models python cmd/main.py plot --target-data estimate --input /path/to/data/i3.metal/kepler_query.json --pipeline-name ec2 --energy-source rapl-sysfs --model-name LogarithmicRegressionTrainer_4 --output-type AbsPower --output i3metal-ec2 --feature-group BPFOnly
1313
1414example of export command:
15- DATAPATH=/path/to/models python cmd/main.py export --pipeline-name ec2 -o /path/to/kepler-model-db/models --publisher sunya-ch --zip=true --collect-date "July 2024"
15+ DATAPATH=/path/to/models python cmd/main.py export --pipeline-name ec2-0.7.11 -o /path/to/kepler-model-db/models --publisher sunya-ch --zip=true --collect-date "July 2024"
1616"""
1717
1818import os
4040from saver import save_json
4141from config import model_toppath
4242
43- node_profiles = ["m5zn.metal" , "c5d.metal" , "i3en.metal" , "m7i.metal-24xl" , "i3.metal" ]
43+ data_path = os .path .join (model_toppath , ".." , "data" )
44+
45+ node_profiles = ["m5.metal" , "i3.metal" , "c5.metal" , "r5.metal" , "m5zn.metal" , "m7i.metal-24xl" ]
4446node_image = "ami-0e4d0bb9670ea8db0"
4547
4648import boto3
49+ last_modified = None
4750
4851aws_access_key_id = os .environ ["AWS_ACCESS_KEY_ID" ]
4952aws_secret_access_key = os .environ ["AWS_SECRET_ACCESS_KEY" ]
5659def read_response_in_json (key ):
5760 print (key )
5861 response = s3 .get_object (Bucket = bucket_name , Key = key )
59- last_modified_str = response ['LastModified' ]
60- print ("{} last modified time: {}" .format (key , last_modified_str ))
62+ global last_modified
63+ last_modified = response ['LastModified' ]
64+ print ("{} last modified time: {}" .format (key , last_modified ))
6165 return json .loads (response ['Body' ].read ().decode ('utf-8' ))
6266
6367class Ec2PipelineRun ():
@@ -77,15 +81,15 @@ def process(self):
7781 spec_json = read_response_in_json (spec_key )
7882
7983 # save raw data from response in local path models/../data/<instance profile>
80- profile_datapath = os .path .join (model_toppath , ".." , "data" , profile )
84+ profile_datapath = os .path .join (data_path , profile )
8185 os .makedirs (profile_datapath , exist_ok = True )
8286 save_json (path = profile_datapath , name = "kepler_query.json" , data = query_response )
83- save_json (path = profile_datapath , name = machine_spec_filename , data = spec_json )
87+ machine_spec_path = os .path .join (profile_datapath , "machine_spec" )
88+ save_json (path = machine_spec_path , name = machine_spec_filename , data = spec_json )
8489
8590 # process pipeline
86- spec = NodeTypeSpec (** spec_json ['attrs' ])
87- spec .attrs [NodeAttribute .MEMORY ] = unknown
88- spec .attrs [NodeAttribute .FREQ ] = unknown
91+ spec = NodeTypeSpec ()
92+ spec .load (spec_json )
8993 node_type = self .pipeline .node_collection .index_train_machine (machine_id , spec )
9094 query_results = prom_responses_to_results (query_response )
9195 query_results [node_info_column ] = node_type
@@ -101,8 +105,14 @@ def archive_pipeline(self):
101105 self .pipeline .archive_pipeline ()
102106
103107if __name__ == "__main__" :
104- pipeline_name = "ec2"
108+ pipeline_name = "ec2-0.7.11 "
105109 pipelinerun = Ec2PipelineRun (name = pipeline_name )
106110 pipelinerun .process ()
107111 pipelinerun .save_metadata ()
108- pipelinerun .archive_pipeline ()
112+ pipelinerun .archive_pipeline ()
113+ print ("Collection time:" , last_modified )
114+ item = dict ()
115+ item ["startTimeUTC" ] = last_modified .strftime ("%Y-%m-%dT%H:%M:%SZ" )
116+ item ["endTimeUTC" ] = last_modified .strftime ("%Y-%m-%dT%H:%M:%SZ" )
117+ print (item )
118+ save_json (path = data_path , name = pipeline_name , data = item )
0 commit comments