How to filter experiment runs using start time [revised]

Frankenstein
Frankenstein Registered Posts: 8 ✭✭✭
edited July 16 in Using Dataiku

Hi Dataiku Community,

I would like to know how we can filter experiment runs using the experiment run's start time.

experiment_runs.PNG

filter_string = "attributes.start_time > '2024-03-26 03:05:48'"
order_by = ["metrics.accuracy DESC"]

with project.setup_mlflow(managed_folder=experiment_managed_folder) as mlflow:
        experiment = mlflow.set_experiment(experiment_name)
        best_run = mlflow.search_runs(experiment_ids=[experiment.experiment_id], filter_string=filter_string, order_by=order_by, max_results=1, output_format="list")[0]

after reading the mlflow's documentation, I converted the start time '2024-03-26 03:05:48' into the UNIX epoch format as an integer 1711393548000 using the Unix epoch converter here

https://www.epochconverter.com/

filter_string = "attributes.start_time > 1711393548000"
order_by = ["metrics.accuracy DESC"]

with project.setup_mlflow(managed_folder=experiment_managed_folder) as mlflow:
        experiment = mlflow.set_experiment(experiment_name)

        best_run = mlflow.search_runs(experiment_ids=[experiment.experiment_id], filter_string=filter_string, order_by=order_by, max_results=1, output_format="list")[0]

The first code snippet produced the error as shown below:

raise MlflowException(f"API request to {url} failed with exception {e}")

mlflow.exceptions.MlflowException: API request to http://127.0.0.1:11001/dip/publicapi/api/2.0/mlflow/runs/search failed with exception HTTPConnectionPool(host='127.0.0.1', port=11001): Max retries exceeded with url: /dip/publicapi/api/2.0/mlflow/runs/search (Caused by ResponseError('too many 500 error responses'))

And the second code snippet produced the correct result!

So, this confirms that we need to use Unix Epoch format if we want to use attributes.start_time as a filter string in search_runs().

Best Answer

Answers

  • AurelienL
    AurelienL Dataiker Posts: 9 Dataiker

    Hello,

    What you are doing should work, let's try to find out why it's failing for you.

    You should have a more detailed error message in your backend.log, typically a Java or Python stack trace, could you share that stack trace with us?

    Additionally, could you indicate what is your DSS version and the version of MLflow you are using?

  • Frankenstein
    Frankenstein Registered Posts: 8 ✭✭✭

    Hi @AurelienL
    ,

    Thanks for your help and sorry for the confusion! I modified the original post and added my findings to the issue!

Setup Info
    Tags
      Help me…