-
Notifications
You must be signed in to change notification settings - Fork 2
/
pred_flow.py
44 lines (39 loc) · 1.28 KB
/
pred_flow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from prefect import flow
from app.inference.forecast import forecast_flow
from dotenv import dotenv_values
import argparse
import datetime
import yaml
@flow(
name="InferenceFlow",
description="Inference/Monitoring Main Flow",
validate_parameters=True,
log_prints=True,
)
def pred_flow(db_token, running_date: str, model_path: str) -> None:
"""main flow of weather forecasting & performance monitoring
Parameters
----------
db_token : str
MotherDuck Database Credentials
running_date : str
running date of the process
model_path : str
path of model's pickle file
"""
forecast_flow(db_token=db_token, date=running_date, model_path=model_path)
if __name__ == "__main__":
ENV = dotenv_values(".env")
default_date = datetime.datetime.strftime(
datetime.datetime.now() - datetime.timedelta(days=2), "%Y-%m-%d"
)
parser = argparse.ArgumentParser(description="ML Job Parameters")
parser.add_argument("--running_date", default=default_date, type=str)
args = parser.parse_args()
with open("conf/params.yaml", "r") as f:
conf = yaml.safe_load(f)
pred_flow(
db_token=ENV["MOTHERDUCK_TOKEN"],
running_date=args.running_date,
model_path=conf["tuner"]["model_path"],
)