2222from mlflow_export_import .common .filesystem import mk_local_path
2323from mlflow_export_import .common import filesystem as _filesystem
2424from mlflow_export_import .common import MlflowExportImportException
25- from mlflow_export_import .client .http_client import create_dbx_client
25+ from mlflow_export_import .client .http_client import create_dbx_client , create_http_client
2626from . import run_data_importer
2727from . import run_utils
2828
@@ -61,6 +61,7 @@ def _mk_ex(src_run_dct, dst_run_id, exp_name):
6161 }
6262
6363 mlflow_client = mlflow_client or mlflow .MlflowClient ()
64+ http_client = create_http_client (mlflow_client )
6465 dbx_client = create_dbx_client (mlflow_client )
6566
6667 _logger .info (f"Importing run from '{ input_dir } '" )
@@ -69,7 +70,6 @@ def _mk_ex(src_run_dct, dst_run_id, exp_name):
6970 src_run_path = os .path .join (input_dir , "run.json" )
7071 src_run_dct = io_utils .read_file_mlflow (src_run_path )
7172 in_databricks = "DATABRICKS_RUNTIME_VERSION" in os .environ
72- #_logger.debug(f"in_databricks: {in_databricks}")
7373
7474 run = mlflow_client .create_run (exp .experiment_id )
7575 run_id = run .info .run_id
@@ -83,6 +83,8 @@ def _mk_ex(src_run_dct, dst_run_id, exp_name):
8383 use_src_user_id ,
8484 in_databricks
8585 )
86+ _import_inputs (http_client , src_run_dct , run_id )
87+
8688 path = os .path .join (input_dir , "artifacts" )
8789 if os .path .exists (_filesystem .mk_local_path (path )):
8890 mlflow_client .log_artifacts (run_id , mk_local_path (path ))
@@ -141,6 +143,12 @@ def _upload_databricks_notebook(dbx_client, input_dir, src_run_dct, dst_notebook
141143 _logger .warning (f"Cannot save notebook '{ dst_notebook_path } '. { e } " )
142144
143145
146+ def _import_inputs (http_client , src_run_dct , run_id ):
147+ inputs = src_run_dct .get ("inputs" )
148+ dct = { "run_id" : run_id , "datasets" : inputs }
149+ http_client .post ("runs/log-inputs" , dct )
150+
151+
144152@click .command ()
145153@opt_input_dir
146154@opt_experiment_name
0 commit comments