Mbonea commited on
Commit
5dd9398
1 Parent(s): b6e6fa1

Fix startup and shutdown events in app.py

Browse files
Files changed (2) hide show
  1. App/Worker.py +1 -1
  2. App/app.py +6 -6
App/Worker.py CHANGED
@@ -105,6 +105,7 @@ def cleanup_temp_directory(
105
  ):
106
  try:
107
  print("sending...")
 
108
  # bot.send_video(chat_id=chat_id,caption="Your Video Caption",video=output_dir)
109
  bot.send_file(chat_id, file=output_dir, caption="Your video caption")
110
  except Exception as e:
@@ -120,7 +121,6 @@ def celery_task(video_task: EditorRequest):
120
  project_id = str(uuid.uuid4())
121
  temp_dir = f"/tmp/{project_id}"
122
  output_dir = f"/tmp/{project_id}/out/video.mp4"
123
-
124
  assets_dir = os.path.join(temp_dir, "src/HelloWorld/Assets")
125
 
126
  # copy_remotion_app(remotion_app_dir, temp_dir),
 
105
  ):
106
  try:
107
  print("sending...")
108
+ bot.start()
109
  # bot.send_video(chat_id=chat_id,caption="Your Video Caption",video=output_dir)
110
  bot.send_file(chat_id, file=output_dir, caption="Your video caption")
111
  except Exception as e:
 
121
  project_id = str(uuid.uuid4())
122
  temp_dir = f"/tmp/{project_id}"
123
  output_dir = f"/tmp/{project_id}/out/video.mp4"
 
124
  assets_dir = os.path.join(temp_dir, "src/HelloWorld/Assets")
125
 
126
  # copy_remotion_app(remotion_app_dir, temp_dir),
App/app.py CHANGED
@@ -5,14 +5,14 @@ from App import bot
5
  app = FastAPI()
6
 
7
 
8
- @app.on_event("startup")
9
- async def startup_event():
10
- await bot.start()
11
 
12
 
13
- @app.on_event("shutdown")
14
- async def shutdown_event():
15
- await bot.stop()
16
 
17
 
18
  @app.get("/")
 
5
  app = FastAPI()
6
 
7
 
8
+ # @app.on_event("startup")
9
+ # async def startup_event():
10
+ # await bot.start()
11
 
12
 
13
+ # @app.on_event("shutdown")
14
+ # async def shutdown_event():
15
+ # await bot.stop()
16
 
17
 
18
  @app.get("/")