For performance reasons I want to use the SQLite backend instead of the default mlruns folder in MLFlow. I set the tracking_uri to sqlite:///outputs/test.sqlite
and then create a new experiment using the default API (not tracking API, but it happens with that too).
This is the code:
import mlflow
mlflow.set_tracking_uri("sqlite:///outputs/test.sqlite")
mlflow.create_experiment("experiment")
The code works, but I get this output:
2021/04/23 22:43:22 INFO mlflow.store.db.utils: Creating initial MLflow database tables...
2021/04/23 22:43:22 INFO mlflow.store.db.utils: Updating database tables
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> 451aebb31d03, add metric step
INFO [alembic.runtime.migration] Running upgrade 451aebb31d03 -> 90e64c465722, migrate user column to tags
INFO [alembic.runtime.migration] Running upgrade 90e64c465722 -> 181f10493468, allow nulls for metric values
INFO [alembic.runtime.migration] Running upgrade 181f10493468 -> df50e92ffc5e, Add Experiment Tags Table
INFO [alembic.runtime.migration] Running upgrade df50e92ffc5e -> 7ac759974ad8, Update run tags with larger limit
INFO [alembic.runtime.migration] Running upgrade 7ac759974ad8 -> 89d4b8295536, create latest metrics table
INFO [89d4b8295536_create_latest_metrics_table_py] Migration complete!
INFO [alembic.runtime.migration] Running upgrade 89d4b8295536 -> 2b4d017a5e9b, add model registry tables to db
INFO [2b4d017a5e9b_add_model_registry_tables_to_db_py] Adding registered_models and model_versions tables to database.
INFO [2b4d017a5e9b_add_model_registry_tables_to_db_py] Migration complete!
INFO [alembic.runtime.migration] Running upgrade 2b4d017a5e9b -> cfd24bdc0731, Update run status constraint with killed
INFO [alembic.runtime.migration] Running upgrade cfd24bdc0731 -> 0a8213491aaa, drop_duplicate_killed_constraint
WARNI [0a8213491aaa_drop_duplicate_killed_constraint_py] Failed to drop check constraint. Dropping check constraints may not be supported by your SQL database. Exception content: No support for ALTER of constraints in SQLite dialectPlease refer to the batch mode feature which allows for SQLite migrations using a copy-and-move strategy.
INFO [alembic.runtime.migration] Running upgrade 0a8213491aaa -> 728d730b5ebd, add registered model tags table
INFO [alembic.runtime.migration] Running upgrade 728d730b5ebd -> 27a6a02d2cf1, add model version tags table
INFO [alembic.runtime.migration] Running upgrade 27a6a02d2cf1 -> 84291f40a231, add run_link to model_version
INFO [alembic.runtime.migration] Running upgrade 84291f40a231 -> a8c4a736bde6, allow nulls for run_id
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
This information is not shown when I run the code a second time (with a different experiment ID). It is only shown when I specify a SQLite tracking URI that does not exist yet.
My questions are:
- Why does that happen?
- Can I somehow disable this output? It clutters my output too much because if I directly start calling log_params, log_metrics, etc., I get warnings for these calls too. These warnigns then look like:
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
- What is the correct way to create a new SQLite database in mlflow?
Addition: This also happens when I create multiple experiments in the same script, but this does NOT happen when I create one experiment in a script, then run the script again to create the second experiment. It seems like some kind of global state is not set properly in MLFlow / the SQLite engine?
for i in range(3):
print(_i)
mlflow.set_tracking_uri(tracking_uri)
mlflow.create_experiment("experiment_%d" % _)
EDIT
It can be disabled this way:
import logging, sys
logging.disable(sys.maxsize)
Unfortunately that is not a good solution as it disables logging globally.