SergeyO7 commited on
Commit
c4cfe74
·
verified ·
1 Parent(s): 3925d2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -90,11 +90,11 @@ async def process_question(agent, question_text: str, task_id: str, results_log:
90
  if e.status == 429:
91
  print(f"Rate limit hit for task {task_id}. Retrying after delay...")
92
  retry_delay *= 2 # Exponential backoff
93
- retry_delay += random.uniform(0, 5) # Jitter
94
  print(f"Retry #{attempt+1} in {retry_delay:.1f}s")
95
  await asyncio.sleep(retry_delay)
96
  while not token_bucket.consume(1):
97
- await asyncio.sleep(60 / RATE_LIMIT)
98
  try:
99
  submitted_answer = await agent(question_text)
100
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
@@ -160,7 +160,8 @@ async def run_and_submit_all(profile: gr.OAuthProfile | None):
160
  result = await process_question(agent, item["question"], item["task_id"], results_log)
161
  if result:
162
  answers_payload.append(result)
163
-
 
164
  if not answers_payload:
165
  print("Agent did not produce any answers to submit.")
166
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
 
90
  if e.status == 429:
91
  print(f"Rate limit hit for task {task_id}. Retrying after delay...")
92
  retry_delay *= 2 # Exponential backoff
93
+ # retry_delay += random.uniform(0, 5) # Jitter
94
  print(f"Retry #{attempt+1} in {retry_delay:.1f}s")
95
  await asyncio.sleep(retry_delay)
96
  while not token_bucket.consume(1):
97
+ await asyncio.sleep(60)
98
  try:
99
  submitted_answer = await agent(question_text)
100
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
 
160
  result = await process_question(agent, item["question"], item["task_id"], results_log)
161
  if result:
162
  answers_payload.append(result)
163
+ await asyncio.sleep(30)
164
+
165
  if not answers_payload:
166
  print("Agent did not produce any answers to submit.")
167
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)