Skip to content
Snippets Groups Projects
Verified Commit ab274366 authored by Yoann Schneider's avatar Yoann Schneider :tennis:
Browse files

allow resuming from existing run

parent a7fd22ad
No related branches found
No related tags found
No related merge requests found
...@@ -91,10 +91,22 @@ def start_mlflow_run(config: dict): ...@@ -91,10 +91,22 @@ def start_mlflow_run(config: dict):
# Set needed variables in environment # Set needed variables in environment
setup_environment(config) setup_environment(config)
run_name, run_id = config.get("run_name"), config.get("run_id")
if run_id:
logger.info(f"Will resume run ({run_id}).")
if run_name:
logger.warning(
"Run_name will be ignored since you specified a run_id to resume from."
)
# Set experiment from config # Set experiment from config
experiment_id = config.get("experiment_id") experiment_id = config.get("experiment_id")
assert experiment_id, "Missing MLflow experiment ID in the configuration" assert experiment_id, "Missing MLflow experiment ID in the configuration"
# Start run # Start run
yield mlflow.start_run(run_name=config.get("run_name"), experiment_id=experiment_id) yield mlflow.start_run(
run_id=run_id, run_name=run_name, experiment_id=experiment_id
)
mlflow.end_run() mlflow.end_run()
...@@ -76,8 +76,8 @@ def get_config(): ...@@ -76,8 +76,8 @@ def get_config():
dataset_path = "." dataset_path = "."
params = { params = {
"mlflow": { "mlflow": {
"dataset_name": dataset_name,
"run_name": "Test log DAN", "run_name": "Test log DAN",
"run_id": None,
"s3_endpoint_url": "", "s3_endpoint_url": "",
"tracking_uri": "", "tracking_uri": "",
"experiment_id": "0", "experiment_id": "0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment