Mbonea commited on
Commit
a7f0c59
1 Parent(s): ad2afc2

only when you need it

Browse files
Files changed (1) hide show
  1. App/Worker.py +2 -7
App/Worker.py CHANGED
@@ -18,13 +18,6 @@ celery.conf.update(
18
  )
19
 
20
 
21
- @worker_process_init.connect
22
- def worker_process_init_handler(**kwargs):
23
- task = kwargs.get("task")
24
- if task == "RenderFile":
25
- bot.start()
26
-
27
-
28
  @celery.task(name="CreateFile")
29
  def create_json_file(assets: List[Assets], asset_dir: str):
30
  for asset in assets:
@@ -92,6 +85,7 @@ def download_assets(links: List[LinkInfo], temp_dir: str):
92
  def render_video(directory: str, output_directory: str):
93
  os.chdir(directory)
94
  os.system(f"npm run build --output {output_directory}")
 
95
  bot.send_file(-1002069945904, file=output_directory, caption="Your video caption")
96
  print("complete")
97
 
@@ -102,6 +96,7 @@ def cleanup_temp_directory(
102
  ):
103
  try:
104
  print("sending...")
 
105
  bot.send_file(chat_id, file=output_dir, caption="Your video caption")
106
  except Exception as e:
107
  print(e)
 
18
  )
19
 
20
 
 
 
 
 
 
 
 
21
  @celery.task(name="CreateFile")
22
  def create_json_file(assets: List[Assets], asset_dir: str):
23
  for asset in assets:
 
85
  def render_video(directory: str, output_directory: str):
86
  os.chdir(directory)
87
  os.system(f"npm run build --output {output_directory}")
88
+ bot.start()
89
  bot.send_file(-1002069945904, file=output_directory, caption="Your video caption")
90
  print("complete")
91
 
 
96
  ):
97
  try:
98
  print("sending...")
99
+ bot.start()
100
  bot.send_file(chat_id, file=output_dir, caption="Your video caption")
101
  except Exception as e:
102
  print(e)