@@ -78,22 +78,22 @@ def run_model_on_task(
7878 Flow generated from the model.
7979 """
8080
81- extension = get_extension_by_model (model , raise_if_no_extension = True )
82- if extension is None :
83- # This should never happen and is only here to please mypy will be gone soon once the
84- # whole function is removed
85- raise TypeError (extension )
86-
8781 # TODO: At some point in the future do not allow for arguments in old order (6-2018).
8882 # Flexibility currently still allowed due to code-snippet in OpenML100 paper (3-2019).
8983 # When removing this please also remove the method `is_estimator` from the extension
9084 # interface as it is only used here (MF, 3-2019)
91- if isinstance (model , OpenMLTask ) and extension . is_estimator ( model ) :
85+ if isinstance (model , OpenMLTask ):
9286 warnings .warn ("The old argument order (task, model) is deprecated and "
9387 "will not be supported in the future. Please use the "
9488 "order (model, task)." , DeprecationWarning )
9589 task , model = model , task
9690
91+ extension = get_extension_by_model (model , raise_if_no_extension = True )
92+ if extension is None :
93+ # This should never happen and is only here to please mypy will be gone soon once the
94+ # whole function is removed
95+ raise TypeError (extension )
96+
9797 flow = extension .model_to_flow (model )
9898
9999 run = run_flow_on_task (
@@ -159,9 +159,6 @@ def run_flow_on_task(
159159 if flow_tags is not None and not isinstance (flow_tags , list ):
160160 raise ValueError ("flow_tags should be a list" )
161161
162- if task .task_id is None :
163- raise ValueError ("The task should be published at OpenML" )
164-
165162 # TODO: At some point in the future do not allow for arguments in old order (changed 6-2018).
166163 # Flexibility currently still allowed due to code-snippet in OpenML100 paper (3-2019).
167164 if isinstance (flow , OpenMLTask ) and isinstance (task , OpenMLFlow ):
@@ -171,6 +168,9 @@ def run_flow_on_task(
171168 "order (model, Flow)." , DeprecationWarning )
172169 task , flow = flow , task
173170
171+ if task .task_id is None :
172+ raise ValueError ("The task should be published at OpenML" )
173+
174174 flow .model = flow .extension .seed_model (flow .model , seed = seed )
175175
176176 # We only need to sync with the server right now if we want to upload the flow,
0 commit comments