5959def run_model_on_task ( # noqa: PLR0913
6060 model : Any ,
6161 task : int | str | OpenMLTask ,
62- avoid_duplicate_runs : bool = True , # noqa: FBT001, FBT002
62+ avoid_duplicate_runs : bool | None = None ,
6363 flow_tags : list [str ] | None = None ,
6464 seed : int | None = None ,
6565 add_local_measures : bool = True , # noqa: FBT001, FBT002
@@ -77,9 +77,10 @@ def run_model_on_task( # noqa: PLR0913
7777 task : OpenMLTask or int or str
7878 Task to perform or Task id.
7979 This may be a model instead if the first argument is an OpenMLTask.
80- avoid_duplicate_runs : bool, optional (default=True )
80+ avoid_duplicate_runs : bool, optional (default=None )
8181 If True, the run will throw an error if the setup/task combination is already present on
8282 the server. This feature requires an internet connection.
83+ If not set, it will use the default from your openml configuration (False if unset).
8384 flow_tags : List[str], optional (default=None)
8485 A list of tags that the flow should have at creation.
8586 seed: int, optional (default=None)
@@ -104,6 +105,8 @@ def run_model_on_task( # noqa: PLR0913
104105 flow : OpenMLFlow (optional, only if `return_flow` is True).
105106 Flow generated from the model.
106107 """
108+ if avoid_duplicate_runs is None :
109+ avoid_duplicate_runs = openml .config .avoid_duplicate_runs
107110 if avoid_duplicate_runs and not config .apikey :
108111 warnings .warn (
109112 "avoid_duplicate_runs is set to True, but no API key is set. "
@@ -175,7 +178,7 @@ def get_task_and_type_conversion(_task: int | str | OpenMLTask) -> OpenMLTask:
175178def run_flow_on_task ( # noqa: C901, PLR0912, PLR0915, PLR0913
176179 flow : OpenMLFlow ,
177180 task : OpenMLTask ,
178- avoid_duplicate_runs : bool = True , # noqa: FBT002, FBT001
181+ avoid_duplicate_runs : bool | None = None ,
179182 flow_tags : list [str ] | None = None ,
180183 seed : int | None = None ,
181184 add_local_measures : bool = True , # noqa: FBT001, FBT002
@@ -195,9 +198,10 @@ def run_flow_on_task( # noqa: C901, PLR0912, PLR0915, PLR0913
195198 all supervised estimators of scikit learn follow this definition of a model.
196199 task : OpenMLTask
197200 Task to perform. This may be an OpenMLFlow instead if the first argument is an OpenMLTask.
198- avoid_duplicate_runs : bool, optional (default=True )
201+ avoid_duplicate_runs : bool, optional (default=None )
199202 If True, the run will throw an error if the setup/task combination is already present on
200203 the server. This feature requires an internet connection.
204+ If not set, it will use the default from your openml configuration (False if unset).
201205 flow_tags : List[str], optional (default=None)
202206 A list of tags that the flow should have at creation.
203207 seed: int, optional (default=None)
@@ -221,6 +225,9 @@ def run_flow_on_task( # noqa: C901, PLR0912, PLR0915, PLR0913
221225 if flow_tags is not None and not isinstance (flow_tags , list ):
222226 raise ValueError ("flow_tags should be a list" )
223227
228+ if avoid_duplicate_runs is None :
229+ avoid_duplicate_runs = openml .config .avoid_duplicate_runs
230+
224231 # TODO: At some point in the future do not allow for arguments in old order (changed 6-2018).
225232 # Flexibility currently still allowed due to code-snippet in OpenML100 paper (3-2019).
226233 if isinstance (flow , OpenMLTask ) and isinstance (task , OpenMLFlow ):
0 commit comments