11import uuid
22
33import dill
4- from sanic import Blueprint
4+ from sanic import Blueprint
55from sanic .exceptions import SanicException
66from sanic .response import json , raw
77from sanic_ext import openapi
1111 SchedulerModify ,
1212 SchedulerDelete ,
1313 SchedulerList ,
14- SchedulerInfo
14+ SchedulerInfo ,
1515)
1616from ..utils import deserialize_and_validate
1717
@@ -62,16 +62,15 @@ async def job_result(request, job_id: str) -> raw:
6262
6363
6464@bp .get ("/schedules" )
65- @openapi .summary ("List all schedules" )
65+ @openapi .summary ("List all schedules" )
6666@openapi .description ("Get a list of all pipeline schedules" )
6767@openapi .body ({"application/json" : SchedulerList }, required = False )
6868@openapi .response (200 , {"application/json" : dict })
6969async def schedules (request ) -> json :
7070 try :
7171 body = await deserialize_and_validate (SchedulerList , query = request .args )
7272 schedules = request .app .ctx .scheduler .get_schedules (
73- pattern = body .pattern ,
74- as_dict = True
73+ pattern = body .pattern , as_dict = True
7574 )
7675 return json ({"schedules" : schedules })
7776 except Exception as e :
@@ -87,7 +86,7 @@ async def schedules(request) -> json:
8786@openapi .response (404 , {"application/json" : dict })
8887async def schedule (request , schedule_id : str ) -> json :
8988 try :
90- body = await deserialize_and_validate (SchedulerInfo , body = request .json )
89+ # body = await deserialize_and_validate(SchedulerInfo, body=request.json)
9190 if schedule_id not in [s .id for s in request .app .ctx .scheduler .get_schedules ()]:
9291 raise SanicException ("Schedule not found" , status_code = 404 )
9392 schedule = request .app .ctx .scheduler .get_schedule (schedule_id , as_dict = True )
@@ -113,15 +112,15 @@ async def add_schedule(request) -> json:
113112@bp .patch ("/schedule/<schedule_id>" )
114113@openapi .summary ("Modify schedule" )
115114@openapi .description ("Modify an existing pipeline schedule" )
116- @openapi .parameter ("schedule_id" , str , required = True )
115+ @openapi .parameter ("schedule_id" , str , required = True )
117116@openapi .body ({"application/json" : SchedulerModify }, required = True )
118117@openapi .response (200 , {"application/json" : dict })
119118@openapi .response (404 , {"application/json" : dict })
120119async def modify_schedule (request , schedule_id : str ) -> json :
121120 try :
122121 if schedule_id not in [s .id for s in request .app .ctx .scheduler .get_schedules ()]:
123122 raise SanicException ("Schedule not found" , status_code = 404 )
124-
123+
125124 body = await deserialize_and_validate (SchedulerModify , body = request .json )
126125 request .app .ctx .scheduler .modify_schedule (schedule_id , ** body .model_dump ())
127126 return json ({"status" : "success" })
@@ -138,7 +137,7 @@ async def modify_schedule(request, schedule_id: str) -> json:
138137@openapi .response (404 , {"application/json" : dict })
139138async def remove_schedule (request , schedule_id : str ) -> json :
140139 try :
141- body = await deserialize_and_validate (SchedulerDelete , body = request .json )
140+ # body = await deserialize_and_validate(SchedulerDelete, body=request.json)
142141 if schedule_id not in [s .id for s in request .app .ctx .scheduler .get_schedules ()]:
143142 raise SanicException ("Schedule not found" , status_code = 404 )
144143 request .app .ctx .scheduler .remove_schedule (schedule_id )
0 commit comments