assemblyline-core 4.8.0.dev1__tar.gz → 4.8.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/PKG-INFO +1 -1
- assemblyline_core-4.8.0.2/assemblyline_core/VERSION +1 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/controllers/interface.py +0 -10
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/controllers/kubernetes_ctl.py +5 -55
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/scaler_server.py +0 -20
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/PKG-INFO +1 -1
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/SOURCES.txt +0 -1
- assemblyline_core-4.8.0.2/test/test_scaler.py +53 -0
- assemblyline_core-4.8.0.dev1/assemblyline_core/VERSION +0 -1
- assemblyline_core-4.8.0.dev1/test/test_kubernetes_ctl.py +0 -204
- assemblyline_core-4.8.0.dev1/test/test_scaler.py +0 -129
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/LICENCE.md +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/README.md +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/processing.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/run_alerter.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/archiver/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/archiver/run_archiver.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/badlist_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/dispatcher.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/schedules.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/expiry/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/expiry/run_expiry.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/constants.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/ingester.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/es_metrics.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/heartbeat_formatter.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/helper.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/metrics_server.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/run_heartbeat_manager.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/run_metrics_aggregator.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/run_statistics_aggregator.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/creator/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/creator/run.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/creator/run_worker.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/loader/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/loader/run.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/loader/run_worker.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/replay.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/safelist_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/collection.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/controllers/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/controllers/docker_ctl.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/run_scaler.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/server_base.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/signature_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/submission_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/tasking_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/helper.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/run_updater.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/crawler.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/department_map.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/safelist.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/stream_map.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/worker.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/workflow/__init__.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/workflow/run_workflow.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/dependency_links.txt +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/requires.txt +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/top_level.txt +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/pyproject.toml +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/setup.cfg +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_alerter.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_badlist_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_expiry.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_replay.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_safelist_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_scheduler.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_signature_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_tasking_client.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_updater_helper.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_vacuum.py +0 -0
- {assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/test/test_workflow.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.8.0.2
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import math
|
|
4
2
|
from typing import TYPE_CHECKING, Optional
|
|
5
3
|
|
|
6
4
|
if TYPE_CHECKING:
|
|
@@ -34,14 +32,6 @@ class ControllerInterface:
|
|
|
34
32
|
"""Megabytes of RAM that has not been reserved."""
|
|
35
33
|
return self.memory_info()[0]
|
|
36
34
|
|
|
37
|
-
def pods_info(self) -> tuple[float, float]:
|
|
38
|
-
"""Return free and total pod slots in the system, unbounded where the orchestrator has no pod limit."""
|
|
39
|
-
return math.inf, math.inf
|
|
40
|
-
|
|
41
|
-
def free_pods(self) -> float:
|
|
42
|
-
"""Number of pod slots available for new containers."""
|
|
43
|
-
return self.pods_info()[0]
|
|
44
|
-
|
|
45
35
|
def get_target(self, service_name):
|
|
46
36
|
"""Get the target for running instances of a service."""
|
|
47
37
|
raise NotImplementedError()
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import base64
|
|
4
4
|
import functools
|
|
5
5
|
import json
|
|
6
|
-
import math
|
|
7
6
|
import os
|
|
8
7
|
import threading
|
|
9
8
|
import uuid
|
|
@@ -229,30 +228,6 @@ def get_resources(container) -> Tuple[float, float]:
|
|
|
229
228
|
return cpu_value, memory_value
|
|
230
229
|
|
|
231
230
|
|
|
232
|
-
def toleration_matches_taint(toleration: V1Toleration, taint: dict) -> bool:
|
|
233
|
-
"""Match a toleration against a raw node taint, following kube-scheduler's ToleratesTaint."""
|
|
234
|
-
if toleration.effect and toleration.effect != taint.get('effect'):
|
|
235
|
-
return False
|
|
236
|
-
if toleration.key and toleration.key != taint.get('key'):
|
|
237
|
-
return False
|
|
238
|
-
if toleration.operator == 'Exists':
|
|
239
|
-
return True
|
|
240
|
-
return (toleration.value or '') == (taint.get('value') or '')
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
def node_is_schedulable(node: dict, tolerations: list[V1Toleration]) -> bool:
|
|
244
|
-
"""Check whether service pods with the given tolerations can be placed on a raw node object."""
|
|
245
|
-
spec = node.get('spec', {})
|
|
246
|
-
if spec.get('unschedulable'):
|
|
247
|
-
return False
|
|
248
|
-
for taint in spec.get('taints') or []:
|
|
249
|
-
if taint.get('effect') not in ('NoSchedule', 'NoExecute'):
|
|
250
|
-
continue
|
|
251
|
-
if not any(toleration_matches_taint(toleration, taint) for toleration in tolerations):
|
|
252
|
-
return False
|
|
253
|
-
return True
|
|
254
|
-
|
|
255
|
-
|
|
256
231
|
def create_docker_auth_config(image: str, username: str, password: str) -> str:
|
|
257
232
|
# Take the registry part of the image if set, use the default registry if no registry component is in the string
|
|
258
233
|
if '/' in image:
|
|
@@ -375,10 +350,9 @@ class KubernetesController(ControllerInterface):
|
|
|
375
350
|
quota_background = threading.Thread(target=self._loop_forever(self._monitor_quotas), daemon=True)
|
|
376
351
|
quota_background.start()
|
|
377
352
|
|
|
378
|
-
self.ready_nodes: dict[str, tuple[float, float
|
|
353
|
+
self.ready_nodes: dict[str, tuple[float, float]] = {}
|
|
379
354
|
self._node_pool_max_ram: float = 0
|
|
380
355
|
self._node_pool_max_cpu: float = 0
|
|
381
|
-
self._node_pool_max_pods: float = 0
|
|
382
356
|
node_background = threading.Thread(target=self._loop_forever(self._monitor_node_pool), daemon=True)
|
|
383
357
|
node_background.start()
|
|
384
358
|
|
|
@@ -386,7 +360,6 @@ class KubernetesController(ControllerInterface):
|
|
|
386
360
|
self._pod_used_cpu: dict[str | None, float] = defaultdict(float)
|
|
387
361
|
self._pod_used_namespace_ram: dict[str | None, float] = defaultdict(float)
|
|
388
362
|
self._pod_used_namespace_cpu: dict[str | None, float] = defaultdict(float)
|
|
389
|
-
self._node_active_pods: dict[str | None, set[str]] = defaultdict(set)
|
|
390
363
|
self.node_count = 0
|
|
391
364
|
pod_background = threading.Thread(target=self._loop_forever(self._monitor_pods), daemon=True)
|
|
392
365
|
pod_background.start()
|
|
@@ -490,10 +463,9 @@ class KubernetesController(ControllerInterface):
|
|
|
490
463
|
def _monitor_node_pool(self) -> None:
|
|
491
464
|
self._node_pool_max_cpu = 0
|
|
492
465
|
self._node_pool_max_ram = 0
|
|
493
|
-
self._node_pool_max_pods = 0
|
|
494
466
|
self.node_count = 0
|
|
495
467
|
watch = Watch()
|
|
496
|
-
self.ready_nodes: dict[str, tuple[float, float
|
|
468
|
+
self.ready_nodes: dict[str, tuple[float, float]] = {}
|
|
497
469
|
field_selector, label_selector = selector_to_list_filters(self.linux_node_selector)
|
|
498
470
|
|
|
499
471
|
for event in watch.stream(func=self.api.list_node, field_selector=field_selector,
|
|
@@ -513,12 +485,10 @@ class KubernetesController(ControllerInterface):
|
|
|
513
485
|
ready = condition['status'] == 'True'
|
|
514
486
|
break
|
|
515
487
|
|
|
516
|
-
if ready
|
|
488
|
+
if ready:
|
|
517
489
|
cpu = parse_cpu(event['raw_object']['status']['allocatable']['cpu'])
|
|
518
490
|
ram = parse_memory(event['raw_object']['status']['allocatable']['memory'])
|
|
519
|
-
|
|
520
|
-
pods = float(event['raw_object']['status']['allocatable'].get('pods', math.inf))
|
|
521
|
-
self.ready_nodes[name] = (cpu, ram, pods)
|
|
491
|
+
self.ready_nodes[name] = (cpu, ram)
|
|
522
492
|
else:
|
|
523
493
|
self.ready_nodes.pop(name, None)
|
|
524
494
|
|
|
@@ -530,14 +500,11 @@ class KubernetesController(ControllerInterface):
|
|
|
530
500
|
self.node_count = len(self.ready_nodes)
|
|
531
501
|
max_cpu = 0.0
|
|
532
502
|
max_ram = 0.0
|
|
533
|
-
|
|
534
|
-
for cpu, ram, pods in self.ready_nodes.values():
|
|
503
|
+
for cpu, ram in self.ready_nodes.values():
|
|
535
504
|
max_cpu += cpu
|
|
536
505
|
max_ram += ram
|
|
537
|
-
max_pods += pods
|
|
538
506
|
self._node_pool_max_cpu = max_cpu
|
|
539
507
|
self._node_pool_max_ram = max_ram
|
|
540
|
-
self._node_pool_max_pods = max_pods
|
|
541
508
|
|
|
542
509
|
def _monitor_pods(self) -> None:
|
|
543
510
|
watch = Watch()
|
|
@@ -548,7 +515,6 @@ class KubernetesController(ControllerInterface):
|
|
|
548
515
|
self._pod_used_ram = defaultdict(float)
|
|
549
516
|
self._pod_used_namespace_cpu = defaultdict(float)
|
|
550
517
|
self._pod_used_namespace_ram = defaultdict(float)
|
|
551
|
-
self._node_active_pods = defaultdict(set)
|
|
552
518
|
|
|
553
519
|
kwargs = dict(WATCH_ARGS)
|
|
554
520
|
if self.cluster_pod_list:
|
|
@@ -577,13 +543,6 @@ class KubernetesController(ControllerInterface):
|
|
|
577
543
|
namespaced_containers = per_node_namespaced_containers[node]
|
|
578
544
|
|
|
579
545
|
if event['type'] in ['ADDED', 'MODIFIED']:
|
|
580
|
-
# Terminal pods stay listed until garbage collected but no longer hold a node's pod slot
|
|
581
|
-
if node is not None:
|
|
582
|
-
self._node_active_pods[None].discard(uid)
|
|
583
|
-
if event['raw_object']['status'].get('phase') in ('Succeeded', 'Failed'):
|
|
584
|
-
self._node_active_pods[node].discard(uid)
|
|
585
|
-
else:
|
|
586
|
-
self._node_active_pods[node].add(uid)
|
|
587
546
|
for container in event['raw_object']['spec']['containers']:
|
|
588
547
|
key = f"{uid}-{container['name']}"
|
|
589
548
|
|
|
@@ -609,8 +568,6 @@ class KubernetesController(ControllerInterface):
|
|
|
609
568
|
f"Last State: {lastState} "
|
|
610
569
|
f"with reason {detail.get('reason', 'UNKNOWN')}")
|
|
611
570
|
elif event['type'] == 'DELETED':
|
|
612
|
-
self._node_active_pods[node].discard(uid)
|
|
613
|
-
self._node_active_pods[None].discard(uid)
|
|
614
571
|
for container in event['raw_object']['spec']['containers']:
|
|
615
572
|
key = f"{uid}-{container['name']}"
|
|
616
573
|
containers.pop(key, None)
|
|
@@ -799,13 +756,6 @@ class KubernetesController(ControllerInterface):
|
|
|
799
756
|
return self._quota_mem_limit - self._get_pod_used_namespace_ram(), self._quota_mem_limit
|
|
800
757
|
return self._node_pool_max_ram - self._get_pod_used_ram(), self._node_pool_max_ram
|
|
801
758
|
|
|
802
|
-
def pods_info(self) -> tuple[float, float]:
|
|
803
|
-
# Without a cluster wide pod list, pods from other namespaces are invisible and the free count would be wrong
|
|
804
|
-
if not self.cluster_pod_list:
|
|
805
|
-
return math.inf, math.inf
|
|
806
|
-
used = sum(len(self._node_active_pods[name]) for name in self.ready_nodes.keys())
|
|
807
|
-
return self._node_pool_max_pods - used, self._node_pool_max_pods
|
|
808
|
-
|
|
809
759
|
def _create_containers(self, service_name: str, deployment_name: str, container_config, mounts, security_context,
|
|
810
760
|
core_container=False):
|
|
811
761
|
cores = container_config.cpu_cores
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/scaler_server.py
RENAMED
|
@@ -804,7 +804,6 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
804
804
|
# Get the processed resource numbers
|
|
805
805
|
free_cpu, _ = self.get_cpu_info(overallocation=True)
|
|
806
806
|
free_memory, _ = self.get_memory_info(overallocation=True)
|
|
807
|
-
free_pods = self.get_free_pods()
|
|
808
807
|
|
|
809
808
|
# Make adjustments to the targets until everything is satisified
|
|
810
809
|
# or we don't have the resouces to make more adjustments
|
|
@@ -813,10 +812,6 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
813
812
|
prof = [_p for _p in prof if _p.desired_instances > targets[_p.name]]
|
|
814
813
|
# only consider services where there is room for more pending containers
|
|
815
814
|
prof = [_p for _p in prof if _p.running_instances + self.max_pending > targets[_p.name]]
|
|
816
|
-
if free_pods < 1:
|
|
817
|
-
if prof:
|
|
818
|
-
self.log.debug("Can't make more because no pod slots are free %s", [_p.name for _p in prof])
|
|
819
|
-
return []
|
|
820
815
|
drop = [_p for _p in prof if _p.cpu > free_cpu or _p.ram > free_memory]
|
|
821
816
|
if drop:
|
|
822
817
|
summary = {_p.name: (_p.cpu, _p.ram) for _p in drop}
|
|
@@ -832,7 +827,6 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
832
827
|
# Add one for the profile at the bottom
|
|
833
828
|
free_memory -= remaining_profiles[0].container_config.ram_mb
|
|
834
829
|
free_cpu -= remaining_profiles[0].container_config.cpu_cores
|
|
835
|
-
free_pods -= 1
|
|
836
830
|
targets[remaining_profiles[0].name] += 1
|
|
837
831
|
|
|
838
832
|
# Take out any services that should be happy now
|
|
@@ -872,20 +866,6 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
872
866
|
|
|
873
867
|
return (free_cpu, total_cpu)
|
|
874
868
|
|
|
875
|
-
def get_free_pods(self) -> float:
|
|
876
|
-
# Overallocation relies on pending pods to drive a cluster autoscaler, which a pod slot cap would block
|
|
877
|
-
if self.get_cpu_overallocation() > 1 or self.get_memory_overallocation() > 1:
|
|
878
|
-
return math.inf
|
|
879
|
-
|
|
880
|
-
free_pods, _ = self.controller.pods_info()
|
|
881
|
-
|
|
882
|
-
# Include the service containers not counted in the raw numbers because they are pending
|
|
883
|
-
for name, pending in self.controller.get_unavailable().items():
|
|
884
|
-
if name in self.profiles and pending:
|
|
885
|
-
free_pods -= pending
|
|
886
|
-
|
|
887
|
-
return free_pods
|
|
888
|
-
|
|
889
869
|
def get_memory_info(self, overallocation: bool) -> tuple[float, float]:
|
|
890
870
|
# Get the raw used resource numbers
|
|
891
871
|
free_memory, total_memory = self.controller.memory_info()
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from assemblyline.odm.models.service import DockerConfig
|
|
2
|
+
from pytest import approx
|
|
3
|
+
from unittest.mock import Mock, patch
|
|
4
|
+
from assemblyline_core.scaler.collection import Collection
|
|
5
|
+
from assemblyline_core.scaler.scaler_server import ServiceProfile
|
|
6
|
+
|
|
7
|
+
mock_time = Mock()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@patch('time.time', mock_time)
|
|
11
|
+
def test_collection():
|
|
12
|
+
mock_time.return_value = 0
|
|
13
|
+
collection = Collection(60, ttl=61)
|
|
14
|
+
|
|
15
|
+
# Insert some sample data
|
|
16
|
+
collection.update('service-a', 'host-a', 30, 1)
|
|
17
|
+
collection.update('service-b', 'host-a', 60, 1)
|
|
18
|
+
mock_time.return_value = 30
|
|
19
|
+
collection.update('service-a', 'host-b', 30, 1)
|
|
20
|
+
|
|
21
|
+
assert collection.read('service-c') is None
|
|
22
|
+
assert collection.read('service-a')['instances'] == 2
|
|
23
|
+
assert collection.read('service-a')['duty_cycle'] == approx(0.5)
|
|
24
|
+
|
|
25
|
+
assert collection.read('service-b')['instances'] == 1
|
|
26
|
+
assert collection.read('service-b')['duty_cycle'] == approx(1)
|
|
27
|
+
|
|
28
|
+
# Move forward enough that the first two messages expire, send another message from the second
|
|
29
|
+
# service, now both should have one active message/host
|
|
30
|
+
mock_time.return_value = 62
|
|
31
|
+
collection.update('service-b', 'host-a', 30, 1)
|
|
32
|
+
|
|
33
|
+
assert collection.read('service-a')['instances'] == 1
|
|
34
|
+
assert collection.read('service-a')['duty_cycle'] == approx(0.5)
|
|
35
|
+
|
|
36
|
+
assert collection.read('service-b')['instances'] == 1
|
|
37
|
+
assert collection.read('service-b')['duty_cycle'] == approx(0.5)
|
|
38
|
+
|
|
39
|
+
# Move forward that the last of the original group of messages expire, but the update for the second
|
|
40
|
+
# service is still in effect
|
|
41
|
+
mock_time.return_value = 100
|
|
42
|
+
|
|
43
|
+
assert collection.read('service-a') is None
|
|
44
|
+
assert collection.read('service-b')['instances'] == 1
|
|
45
|
+
assert collection.read('service-b')['duty_cycle'] == approx(0.5)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_default_bucket_rates():
|
|
49
|
+
service = ServiceProfile('service', DockerConfig(dict(image='redis')))
|
|
50
|
+
before = service.pressure
|
|
51
|
+
service.update(5, 1, 1, 1)
|
|
52
|
+
print(service.pressure, before)
|
|
53
|
+
assert service.pressure > before
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4.8.0.dev1
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
from unittest.mock import Mock, patch
|
|
3
|
-
|
|
4
|
-
import pytest
|
|
5
|
-
from kubernetes.client import V1Toleration
|
|
6
|
-
|
|
7
|
-
from assemblyline.odm.models.config import Selector
|
|
8
|
-
from assemblyline_core.scaler.controllers.kubernetes_ctl import (
|
|
9
|
-
KubernetesController,
|
|
10
|
-
node_is_schedulable,
|
|
11
|
-
toleration_matches_taint,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def make_node(name='node-a', ready=True, unschedulable=False, taints=None, cpu='4', memory='8Gi', pods='110'):
|
|
16
|
-
spec = {}
|
|
17
|
-
if unschedulable:
|
|
18
|
-
spec['unschedulable'] = True
|
|
19
|
-
if taints is not None:
|
|
20
|
-
spec['taints'] = taints
|
|
21
|
-
return {
|
|
22
|
-
'metadata': {'name': name},
|
|
23
|
-
'spec': spec,
|
|
24
|
-
'status': {
|
|
25
|
-
'conditions': [{'type': 'Ready', 'status': 'True' if ready else 'False'}],
|
|
26
|
-
'allocatable': {'cpu': cpu, 'memory': memory, 'pods': pods},
|
|
27
|
-
},
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
CONTROL_PLANE = {'key': 'node-role.kubernetes.io/control-plane', 'effect': 'NoSchedule'}
|
|
32
|
-
DEDICATED = {'key': 'dedicated', 'value': 'system', 'effect': 'NoSchedule'}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@pytest.mark.parametrize('toleration, taint, expected', [
|
|
36
|
-
(V1Toleration(key='dedicated', operator='Equal', value='system', effect='NoSchedule'), DEDICATED, True),
|
|
37
|
-
(V1Toleration(key='dedicated', value='system'), DEDICATED, True),
|
|
38
|
-
(V1Toleration(key='dedicated', operator='Equal', value='other'), DEDICATED, False),
|
|
39
|
-
(V1Toleration(key='dedicated', operator='Exists'), DEDICATED, True),
|
|
40
|
-
(V1Toleration(key='other', operator='Exists'), DEDICATED, False),
|
|
41
|
-
(V1Toleration(key='dedicated', operator='Exists', effect='NoExecute'), DEDICATED, False),
|
|
42
|
-
(V1Toleration(operator='Exists'), DEDICATED, True),
|
|
43
|
-
(V1Toleration(key='node-role.kubernetes.io/control-plane', operator='Exists'), CONTROL_PLANE, True),
|
|
44
|
-
(V1Toleration(key='node-role.kubernetes.io/control-plane', operator='Equal'), CONTROL_PLANE, True),
|
|
45
|
-
])
|
|
46
|
-
def test_toleration_matches_taint(toleration, taint, expected):
|
|
47
|
-
assert toleration_matches_taint(toleration, taint) is expected
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def test_node_is_schedulable():
|
|
51
|
-
assert node_is_schedulable(make_node(), [])
|
|
52
|
-
assert node_is_schedulable(make_node(taints=[]), [])
|
|
53
|
-
assert not node_is_schedulable(make_node(unschedulable=True), [])
|
|
54
|
-
assert not node_is_schedulable(make_node(unschedulable=True), [V1Toleration(operator='Exists')])
|
|
55
|
-
|
|
56
|
-
# Only hard taints keep service pods off a node
|
|
57
|
-
assert not node_is_schedulable(make_node(taints=[CONTROL_PLANE]), [])
|
|
58
|
-
assert not node_is_schedulable(make_node(taints=[{**DEDICATED, 'effect': 'NoExecute'}]), [])
|
|
59
|
-
assert node_is_schedulable(make_node(taints=[{**DEDICATED, 'effect': 'PreferNoSchedule'}]), [])
|
|
60
|
-
|
|
61
|
-
# Every hard taint must be tolerated
|
|
62
|
-
tolerate_dedicated = [V1Toleration(key='dedicated', operator='Exists')]
|
|
63
|
-
assert node_is_schedulable(make_node(taints=[DEDICATED]), tolerate_dedicated)
|
|
64
|
-
assert not node_is_schedulable(make_node(taints=[DEDICATED, CONTROL_PLANE]), tolerate_dedicated)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def monitor_node_pool(events, tolerations=()):
|
|
68
|
-
ctl = KubernetesController.__new__(KubernetesController)
|
|
69
|
-
ctl.running = True
|
|
70
|
-
ctl.api = Mock()
|
|
71
|
-
ctl.linux_node_selector = Selector({})
|
|
72
|
-
ctl.default_service_tolerations = list(tolerations)
|
|
73
|
-
|
|
74
|
-
watch = Mock()
|
|
75
|
-
watch.stream.return_value = [{'type': kind, 'raw_object': node} for kind, node in events]
|
|
76
|
-
with patch('assemblyline_core.scaler.controllers.kubernetes_ctl.Watch', return_value=watch):
|
|
77
|
-
ctl._monitor_node_pool()
|
|
78
|
-
return ctl
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def test_monitor_node_pool_counts_only_schedulable_nodes():
|
|
82
|
-
ctl = monitor_node_pool([
|
|
83
|
-
('ADDED', make_node('worker', cpu='4', memory='8Gi')),
|
|
84
|
-
('ADDED', make_node('control-plane', taints=[CONTROL_PLANE], cpu='2', memory='4Gi')),
|
|
85
|
-
('ADDED', make_node('cordoned', unschedulable=True, cpu='8', memory='16Gi')),
|
|
86
|
-
('ADDED', make_node('not-ready', ready=False, cpu='8', memory='16Gi')),
|
|
87
|
-
])
|
|
88
|
-
|
|
89
|
-
assert set(ctl.ready_nodes) == {'worker'}
|
|
90
|
-
assert ctl.node_count == 1
|
|
91
|
-
assert ctl._node_pool_max_cpu == 4
|
|
92
|
-
assert ctl._node_pool_max_ram == 8 * 1024
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def test_monitor_node_pool_includes_tolerated_nodes():
|
|
96
|
-
ctl = monitor_node_pool([
|
|
97
|
-
('ADDED', make_node('worker', cpu='4', memory='8Gi')),
|
|
98
|
-
('ADDED', make_node('system', taints=[DEDICATED], cpu='2', memory='4Gi')),
|
|
99
|
-
], tolerations=[V1Toleration(key='dedicated', operator='Equal', value='system', effect='NoSchedule')])
|
|
100
|
-
|
|
101
|
-
assert set(ctl.ready_nodes) == {'worker', 'system'}
|
|
102
|
-
assert ctl._node_pool_max_cpu == 6
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def test_monitor_node_pool_drops_node_when_cordoned():
|
|
106
|
-
ctl = monitor_node_pool([
|
|
107
|
-
('ADDED', make_node('worker-a')),
|
|
108
|
-
('ADDED', make_node('worker-b')),
|
|
109
|
-
('MODIFIED', make_node('worker-b', unschedulable=True)),
|
|
110
|
-
])
|
|
111
|
-
|
|
112
|
-
assert set(ctl.ready_nodes) == {'worker-a'}
|
|
113
|
-
assert ctl._node_pool_max_cpu == 4
|
|
114
|
-
|
|
115
|
-
ctl = monitor_node_pool([
|
|
116
|
-
('ADDED', make_node('worker-a', unschedulable=True)),
|
|
117
|
-
('MODIFIED', make_node('worker-a')),
|
|
118
|
-
])
|
|
119
|
-
|
|
120
|
-
assert set(ctl.ready_nodes) == {'worker-a'}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def test_monitor_node_pool_sums_pod_capacity():
|
|
124
|
-
ctl = monitor_node_pool([
|
|
125
|
-
('ADDED', make_node('worker-a', pods='110')),
|
|
126
|
-
('ADDED', make_node('worker-b', pods='30')),
|
|
127
|
-
('ADDED', make_node('control-plane', taints=[CONTROL_PLANE], pods='110')),
|
|
128
|
-
])
|
|
129
|
-
|
|
130
|
-
assert ctl._node_pool_max_pods == 140
|
|
131
|
-
|
|
132
|
-
node = make_node('virtual')
|
|
133
|
-
del node['status']['allocatable']['pods']
|
|
134
|
-
ctl = monitor_node_pool([('ADDED', make_node('worker-a')), ('ADDED', node)])
|
|
135
|
-
assert ctl._node_pool_max_pods == math.inf
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def make_pod(uid, node, phase='Running', namespace='al'):
|
|
139
|
-
return {
|
|
140
|
-
'metadata': {'name': f'pod-{uid}', 'uid': uid, 'namespace': namespace},
|
|
141
|
-
'spec': {
|
|
142
|
-
'nodeName': node,
|
|
143
|
-
'containers': [{'name': 'main', 'resources': {'requests': {'cpu': '100m', 'memory': '64Mi'}}}],
|
|
144
|
-
},
|
|
145
|
-
'status': {'phase': phase},
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def pod_controller(node_pods, cluster_pod_list=True):
|
|
150
|
-
ctl = KubernetesController.__new__(KubernetesController)
|
|
151
|
-
ctl.running = True
|
|
152
|
-
ctl.api = Mock()
|
|
153
|
-
ctl.logger = Mock()
|
|
154
|
-
ctl.namespace = 'al'
|
|
155
|
-
ctl.cluster_pod_list = cluster_pod_list
|
|
156
|
-
ctl.ready_nodes = {name: (4.0, 8192.0, pods) for name, pods in node_pods.items()}
|
|
157
|
-
ctl._node_pool_max_pods = sum(node_pods.values())
|
|
158
|
-
return ctl
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def monitor_pods(ctl, events):
|
|
162
|
-
watch = Mock()
|
|
163
|
-
watch.stream.return_value = [{'type': kind, 'raw_object': pod} for kind, pod in events]
|
|
164
|
-
with patch('assemblyline_core.scaler.controllers.kubernetes_ctl.Watch', return_value=watch):
|
|
165
|
-
ctl._monitor_pods()
|
|
166
|
-
return ctl
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def test_pods_info_counts_active_pods_on_schedulable_nodes():
|
|
170
|
-
ctl = monitor_pods(pod_controller({'worker-a': 10, 'worker-b': 5}), [
|
|
171
|
-
('ADDED', make_pod('1', 'worker-a')),
|
|
172
|
-
('ADDED', make_pod('2', 'worker-a', namespace='kube-system')),
|
|
173
|
-
('ADDED', make_pod('3', 'worker-b', phase='Pending')),
|
|
174
|
-
# Terminal pods don't occupy a slot
|
|
175
|
-
('ADDED', make_pod('4', 'worker-b', phase='Succeeded')),
|
|
176
|
-
('ADDED', make_pod('5', 'worker-b', phase='Failed')),
|
|
177
|
-
# Pods on nodes outside the pool, or not yet bound to a node, aren't counted
|
|
178
|
-
('ADDED', make_pod('6', 'control-plane')),
|
|
179
|
-
('ADDED', make_pod('7', None, phase='Pending')),
|
|
180
|
-
])
|
|
181
|
-
|
|
182
|
-
assert ctl.pods_info() == (12, 15)
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
def test_pods_info_tracks_pod_lifecycle():
|
|
186
|
-
ctl = monitor_pods(pod_controller({'worker-a': 10}), [
|
|
187
|
-
('ADDED', make_pod('1', None, phase='Pending')),
|
|
188
|
-
('MODIFIED', make_pod('1', 'worker-a', phase='Pending')),
|
|
189
|
-
('MODIFIED', make_pod('1', 'worker-a', phase='Running')),
|
|
190
|
-
('ADDED', make_pod('2', 'worker-a')),
|
|
191
|
-
('MODIFIED', make_pod('2', 'worker-a', phase='Succeeded')),
|
|
192
|
-
('ADDED', make_pod('3', 'worker-a')),
|
|
193
|
-
('DELETED', make_pod('3', 'worker-a')),
|
|
194
|
-
])
|
|
195
|
-
|
|
196
|
-
assert ctl.pods_info() == (9, 10)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
def test_pods_info_unbounded_without_cluster_pod_list():
|
|
200
|
-
ctl = monitor_pods(pod_controller({'worker-a': 10}, cluster_pod_list=False), [
|
|
201
|
-
('ADDED', make_pod('1', 'worker-a')),
|
|
202
|
-
])
|
|
203
|
-
|
|
204
|
-
assert ctl.pods_info() == (math.inf, math.inf)
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
import threading
|
|
3
|
-
|
|
4
|
-
from assemblyline.odm.models.service import DockerConfig
|
|
5
|
-
from pytest import approx
|
|
6
|
-
from unittest.mock import Mock, patch
|
|
7
|
-
from assemblyline_core.scaler.collection import Collection
|
|
8
|
-
from assemblyline_core.scaler.controllers.interface import ControllerInterface
|
|
9
|
-
from assemblyline_core.scaler.scaler_server import ScalerServer, ServiceProfile
|
|
10
|
-
from assemblyline_core.server_base import ServiceStage
|
|
11
|
-
|
|
12
|
-
mock_time = Mock()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@patch('time.time', mock_time)
|
|
16
|
-
def test_collection():
|
|
17
|
-
mock_time.return_value = 0
|
|
18
|
-
collection = Collection(60, ttl=61)
|
|
19
|
-
|
|
20
|
-
# Insert some sample data
|
|
21
|
-
collection.update('service-a', 'host-a', 30, 1)
|
|
22
|
-
collection.update('service-b', 'host-a', 60, 1)
|
|
23
|
-
mock_time.return_value = 30
|
|
24
|
-
collection.update('service-a', 'host-b', 30, 1)
|
|
25
|
-
|
|
26
|
-
assert collection.read('service-c') is None
|
|
27
|
-
assert collection.read('service-a')['instances'] == 2
|
|
28
|
-
assert collection.read('service-a')['duty_cycle'] == approx(0.5)
|
|
29
|
-
|
|
30
|
-
assert collection.read('service-b')['instances'] == 1
|
|
31
|
-
assert collection.read('service-b')['duty_cycle'] == approx(1)
|
|
32
|
-
|
|
33
|
-
# Move forward enough that the first two messages expire, send another message from the second
|
|
34
|
-
# service, now both should have one active message/host
|
|
35
|
-
mock_time.return_value = 62
|
|
36
|
-
collection.update('service-b', 'host-a', 30, 1)
|
|
37
|
-
|
|
38
|
-
assert collection.read('service-a')['instances'] == 1
|
|
39
|
-
assert collection.read('service-a')['duty_cycle'] == approx(0.5)
|
|
40
|
-
|
|
41
|
-
assert collection.read('service-b')['instances'] == 1
|
|
42
|
-
assert collection.read('service-b')['duty_cycle'] == approx(0.5)
|
|
43
|
-
|
|
44
|
-
# Move forward that the last of the original group of messages expire, but the update for the second
|
|
45
|
-
# service is still in effect
|
|
46
|
-
mock_time.return_value = 100
|
|
47
|
-
|
|
48
|
-
assert collection.read('service-a') is None
|
|
49
|
-
assert collection.read('service-b')['instances'] == 1
|
|
50
|
-
assert collection.read('service-b')['duty_cycle'] == approx(0.5)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def test_default_bucket_rates():
|
|
54
|
-
service = ServiceProfile('service', DockerConfig(dict(image='redis')))
|
|
55
|
-
before = service.pressure
|
|
56
|
-
service.update(5, 1, 1, 1)
|
|
57
|
-
print(service.pressure, before)
|
|
58
|
-
assert service.pressure > before
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def make_profile(name, desired):
|
|
62
|
-
profile = ServiceProfile(name, DockerConfig(dict(image='redis', cpu_cores=1, ram_mb=1024)))
|
|
63
|
-
profile.desired_instances = desired
|
|
64
|
-
return profile
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def run_scaling_pass(profiles, pods, targets=None, unavailable=None, cpu_overallocation=1.0,
|
|
68
|
-
memory_overallocation=1.0, overallocation_node_limit=None, node_count=3):
|
|
69
|
-
"""Run one iteration of ScalerServer.update_scaling against a mocked controller with ample CPU/RAM."""
|
|
70
|
-
server = ScalerServer.__new__(ScalerServer)
|
|
71
|
-
server.log = Mock()
|
|
72
|
-
server.apm_client = None
|
|
73
|
-
server.max_pending = 50
|
|
74
|
-
server.profiles = {profile.name: profile for profile in profiles}
|
|
75
|
-
server.profiles_lock = threading.RLock()
|
|
76
|
-
server.get_service_stage = Mock(return_value=ServiceStage.Running)
|
|
77
|
-
server.sleep = Mock(side_effect=[True, False])
|
|
78
|
-
|
|
79
|
-
server.config = Mock()
|
|
80
|
-
server.config.core.scaler.cpu_overallocation = cpu_overallocation
|
|
81
|
-
server.config.core.scaler.memory_overallocation = memory_overallocation
|
|
82
|
-
server.config.core.scaler.overallocation_node_limit = overallocation_node_limit
|
|
83
|
-
|
|
84
|
-
server.controller = Mock()
|
|
85
|
-
server.controller.node_count = node_count
|
|
86
|
-
server.controller.get_targets.return_value = dict(targets or {})
|
|
87
|
-
server.controller.get_unavailable.return_value = dict(unavailable or {})
|
|
88
|
-
server.controller.cpu_info.return_value = (1000.0, 1000.0)
|
|
89
|
-
server.controller.memory_info.return_value = (1024.0 * 1000, 1024.0 * 1000)
|
|
90
|
-
server.controller.pods_info.return_value = pods
|
|
91
|
-
|
|
92
|
-
server.update_scaling()
|
|
93
|
-
return {profile.name: profile.target_instances for profile in profiles}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def test_controller_pods_info_defaults_to_unbounded():
|
|
97
|
-
assert ControllerInterface().pods_info() == (math.inf, math.inf)
|
|
98
|
-
assert ControllerInterface().free_pods() == math.inf
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def test_scaling_unbounded_by_default_pod_info():
|
|
102
|
-
targets = run_scaling_pass([make_profile('a', 10), make_profile('b', 10)], pods=(math.inf, math.inf))
|
|
103
|
-
assert targets == {'a': 10, 'b': 10}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def test_scaling_stops_when_pod_slots_run_out():
|
|
107
|
-
targets = run_scaling_pass([make_profile('a', 10), make_profile('b', 10)], pods=(5, 100))
|
|
108
|
-
assert sum(targets.values()) == 5
|
|
109
|
-
assert abs(targets['a'] - targets['b']) <= 1
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def test_scaling_reserves_pod_slots_for_pending_containers():
|
|
113
|
-
targets = run_scaling_pass([make_profile('a', 10)], pods=(5, 100), targets={'a': 2}, unavailable={'a': 2})
|
|
114
|
-
assert targets == {'a': 5}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def test_scaling_ignores_pod_slots_while_overallocating():
|
|
118
|
-
# Overallocation relies on pending pods to drive a cluster autoscaler, so pod slots can't cap it
|
|
119
|
-
targets = run_scaling_pass([make_profile('a', 10)], pods=(5, 100), cpu_overallocation=2.0)
|
|
120
|
-
assert targets == {'a': 10}
|
|
121
|
-
|
|
122
|
-
targets = run_scaling_pass([make_profile('a', 10)], pods=(5, 100), memory_overallocation=1.5)
|
|
123
|
-
assert targets == {'a': 10}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def test_scaling_respects_pod_slots_past_overallocation_node_limit():
|
|
127
|
-
targets = run_scaling_pass([make_profile('a', 10)], pods=(5, 100), cpu_overallocation=2.0,
|
|
128
|
-
overallocation_node_limit=3, node_count=3)
|
|
129
|
-
assert targets == {'a': 5}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/processing.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/alerter/run_alerter.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/archiver/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/badlist_client.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/dispatching/client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/expiry/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/expiry/run_expiry.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/constants.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/ingester/ingester.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/es_metrics.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/metrics/helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/client.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/creator/run.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/loader/run.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/replay/replay.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/safelist_client.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/collection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/scaler/run_scaler.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/signature_client.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/submission_client.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/tasking_client.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/helper.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/updater/run_updater.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/__init__.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/crawler.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/safelist.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/stream_map.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/vacuum/worker.py
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core/workflow/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{assemblyline_core-4.8.0.dev1 → assemblyline_core-4.8.0.2}/assemblyline_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|