@@ -141,3 +141,48 @@ function deleteruntag(instance::MLFlow, run_id::String, key::String)::Bool
141
141
end
142
142
deleteruntag (instance:: MLFlow , run:: Run , key:: String ):: Bool =
143
143
deleteruntag (instance, run. info. run_id, key)
144
+
145
+ """
146
+ searchruns(instance::MLFlow; experiment_ids::Array{String}=String[],
147
+ filter::String="", run_view_type::ViewType=ACTIVE_ONLY,
148
+ max_results::Int=1000, order_by::Array{String}=String[],
149
+ page_token::String="")
150
+
151
+ Search for runs that satisfy expressions. Search expressions can use Metric and
152
+ Param keys.
153
+
154
+ # Arguments
155
+ - `instance`: [`MLFlow`](@ref) configuration.
156
+ - `experiment_ids`: List of experiment IDs to search over.
157
+ - `filter`: A filter expression over params, metrics, and tags, that allows
158
+ returning a subset of runs. See [MLFlow documentation](https://mlflow.org/docs/latest/rest-api.html#search-runs).
159
+ - `run_view_type`: Whether to display only active, only deleted, or all runs.
160
+ Defaults to only active runs.
161
+ - `max_results`: Maximum number of runs desired.
162
+ - `order_by`: List of columns to be ordered by, including attributes, params,
163
+ metrics, and tags with an optional “DESC” or “ASC” annotation, where “ASC” is
164
+ the default.
165
+ - `page_token`: Token indicating the page of runs to fetch.
166
+
167
+ # Returns
168
+ - Vector of [`Run`](@ref) that were found in the specified experiments.
169
+ - The next page token if there are more results.
170
+ """
171
+ function searchruns (instance:: MLFlow ; experiment_ids:: Array{String} = String[],
172
+ filter:: String = " " , run_view_type:: ViewType = ACTIVE_ONLY,
173
+ max_results:: Int = 1000 , order_by:: Array{String} = String[],
174
+ page_token:: String = " " ):: Tuple{Array{Run}, Union{String, Nothing}}
175
+ parameters = (; experiment_ids, filter,
176
+ :run_view_type => run_view_type |> Integer, max_results, page_token)
177
+
178
+ if order_by |> ! isempty
179
+ parameters = (; order_by, parameters... )
180
+ end
181
+
182
+ result = mlfpost (instance, " runs/search" ; parameters... )
183
+
184
+ runs = get (result, " runs" , []) |> (x -> [Run (y) for y in x])
185
+ next_page_token = get (result, " next_page_token" , nothing )
186
+
187
+ return runs, next_page_token
188
+ end
0 commit comments