@@ -832,7 +832,7 @@ def get_runs_list(self, task_id=None, flow_id=None, setup_id=None):
832832 Returns
833833 -------
834834 list
835- A list of all runs run IDs for a given ID.
835+ A list of all runs for a given ID.
836836 """
837837 test = [task_id is None , flow_id is None , setup_id is None ]
838838 if np .nansum (test ) != 2 :
@@ -843,7 +843,7 @@ def get_runs_list(self, task_id=None, flow_id=None, setup_id=None):
843843 if task_id is not None :
844844 call += "?task_id=%d" % task_id
845845 elif flow_id is not None :
846- call += "?implementation_id =%d" % flow_id
846+ call += "?flow_id =%d" % flow_id
847847 elif setup_id is not None :
848848 call += "?setup_id=%d" % setup_id
849849
@@ -865,8 +865,9 @@ def get_runs_list(self, task_id=None, flow_id=None, setup_id=None):
865865 run = {'run_id' : int (runs_ ['oml:run_id' ]),
866866 'task_id' : int (runs_ ['oml:task_id' ]),
867867 'setup_id' : int (runs_ ['oml:setup_id' ]),
868- 'implementation_id' : int (runs_ ['oml:implementation_id' ]),
869- 'uploader' : int (runs_ ['oml:uploader' ])}
868+ 'flow_id' : int (runs_ ['oml:flow_id' ]),
869+ 'uploader' : int (runs_ ['oml:uploader' ]),
870+ 'error_message' : runs_ ['oml:error_message' ]}
870871
871872 runs .append (run )
872873 runs .sort (key = lambda t : t ['run_id' ])
@@ -956,10 +957,46 @@ def _create_run_from_xml(self, xml):
956957
957958 return OpenMLRun (
958959 dic [u"oml:run_id" ], dic [u"oml:uploader" ],
959- dic [u"oml:task_id" ], dic [u"oml:implementation_id " ],
960+ dic [u"oml:task_id" ], dic [u"oml:flow_id " ],
960961 dic [u"oml:setup_string" ], dic [u'oml:setup_id' ],
961962 tags , datasets , files , evaluations )
962963
964+ ############################################################################
965+ # Flows
966+ def get_flow_list (self ):
967+ """Return a list of all flows on OpenML.
968+
969+ Returns
970+ -------
971+ list
972+ A list of all flows.
973+ """
974+ return_code , xml_string = self ._perform_api_call ("/flow/list" )
975+ datasets_dict = xmltodict .parse (xml_string )
976+
977+ if isinstance (datasets_dict ['oml:flows' ]['oml:flow' ], dict ):
978+ flows = [datasets_dict ['oml:implementations' ]['oml:implementation' ]]
979+ else :
980+ # Minimalistic check if the XML is useful
981+ assert type (datasets_dict ['oml:flows' ]['oml:flow' ]) == list , \
982+ type (datasets_dict ['oml:flows' ]['oml:flow' ])
983+ assert datasets_dict ['oml:flows' ]['@xmlns:oml' ] == \
984+ 'http://openml.org/openml'
985+
986+ flows = []
987+ for flow_ in datasets_dict ['oml:flows' ]['oml:flow' ]:
988+ flow = {'id' : int (flow_ ['oml:id' ]),
989+ 'full_name' : flow_ ['oml:full_name' ],
990+ 'name' : flow_ ['oml:name' ],
991+ 'version' : flow_ ['oml:version' ],
992+ 'external_version' : flow_ ['oml:external_version' ],
993+ 'uploader' : int (flow_ ['oml:uploader' ])}
994+
995+ flows .append (flow )
996+ flows .sort (key = lambda t : t ['id' ])
997+
998+ return flows
999+
9631000 ############################################################################
9641001 # Internal stuff
9651002 def _perform_api_call (self , call , data = None , file_path = None ):
0 commit comments