TzurVaich commited on
Commit
64d4c20
·
1 Parent(s): 6dc8158

Abort if status file not found

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -921,17 +921,25 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
921
 
922
  # Load previous results if available
923
  previous_results = {}
 
 
 
 
924
  try:
925
- if os.path.exists('results_log_status.json'):
926
- with open('results_log_status.json', 'r') as f:
927
  previous_results_list = json.load(f)
928
  # Convert to dictionary with task_id as key for easier lookup
929
  for item in previous_results_list:
930
  previous_results[item.get("Task ID")] = item
931
  print(f"Loaded {len(previous_results)} previous results")
 
 
 
932
  except Exception as e:
933
  print(f"Error loading previous results: {e}")
934
  # Continue without previous results if there's an error
 
935
 
936
  print(f"Running agent on {len(questions_data)} questions...")
937
  for idx, item in enumerate(questions_data):
 
921
 
922
  # Load previous results if available
923
  previous_results = {}
924
+ current_script_dir = os.path.dirname(os.path.abspath(__file__))
925
+ results_log_status_path = os.path.join(
926
+ current_script_dir, 'results_log_status.json')
927
+
928
  try:
929
+ if os.path.exists(results_log_status_path):
930
+ with open(results_log_status_path, 'r', encoding='utf-8') as f:
931
  previous_results_list = json.load(f)
932
  # Convert to dictionary with task_id as key for easier lookup
933
  for item in previous_results_list:
934
  previous_results[item.get("Task ID")] = item
935
  print(f"Loaded {len(previous_results)} previous results")
936
+ else:
937
+ return f"{results_log_status_path} not found", None
938
+
939
  except Exception as e:
940
  print(f"Error loading previous results: {e}")
941
  # Continue without previous results if there's an error
942
+ return "results_log_status.json not found", None
943
 
944
  print(f"Running agent on {len(questions_data)} questions...")
945
  for idx, item in enumerate(questions_data):