-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (30 loc) · 1.13 KB
/
main.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
from __future__ import annotations
import logging
from config.state_init import StateManager
from src.pipelines.data_pipeline import DataPipeline
from src.pipelines.model_pipeline import ModelPipeline
from utils.execution import TaskExecutor
from utils.project_setup import init_project
class MainPipeline:
def __init__(
self, state: StateManager,
exe: TaskExecutor
):
self.state = state
self.exe = exe
self.load_path = state.paths.get_path('raw')
self.save_path = state.paths.get_path('processed')
def run(self):
"""ETL pipeline main entry point."""
steps = [
DataPipeline(self.state, self.exe),
ModelPipeline(self.state, self.exe),
]
self.exe._execute_steps(steps, stage="main")
if __name__ == "__main__":
project_dir, project_config, state_manager, exe = init_project()
try:
logging.info(f"Beginning Top-Level Pipeline from ``main.py``...\n{"="*125}")
MainPipeline(state_manager, exe).run()
except Exception as e:
logging.error(f"Pipeline terminated due to unexpected error: {e}", exc_info=True)