diff --git a/scripts/deployment/delete_old_submissions.py b/scripts/deployment/delete_old_submissions.py index 0de18ba13c..92d1a2ad23 100644 --- a/scripts/deployment/delete_old_submissions.py +++ b/scripts/deployment/delete_old_submissions.py @@ -5,8 +5,8 @@ # Define the directory path tmp_directory = '/tmp' -# Calculate the cutoff time (60 seconds ago) -cutoff_time = time.time() - 60 # 60 seconds +# Calculate the cutoff time (5 minutes ago) +cutoff_time = time.time() - 5 * 60 # 5 minutes ago # List all directories in /tmp starting with 'tmp' tmp_folders = [d for d in os.listdir(tmp_directory) if os.path.isdir(os.path.join(tmp_directory, d)) and d.startswith('tmp')] @@ -14,10 +14,10 @@ for folder in tmp_folders: folder_path = os.path.join(tmp_directory, folder) - # Check if the folder was created more than 60 seconds ago + # Check if the folder was created more than 5 minutes ago folder_creation_time = os.path.getctime(folder_path) if folder_creation_time < cutoff_time: shutil.rmtree(folder_path) print(f"Deleted folder: {folder_path}") else: - print(f"Skipped folder: {folder_path} (created less than 60 seconds ago)") + print(f"Skipped folder: {folder_path} (created less than 5 minutes ago)") diff --git a/scripts/deployment/deploy_ec2_worker.sh b/scripts/deployment/deploy_ec2_worker.sh index ec5e97bd45..c72612a0d4 100644 --- a/scripts/deployment/deploy_ec2_worker.sh +++ b/scripts/deployment/deploy_ec2_worker.sh @@ -70,7 +70,7 @@ docker cp "scripts/deployment/delete_old_submissions.py" "worker_${QUEUE}:/code/ # Step 11: Setting up crontab echo "Step 11/11: Setting up crontab" echo "@reboot docker restart worker_${QUEUE}" >> workercron -echo "@reboot docker exec -it worker_${QUEUE} python delete_old_submissions.py" >> workercron +echo "@reboot docker exec -it worker_${QUEUE} python delete_old_submissions.py > delete_old_submissions.txt" >> workercron crontab workercron rm workercron