Galileo-Galilei
02/14/2022, 9:58 PMpython
# First test with plain mlflow
# temp.py
import os
import mlflow
os.environ["MLFLOW_S3_ENDPOINT_URL"]='http://192.168.0.150:9000'
os.environ["AWS_ACCESS_KEY_ID"]='minioadmin'
os.environ["AWS_SECRET_ACCESS_KEY"]='minioadmin'
mlflow.set_tracking_uri('postgresql://postgres:postgres@localhost:5432/mlflow_db')
with mlflow.start_run():
mlflow.log_param("a",1)
Then open the ui, and check if the resutsl are stored where you want. If it is not the case, it means that your mlflow configuration is incorrect, check your server settings / port / password.
If it works as expected, restart your kernel and try the following script:
python
# Second test kedro-mlflow for configuration settingg and plain mlflow for logging
from kedro.framework.session import KedroSession
from kedro_mlflow.config import get_mlflow_config
with KedroSession.create() as session:
mlflow_config=get_mlflow_config()
mlflow_config.setup()
with mlflow.start_run():
mlflow.log_param("a",1)
This sets the environment variables and the uri through ``kedro-mlflow`` and then log in plain mlflow. Does it logs where you want?Dhaval
02/15/2022, 8:00 AMartifact_location
This value can only be set when the experiment is created using mlflow.create_experiment()
. As far as I've seen in your source code for kedro-mlflow, I've seen that you use set_experiment
which can't access the artifact_location
variableimport os
import mlflow
os.environ["MLFLOW_S3_ENDPOINT_URL"]='http://192.168.0.150:9000'
os.environ["AWS_ACCESS_KEY_ID"]='minioadmin'
os.environ["AWS_SECRET_ACCESS_KEY"]='minioadmin'
mlflow.set_tracking_uri('postgresql://postgres:postgres@localhost:5432/mlflow_db')
mlflow.create_experiment(name='new_flow_test', artifact_location='s3://mlflow')
mlflow.set_experiment('new_flow_test')
with mlflow.start_run():
print(mlflow.get_artifact_uri())
mlflow.log_param("a",1)
mlflow.log_artifact('data/01_raw/movie.csv')
I want to emulate this with kedro-mlflow but I don't see a way through which this can be achievedGalileo-Galilei
02/16/2022, 8:29 PMDhaval
02/16/2022, 8:32 PMGalileo-Galilei
02/16/2022, 8:57 PMIS_0102
02/17/2022, 5:08 PMGalileo-Galilei
02/17/2022, 6:35 PMDhaval
02/17/2022, 7:16 PMGalileo-Galilei
02/17/2022, 11:06 PMDhaval
02/18/2022, 7:25 AMlbonini
02/21/2022, 8:09 PMDhaval
02/21/2022, 8:34 PMlbonini
02/21/2022, 8:37 PMGalileo-Galilei
02/22/2022, 7:50 AMlbonini
02/22/2022, 1:39 PMIS_0102
03/01/2022, 8:03 PMmlflow_tracking_uri
. I have followed this link (https://kedro-mlflow.readthedocs.io/en/stable/source/04_experimentation_tracking/03_version_datasets.html) to set up the versioning of a csv dataset I am interested in but, even if the node creating this runs smoothly (and the csv is saved in the local path specified), it is not automatically uploaded in th s3 bucked I specified in MLFLOW_S3_ENDPOINT_URL
in mlflow.yml. For dubugging I printed the tracking_uri and artifact_uri: while the former is correctly set up as postgre, the second one report the default local mlruns folder. Do you know what could be causing this issue?run_id = mlflow.active_run().info.run_id
run_id_str = "Mlflow run id: {}".format(run_id)
if save_logs:
with open(f"{root_path}/logs/info.log", "r") as log_info_file:
log_lines = log_info_file.read().split(
"root - INFO - ** Kedro project pmpx-patient-embedding"
)[-1]
mlflow.log_text(run_id_str + log_lines, "log_last_run.txt")
mlflow.log_artifact(f"{root_path}/logs/info.log")
error_file_path = f"{root_path}/logs/errors.log"
if Path(error_file_path).is_file():
mlflow.log_artifact(error_file_path)
tags = {
"mlflow_run_id": run_id,
}
mlflow.set_tags(tags)
logging.info(run_id_str)
logging.info("Mlflow artifact uri: {}".format(mlflow.get_artifact_uri()))
logging.info("Mlflow tracking uri: {}".format(mlflow.get_tracking_uri()))
tracking_uri
and artifact_uri
mlflow_tracking_uri: "postgresql://{username}:{password}@{ipaddress}:{port}/{dbname}"
stores_environment_variables: {
MLFLOW_S3_ENDPOINT_URL: "s3://{s3_bucket_name}"
}
credentials: mlflow_credentials
Galileo-Galilei
03/02/2022, 7:39 AMIS_0102
03/02/2022, 10:53 AMMLFLOW_S3_ENDPOINT_URL: "s3://{s3_bucket_name}"
with MLFLOW_S3_ENDPOINT_URL: "https://s3://{s3_bucket_name}"
? I tried this but it but I get the same resultGalileo-Galilei
03/02/2022, 11:09 AMIS_0102
03/02/2022, 11:22 AMmlflow server --backend-store-uri postgresql://{} --default-artifact-root s3://{}
Galileo-Galilei
03/02/2022, 11:36 AMIS_0102
03/02/2022, 11:56 AMMLFLOW_S3_ENDPOINT_URL
as in the mlflow server
command I run, correct?Dhaval
03/02/2022, 1:36 PMGalileo-Galilei
03/03/2022, 7:54 AM