Skip to content

Commit

Permalink
Fix: avoid creating Mlflow experiment in ctor of training task
Browse files Browse the repository at this point in the history
  • Loading branch information
LudoBar committed Oct 2, 2023
1 parent 3752504 commit 3b16190
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions ikomia/dnn/dnntrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ def _init_mlflow(self):
"""
monitoring.check_mlflow_server()
mlflow.set_tracking_uri(config.main_cfg["mlflow"]["tracking_uri"])
# Create experiment
self._create_mlflow_experiment()

def _create_mlflow_experiment(self):
try:
Expand Down Expand Up @@ -98,19 +96,17 @@ def begin_task_run(self):
super().begin_task_run()
mlflow.end_run()

if self.experiment_id != -1:
# Check if experiment still exists
if not self._is_experiment_exists():
self._create_mlflow_experiment()
if self.experiment_id == -1:
return

mlflow.start_run(experiment_id=self.experiment_id, run_name=self.name)

# Log parameters
param = self.get_param_object()
if param is not None:
self.log_params(param.cfg)
if self.experiment_id == -1 or not self._is_experiment_exists():
self._create_mlflow_experiment()
if self.experiment_id == -1:
return

mlflow.start_run(experiment_id=self.experiment_id, run_name=self.name)

# Log parameters
param = self.get_param_object()
if param is not None:
self.log_params(param.cfg)

def log_param(self, key, value):
"""
Expand Down

0 comments on commit 3b16190

Please sign in to comment.