$ErrorActionPreference = "Stop"

. $PSScriptRoot\_mlflow_config_common.ps1

$DEFAULT_ARTIFACT_ROOT = "./mlflow/mlartifacts/"

$MLFLOW_PORT = if ($env:MLFLOW_PORT) { $env:MLFLOW_PORT } else { 5000 }

New-Item -ItemType Directory -Force -Path $DEFAULT_ARTIFACT_ROOT | Out-Null

& mlflow server `
    --backend-store-uri="$BACKEND_URI" `
    --default-artifact-root="$DEFAULT_ARTIFACT_ROOT" `
    -p $MLFLOW_PORT
