@@ -638,8 +638,11 @@ def get_run(run_id):
638638 run : OpenMLRun
639639 Run corresponding to ID, fetched from the server.
640640 """
641- run_file = os .path .join (config .get_cache_directory (), "runs" ,
642- "run_%d.xml" % run_id )
641+ run_dir = os .path .join (config .get_cache_directory (), "runs" , str (run_id ))
642+ run_file = os .path .join (run_dir , "description.xml" )
643+
644+ if not os .path .exists (run_dir ):
645+ os .makedirs (run_dir )
643646
644647 try :
645648 return _get_cached_run (run_id )
@@ -667,7 +670,7 @@ def _create_run_from_xml(xml, from_server=True):
667670 run : OpenMLRun
668671 New run object representing run_xml.
669672 """
670-
673+
671674 def obtain_field (xml_obj , fieldname , from_server , cast = None ):
672675 # this function can be used to check whether a field is present in an object.
673676 # if it is not present, either returns None or throws an error (this is
@@ -694,7 +697,6 @@ def obtain_field(xml_obj, fieldname, from_server, cast=None):
694697 else :
695698 task_evaluation_measure = None
696699
697-
698700 flow_id = int (run ['oml:flow_id' ])
699701 flow_name = obtain_field (run , 'oml:flow_name' , from_server )
700702 setup_id = obtain_field (run , 'oml:setup_id' , from_server , cast = int )
@@ -872,10 +874,9 @@ def _create_trace_from_arff(arff_obj):
872874def _get_cached_run (run_id ):
873875 """Load a run from the cache."""
874876 cache_dir = config .get_cache_directory ()
875- run_cache_dir = os .path .join (cache_dir , "runs" )
877+ run_cache_dir = os .path .join (cache_dir , "runs" , str ( run_id ) )
876878 try :
877- run_file = os .path .join (run_cache_dir ,
878- "run_%d.xml" % int (run_id ))
879+ run_file = os .path .join (run_cache_dir , "description.xml" )
879880 with io .open (run_file , encoding = 'utf8' ) as fh :
880881 run = _create_run_from_xml (xml = fh .read ())
881882 return run
0 commit comments