diff --git a/ai_ta_backend/beam/cron_jobs.py b/ai_ta_backend/beam/cron_jobs.py index d7f55195..2898d275 100644 --- a/ai_ta_backend/beam/cron_jobs.py +++ b/ai_ta_backend/beam/cron_jobs.py @@ -9,9 +9,9 @@ from beam import schedule -@schedule(when="@daily", name="update-nomic-maps") +@schedule(when="0 6 * * *", name="update-nomic-maps") def task(): - print("Hi, from your task running at midnight daily!") + print("Hi, from your task running at 6 AM UTC (12 AM CST) daily!") base_url = "https://flask-production-751b.up.railway.app" # Update conversation maps @@ -26,16 +26,16 @@ def task(): except Exception as e: print(f"Error updating conversation maps: {str(e)}") - # Update document maps - url = f"{base_url}/updateDocumentMaps" - try: - response = requests.get(url, timeout=30) - if response.status_code == 200: - print("Document maps updated successfully") - else: - print(f"Failed to update document maps - Status code: {response.status_code}") - print(f"Response text: {response.text}") - except Exception as e: - print(f"Error updating document maps: {str(e)}") + # # Update document maps + # url = f"{base_url}/updateDocumentMaps" + # try: + # response = requests.get(url, timeout=30) + # if response.status_code == 200: + # print("Document maps updated successfully") + # else: + # print(f"Failed to update document maps - Status code: {response.status_code}") + # print(f"Response text: {response.text}") + # except Exception as e: + # print(f"Error updating document maps: {str(e)}") return "Task completed successfully" diff --git a/ai_ta_backend/service/nomic_service.py b/ai_ta_backend/service/nomic_service.py index 6517ce2e..51d0e484 100644 --- a/ai_ta_backend/service/nomic_service.py +++ b/ai_ta_backend/service/nomic_service.py @@ -121,6 +121,7 @@ def update_conversation_maps(self): else: print(f"Error in updating conversation map: {result}") + break combined_dfs = [] self.rebuild_map(course_name, "conversation") @@ -530,7 +531,7 @@ def append_to_map(self, metadata, map_name): # print("Project is currently indexing. Try again later.") # return "Project busy" start_time = time.monotonic() - while time.monotonic() - start_time < 180: + while time.monotonic() - start_time < 30: if project.is_accepting_data: project.add_data(data=metadata) print(f"Data appended to map: {map_name}")