mlflow / mlflow-export-import

Apache License 2.0
110 stars 70 forks source link

Missing one required positional argument `experiment_ids` when exporting MLflow experiments. #169

Open sergey-serebryakov opened 4 months ago

sergey-serebryakov commented 4 months ago

Problem description

I just tried to export MLflow experiment from my local MLflow server and got TypeError exception. The stack trace is the following:

Traceback (most recent call last):
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/bin/export-experiment", line 8, in <module>
    sys.exit(main())
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/mlflow_export_import/experiment/export_experiment.py", line 147, in main
    export_experiment(
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/mlflow_export_import/experiment/export_experiment.py", line 76, in export_experiment
    for j,run in enumerate(SearchRunsIterator(mlflow_client, exp.experiment_id, **kwargs)):
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/mlflow_export_import/common/iterators.py", line 26, in __iter__
    self.paged_list = self._call_iter()
  File "/home/serebrya/anaconda3/envs/mlflow-export-import/lib/python3.10/site-packages/mlflow_export_import/common/iterators.py", line 18, in _call_iter
    return self.search_method(filter_string=self.filter)  #7623 - https://mlflow.org/docs/2.1.1/python_api/mlflow.client.html
TypeError: MlflowClient.search_runs() missing 1 required positional argument: 'experiment_ids'

MLflow Export-Import installation

I installed MLflow export-import by following information in the README file (latest commit at this time is a4e7948):

conda create -n mlflow-export-import python=3.10
conda activate mlflow-export-import
pip install git+https:///github.com/mlflow/mlflow-export-import/#egg=mlflow-export-import

What might be causing this error

I looked at the source code. The export_experiment function creates a new SearchRunsIterator instance that assigns search_method class variable to be MLflowClient.search_runs method. The _call_iter method then calls search_runs without providing experiment_ids parameter that is mandatory according to MLflow documentation.

lsc64 commented 4 months ago

Yeah, this is exactly what made me aware of #167. Glad the patch worked for you