def reset_commands(self): self.commands = {} # add commands on the fly based on conditions if _is_kedro_project(): self.add_command(init) self.add_command(ui) # self.add_command(run) # TODO : IMPLEMENT THIS FUNCTION else: self.add_command(new)
def __init__( self, project_path: Union[str, Path], mlflow_tracking_uri: str = "mlruns", credentials: Optional[Dict[str, str]] = None, experiment_opts: Union[Dict[str, Any], None] = None, run_opts: Union[Dict[str, Any], None] = None, ui_opts: Union[Dict[str, Any], None] = None, node_hook_opts: Union[Dict[str, Any], None] = None, ): # declare attributes in __init__.py to avoid pylint complaining if not utils._is_kedro_project(project_path): raise KedroMlflowConfigError(( f"'project_path' = '{project_path}' is not a valid path to a kedro project" )) self.project_path = Path(project_path) # TODO we may add mlflow_registry_uri future release self.mlflow_tracking_uri = "mlruns" self.credentials = ( credentials or {} ) # replace None by {} but o not default to empty dict which is mutable self.experiment_opts = None self.run_opts = None self.ui_opts = None self.node_hook_opts = None self.mlflow_client = None # the client to interact with the mlflow database self.experiment = ( None # the mlflow experiment object to interact directly with it ) # load attributes with the from_dict method # which is the method which will almost always be used # for loading the configuration configuration = dict( mlflow_tracking_uri=mlflow_tracking_uri, credentials=credentials, experiment=experiment_opts, run=run_opts, ui=ui_opts, hooks=dict(node=node_hook_opts), ) self.from_dict(configuration)
def reset_commands(self): self.commands = {} self.warning_msg = None # add commands on the fly based on conditions if _is_kedro_project(): self.add_command(init) if _already_updated(): self.add_command(ui) # self.add_command(run) # TODO : IMPLEMENT THIS FUNCTION else: # single line jump "\n" is not rendered in help? self.warning_msg = click.style( "\n\nYou have not updated your template yet. " "This is mandatory to use 'kedro-mlflow' plugin." + "Please run the following command before you can access to other commands :\n\n" + "$ kedro mlflow init", fg="yellow", ) else: self.add_command(new)
def test_is_kedro_project(project, is_kedro_project, tmp_path): flag = _is_kedro_project(tmp_path) assert flag == is_kedro_project