|
20 | 20 | from ..__about__ import __version__ |
21 | 21 | from ..conf import api_config |
22 | 22 | from ..logs import get_logger |
23 | | -from .routes import job, log |
24 | | -from .utils import repeat_at |
| 23 | +from .routes import job, log, workflow |
25 | 24 |
|
26 | 25 | load_dotenv() |
27 | 26 | logger = get_logger("uvicorn.error") |
@@ -67,53 +66,7 @@ async def health(): |
67 | 66 | # NOTE Add the jobs and logs routes by default. |
68 | 67 | app.include_router(job, prefix=api_config.prefix_path) |
69 | 68 | app.include_router(log, prefix=api_config.prefix_path) |
70 | | - |
71 | | - |
72 | | -# NOTE: Enable the workflows route. |
73 | | -if api_config.enable_route_workflow: |
74 | | - from .routes import workflow |
75 | | - |
76 | | - app.include_router(workflow, prefix=api_config.prefix_path) |
77 | | - |
78 | | - |
79 | | -# NOTE: Enable the schedules route. |
80 | | -# if api_config.enable_route_schedule: |
81 | | -# from ..logs import get_audit |
82 | | -# from ..scheduler import schedule_task |
83 | | -# from .routes import schedule |
84 | | -# |
85 | | -# app.include_router(schedule, prefix=api_config.prefix_path) |
86 | | -# |
87 | | -# @schedule.on_event("startup") |
88 | | -# @repeat_at(cron="* * * * *", delay=2) |
89 | | -# def scheduler_listener(): |
90 | | -# """Schedule broker every minute at 02 second.""" |
91 | | -# logger.debug( |
92 | | -# f"[SCHEDULER]: Start listening schedule from queue " |
93 | | -# f"{app.state.scheduler}" |
94 | | -# ) |
95 | | -# if app.state.workflow_tasks: |
96 | | -# schedule_task( |
97 | | -# app.state.workflow_tasks, |
98 | | -# stop=datetime.now(config.tz) + timedelta(minutes=1), |
99 | | -# queue=app.state.workflow_queue, |
100 | | -# threads=app.state.workflow_threads, |
101 | | -# audit=get_audit(), |
102 | | -# ) |
103 | | -# |
104 | | -# @schedule.on_event("startup") |
105 | | -# @repeat_at(cron="*/5 * * * *", delay=10) |
106 | | -# def monitoring(): |
107 | | -# """Monitoring workflow thread that running in the background.""" |
108 | | -# logger.debug("[MONITOR]: Start monitoring threading.") |
109 | | -# snapshot_threads: list[str] = list(app.state.workflow_threads.keys()) |
110 | | -# for t_name in snapshot_threads: |
111 | | -# |
112 | | -# thread_release: ReleaseThread = app.state.workflow_threads[t_name] |
113 | | -# |
114 | | -# # NOTE: remove the thread that running success. |
115 | | -# if not thread_release["thread"].is_alive(): |
116 | | -# app.state.workflow_threads.pop(t_name) |
| 69 | +app.include_router(workflow, prefix=api_config.prefix_path) |
117 | 70 |
|
118 | 71 |
|
119 | 72 | @app.exception_handler(RequestValidationError) |
|
0 commit comments