@@ -114,40 +114,6 @@ jobs:
114114          from azure.storage.queue import QueueServiceClient 
115115          from azure.identity import DefaultAzureCredential 
116116
117-           def cancel_other_workers(): 
118-               # Get GitHub token from environment 
119-               token = os.environ.get('GITHUB_TOKEN') 
120-               if not token: 
121-                   print("No GitHub token available to cancel other workers") 
122-                   return 
123- 
124-               # Get current run ID and worker ID 
125-               run_id = os.environ.get('GITHUB_RUN_ID') 
126-               current_worker = os.environ.get('WORKER_ID') 
127- 
128-               headers = { 
129-                   'Authorization': f'token {token}', 
130-                   'Accept': 'application/vnd.github.v3+json' 
131-               } 
132- 
133-               # Get all jobs in the current workflow run 
134-               url = f"https://api.github.com/repos/{os.environ.get('GITHUB_REPOSITORY')}/actions/runs/{run_id}/jobs" 
135-               response = requests.get(url, headers=headers) 
136-               if response.status_code == 200: 
137-                   jobs = response.json()['jobs'] 
138- 
139-                   # Cancel other read-events jobs 
140-                   for job in jobs: 
141-                       if (job['name'].startswith('read-events') and 
142-                           job['name'] != f"read-events-{current_worker}" and 
143-                           job['status'] in ['queued', 'in_progress']): 
144-                           cancel_url = f"{url}/{job['id']}/cancel" 
145-                           cancel_response = requests.post(cancel_url, headers=headers) 
146-                           if cancel_response.status_code == 202: 
147-                               print(f"Cancelled job {job['id']} ({job['name']})") 
148-                           else: 
149-                               print(f"Failed to cancel job {job['id']}: {cancel_response.text}") 
150- 
151117          # Create queue service client using managed identity 
152118          account_url = f"https://{os.environ.get('AZURE_QUEUE_STORAGE_ACCOUNT')}.queue.core.windows.net" 
153119          queue_name = os.environ.get('AZURE_STORAGE_QUEUE_NAME') 
@@ -177,7 +143,6 @@ jobs:
177143
178144          if attempt >= max_attempts: 
179145              print(f"Worker {worker_id}: No messages found in queue after waiting - exiting successfully") 
180-               cancel_other_workers() 
181146              exit(0) 
182147
183148          # Receive and process messages 
@@ -186,7 +151,6 @@ jobs:
186151                  messages = queue_client.receive_messages(messages_per_page=1) 
187152                  if not messages: 
188153                      print(f"Worker {worker_id}: No more messages in queue - exiting successfully") 
189-                       cancel_other_workers() 
190154                      exit(0) 
191155
192156                  for message in messages: 
@@ -200,7 +164,6 @@ jobs:
200164                          peek_messages = queue_client.peek_messages(max_messages=1) 
201165                          if not peek_messages: 
202166                              print(f"Worker {worker_id}: No more messages in queue - exiting successfully") 
203-                               cancel_other_workers() 
204167                              exit(0) 
205168                      except json.JSONDecodeError as e: 
206169                          print(f"Worker {worker_id}: Error decoding message: {e}") 
0 commit comments