Skip to content

Commit

Permalink
Remove unused queue.stop_jobs and rename JobQueue.stop_jobs_async -> …
Browse files Browse the repository at this point in the history
…JobQueue.stop_jobs
  • Loading branch information
xjules committed Jan 10, 2024
1 parent 18ac76c commit df1ca32
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/ert/job_queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,9 @@
import json
import logging
import ssl
import time
from collections import deque
from threading import BoundedSemaphore, Semaphore
from typing import (
TYPE_CHECKING,
Callable,
Dict,
List,
Optional,
Sequence,
Tuple,
Union,
)
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Sequence, Tuple, Union

from cloudevents.conversion import to_json
from cloudevents.http import CloudEvent
Expand Down Expand Up @@ -202,13 +192,7 @@ def max_running(self) -> int:
def available_capacity(self) -> bool:
return not self.stopped and self.count_running() < self.max_running()

def stop_jobs(self) -> None:
for job in self.job_list:
job.stop()
while self.is_active():
time.sleep(1)

async def stop_jobs_async(self) -> None:
async def stop_jobs(self) -> None:
for job in self.job_list:
job.stop()
while self.is_active():
Expand Down Expand Up @@ -325,7 +309,7 @@ async def execute(

if self.stopped:
logger.debug("queue cancelled, stopping jobs...")
await self.stop_jobs_async()
await self.stop_jobs()
await self._changes_to_publish.put(CLOSE_PUBLISHER_SENTINEL)
return EVTYPE_ENSEMBLE_CANCELLED

Expand All @@ -337,7 +321,7 @@ async def execute(
"unexpected exception in queue",
exc_info=True,
)
await self.stop_jobs_async()
await self.stop_jobs()
logger.debug("jobs stopped, re-raising exception")
return EVTYPE_ENSEMBLE_FAILED

Expand Down

0 comments on commit df1ca32

Please sign in to comment.