File tree Expand file tree Collapse file tree 7 files changed +16
-15
lines changed
Expand file tree Collapse file tree 7 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 2828import os
2929from typing import Union
3030
31- from pydantic import BaseSettings
31+ from pydantic_settings import BaseSettings
3232
3333GOOGLE_APPLICATION_CREDENTIALS = os .getenv ("GOOGLE_APPLICATION_CREDENTIALS" , '{}' )
3434if GOOGLE_APPLICATION_CREDENTIALS :
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ def get_example_instruments() -> List[Instrument]:
6060 str (os .getcwd ()) + "/example_questionnaires.json" , "r" , encoding = "utf-8"
6161 ) as file :
6262 for line in file :
63- instrument = Instrument .parse_raw (line )
63+ instrument = Instrument .model_validate_json (line )
6464 example_instruments .append (instrument )
6565
6666 return example_instruments
Original file line number Diff line number Diff line change @@ -186,11 +186,11 @@ def match(match_body: MatchBody) -> MatchResponse:
186186
187187 # Model
188188 model = match_body .parameters
189- if model .dict ( ) not in ALL_HARMONY_API_MODELS :
189+ if model .model_dump ( mode = "json" ) not in ALL_HARMONY_API_MODELS :
190190 raise http_exceptions .CouldNotProcessRequestHTTPException (
191191 "Could not process request because the model does not exist."
192192 )
193- if not helpers .check_model_availability (model .dict ( )):
193+ if not helpers .check_model_availability (model .model_dump ( mode = "json" )):
194194 raise http_exceptions .CouldNotProcessRequestHTTPException (
195195 "Could not process request because the model is not available."
196196 )
Original file line number Diff line number Diff line change 2525"""
2626
2727from fastapi .concurrency import run_in_threadpool
28- from rocketry import Rocketry
29- from rocketry .conds import cron
28+ # from rocketry import Rocketry
29+ # from rocketry.conds import cron
3030
3131from harmony_api .services .instruments_cache import InstrumentsCache
3232from harmony_api .services .vectors_cache import VectorsCache
3333
34- app = Rocketry (executation = "async" )
34+ # app = Rocketry(executation="async")
3535
3636
37- @app .task (cron ("0 */12 * * *" ))
37+ # @app.task(cron("0 */12 * * *"))
3838async def do_every_12th_hour ():
3939 """
4040 Save the caches to disk every 12th hour.
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ def save(self):
113113 # Instruments to dict
114114 cache_parsed : dict [str , List ] = {}
115115 for key , value in self .__cache .items ():
116- instruments = [x .dict () for x in value ]
116+ instruments = [x .model_dump ( mode = "json" ) () for x in value ]
117117 cache_parsed [key ] = instruments
118118
119119 with open (cache_file_path , "w" , encoding = "utf8" ) as file :
Original file line number Diff line number Diff line change 4040from harmony_api .routers .info_router import router as info_router
4141from harmony_api .routers .text_router import router as text_router
4242from harmony_api .services .instruments_cache import InstrumentsCache
43- from harmony_api .scheduler import app as app_rocketry
43+ # from harmony_api.scheduler import app as app_rocketry
4444from harmony_api .services .vectors_cache import VectorsCache
4545
4646description = """
@@ -89,7 +89,7 @@ class Server(uvicorn.Server):
8989 """
9090
9191 def handle_exit (self , sig : int , frame ):
92- app_rocketry .session .shut_down ()
92+ # app_rocketry.session.shut_down()
9393
9494 return super ().handle_exit (sig , frame )
9595
@@ -112,11 +112,12 @@ async def main():
112112 )
113113
114114 api = asyncio .create_task (server .serve ())
115- scheduler = asyncio .create_task (app_rocketry .serve ())
115+ # scheduler = asyncio.create_task(app_rocketry.serve())
116116
117117 # Start both applications (FastAPI & Rocketry)
118118 print ("INFO:\t Starting applications..." )
119- await asyncio .wait ([api , scheduler ])
119+ # await asyncio.wait([api, scheduler])
120+ await asyncio .wait (api )
120121
121122
122123if __name__ == "__main__" :
Original file line number Diff line number Diff line change 11fastapi == 0.109.1
22requests == 2.31.0
3- pydantic == 1.10.7
3+ pydantic == 2.8.2
4+ pydantic-settings == 2.4.0
45uvicorn == 0.21.1
56pandas == 2.0.0
67tika == 2.6.0
@@ -10,7 +11,6 @@ XlsxWriter==3.0.9
1011openpyxl == 3.1.2
1112sentence-transformers == 2.2.2
1213wget == 3.2
13- rocketry == 2.5.1
1414openai == 1.30.2
1515vertexai == 1.49.0
1616numpy == 1.26.4
You can’t perform that action at this time.
0 commit comments