Tejasva commited on
Commit
cb28453
·
1 Parent(s): 9d46037

fix: main() - single START, single END, no variants

Browse files
Files changed (1) hide show
  1. inference.py +5 -9
inference.py CHANGED
@@ -405,26 +405,22 @@ def train_agent(num_episodes: int = 10) -> AgentState:
405
  def main():
406
  """Main inference loop with RL training."""
407
  try:
408
- # Setup client and get environment variables
409
- client, MODEL_NAME = setup_openai_client()
410
 
411
- # Optional Docker support
412
  if LOCAL_IMAGE_NAME:
413
- print(f"START: inference (Docker image: {LOCAL_IMAGE_NAME})")
414
  else:
415
- print("START")
416
  print("STEP: Starting inference")
417
 
418
- # Run RL training
419
  agent_state = train_agent(num_episodes=10)
420
- print("END: done")
421
- logger.info("END: RL training completed successfully")
422
  return 0
423
 
424
  except Exception as e:
425
- print("END")
426
  logger.error(f"Inference failed: {e}")
427
  return 1
 
 
428
 
429
  if __name__ == "__main__":
430
  exit(main())
 
405
  def main():
406
  """Main inference loop with RL training."""
407
  try:
408
+ print("START")
 
409
 
410
+ LOCAL_IMAGE_NAME = os.getenv("LOCAL_IMAGE_NAME")
411
  if LOCAL_IMAGE_NAME:
412
+ print(f"STEP: inference using Docker image {LOCAL_IMAGE_NAME}")
413
  else:
 
414
  print("STEP: Starting inference")
415
 
 
416
  agent_state = train_agent(num_episodes=10)
 
 
417
  return 0
418
 
419
  except Exception as e:
 
420
  logger.error(f"Inference failed: {e}")
421
  return 1
422
+ finally:
423
+ print("END")
424
 
425
  if __name__ == "__main__":
426
  exit(main())