Skip to content

Commit 82aab67

Browse files
committed
fixing tracking uri issue on the api
1 parent bda68fc commit 82aab67

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

config/settings.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# MODEL SETTINGS
2-
FEATURES: ['Gender_Male', 'Age_q2', 'Age_q4', 'CAEC_Frequently', 'CAEC_Sometimes', 'CAEC_no', 'SMOKE_yes', 'SCC_yes', 'CALC_infrequent_sklearn', 'MTRANS_Public_Transportation', 'MTRANS_Walking', 'MTRANS_infrequent_sklearn', 'IS_1', 'FCVC', 'FAF', 'TUE', 'BMI', 'BMR']
2+
FEATURES: ['Gender_x0_Male', 'Age_x0_q2', 'Age_x0_q4', 'CAEC_x0_Frequently', 'CAEC_x0_Sometimes', 'CAEC_x0_no', 'SMOKE_x0_yes', 'SCC_x0_yes', 'CALC_x0_infrequent_sklearn', 'MTRANS_x0_Public_Transportation', 'MTRANS_x0_Walking', 'MTRANS_x0_infrequent_sklearn', 'IS_x0_1', 'FCVC', 'FAF', 'TUE', 'BMI', 'BMR']
33
MODEL_NAME: 'xgboost'
44
MODEL_FLAVOR: 'xgboost'
5-
RUN_ID: 'ff943ce028b1479795153a8f13106894'
6-
EXPERIMENT_ID: '755921522963084808'
5+
RUN_ID: 'e7d3cea9b93b4dd18ae421c402520a2c'
6+
EXPERIMENT_ID: '708342276728582022'
77
VERSION: '1.0'
88

99
# GENERAL SETTINGS
1010
DATA_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/data/'
1111
RAW_FILE_NAME: 'Original_ObesityDataSet.csv'
1212
ARTIFACTS_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/models/artifacts/'
1313
FEATURES_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/models/features/'
14+
RESEARCH_ENVIRONMENT_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/notebooks/'
1415
TARGET_COLUMN: 'NObeyesdad'
1516
LOG_LEVEL: 'INFO'
1617
LOG_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/'

src/api.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
import pandas as pd
2+
import mlflow
23
from fastapi import FastAPI
34

45
from .data.processing import data_processing_inference
56
from .config.model import model_settings
7+
from .config.aws import aws_credentials
8+
from .config.settings import general_settings
69
from .model.inference import ModelServe
710
from .schema.person import Person
811

912
app = FastAPI()
1013

14+
if aws_credentials.EC2 != "YOUR_EC2_INSTANCE_URL":
15+
mlflow.set_tracking_uri(f"http://{aws_credentials.EC2}:5000")
16+
else:
17+
mlflow.set_tracking_uri(f"http://127.0.0.1:5000")
18+
1119
@app.get("/version")
1220
def check_versions():
13-
with open("../notebooks/VERSION", "r", encoding="utf-8") as f:
21+
with open(f"{general_settings.RESEARCH_ENVIRONMENT_PATH}/VERSION", "r", encoding="utf-8") as f:
1422
code_version = f.readline().strip()
1523

1624
return {

src/config/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class GeneralSettings(BaseModel):
2020
TARGET_COLUMN: str
2121
LOG_LEVEL: str
2222
LOG_PATH: DirectoryPath
23+
RESEARCH_ENVIRONMENT_PATH: DirectoryPath
2324

2425
general_settings = GeneralSettings(
2526
**read_yaml_credentials_file(

0 commit comments

Comments
 (0)