Skip to content

Commit dcc1df3

Browse files
authored
Merge branch 'main' into malformat
2 parents 2622247 + 05358e0 commit dcc1df3

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/aap_eda/services/activation/engine/podman.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ def cleanup(self, container_id: str, log_handler: LogHandler) -> None:
100100
# ContainerCleanupError handled by the manager
101101
except APIError as e:
102102
raise exceptions.ContainerCleanupError(str(e)) from e
103+
finally:
104+
# Ensure volumes are purged due to a bug in podman
105+
# ref: https://github.com/containers/podman-py/issues/328
106+
pruned_volumes = self.client.volumes.prune()
107+
LOGGER.info(f"Pruned volumes: {pruned_volumes}")
103108

104109
def _image_exists(self, image_url: str) -> bool:
105110
try:

src/aap_eda/services/activation/manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,13 @@ def _get_container_request(self) -> ContainerRequest:
10751075
@staticmethod
10761076
def check_new_process_allowed(parent_type: str, parent_id: int) -> bool:
10771077
"""Check if a new process is allowed."""
1078+
if settings.MAX_RUNNING_ACTIVATIONS < 0:
1079+
return True
1080+
10781081
num_running_processes = models.RulebookProcess.objects.filter(
10791082
status__in=[ActivationStatus.RUNNING, ActivationStatus.STARTING],
10801083
).count()
1084+
10811085
if num_running_processes >= settings.MAX_RUNNING_ACTIVATIONS:
10821086
LOGGER.info(
10831087
"No capacity to start a new rulebook process. "

src/aap_eda/settings/default.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ def _get_secret_key() -> str:
447447
ACTIVATION_MAX_RESTARTS_ON_FAILURE = int(
448448
settings.get("ACTIVATION_MAX_RESTARTS_ON_FAILURE", 5)
449449
)
450+
451+
# -1 means no limit
450452
MAX_RUNNING_ACTIVATIONS = int(settings.get("MAX_RUNNING_ACTIVATIONS", 5))
451453

452454
# ---------------------------------------------------------

0 commit comments

Comments
 (0)