diff --git a/.gitignore b/.gitignore index 6560f21..549dd56 100644 --- a/.gitignore +++ b/.gitignore @@ -210,7 +210,7 @@ data/raw data/processed # MLflow -mlruns/ +#mlruns/ mlartifacts/ # Default ignored files diff --git a/Dockerfile.prod b/Dockerfile.prod index 02144dd..3376270 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -30,6 +30,25 @@ RUN az storage blob download-batch \ --account-key "${AZURE_STORAGE_KEY}" \ --source mlruns \ --destination /app/mlruns/ || echo "No mlruns/ in storage yet, skipping" +RUN az storage file download \ + --account-name "${AZURE_STORAGE_ACCOUNT}" \ + --account-key "${AZURE_STORAGE_KEY}" \ + --share-name "train-val-selected" \ + --path "train_val_selected.csv" \ + --dest /app/data/processed/train_val_selected.csv && \ + az storage file download \ + --account-name "${AZURE_STORAGE_ACCOUNT}" \ + --account-key "${AZURE_STORAGE_KEY}" \ + --share-name "train-val-selected" \ + --path "test_selected.csv" \ + --dest /app/data/processed/test_selected.csv && \ + az storage file download \ + --account-name "${AZURE_STORAGE_ACCOUNT}" \ + --account-key "${AZURE_STORAGE_KEY}" \ + --share-name "train-val-selected" \ + --path "market_data_merged.csv" \ + --dest /app/data/raw/market_data_merged.csv +RUN echo "=== /app/data/processed/ ===" && ls -lh /app/data/processed/ EXPOSE 8000 8501 COPY docker/entrypoint.sh /entrypoint.sh diff --git a/src/models/ml_flow.py b/src/models/ml_flow.py index 0f5d0de..e548edf 100644 --- a/src/models/ml_flow.py +++ b/src/models/ml_flow.py @@ -62,15 +62,11 @@ def run_mlflow_tracking() -> None: MODELS_DIR.mkdir(parents=True, exist_ok=True) mlflow.set_tracking_uri(settings.mlflow_tracking_uri) - if settings.mlflow_artifact_root: - mlflow.set_experiment(EXPERIMENT_NAME) - client = mlflow.tracking.MlflowClient() - exp = client.get_experiment_by_name(EXPERIMENT_NAME) - if exp is None: - mlflow.create_experiment( - EXPERIMENT_NAME, artifact_location=settings.mlflow_artifact_root - ) - + client = mlflow.tracking.MlflowClient() + exp = client.get_experiment_by_name(EXPERIMENT_NAME) + if exp is None: + artifact_loc = settings.mlflow_artifact_root or str(_PROJECT_ROOT / "mlruns") + mlflow.create_experiment(EXPERIMENT_NAME, artifact_location=artifact_loc) mlflow.set_experiment(EXPERIMENT_NAME) results_path = ARTIFACT_DIR / "training_results.json"