assemblyline-core 4.4.0.57__tar.gz → 4.4.0.59__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.
Potentially problematic release.
This version of assemblyline-core might be problematic. Click here for more details.
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/PKG-INFO +1 -1
- assemblyline-core-4.4.0.59/assemblyline_core/VERSION +1 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/client.py +3 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/dispatcher.py +4 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/ingester.py +62 -2
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/controllers/docker_ctl.py +4 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/controllers/kubernetes_ctl.py +8 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/scaler_server.py +50 -11
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/PKG-INFO +1 -1
- assemblyline-core-4.4.0.57/assemblyline_core/VERSION +0 -1
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/LICENCE.md +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/README.md +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/processing.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/run_alerter.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/archiver/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/archiver/run_archiver.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/__main__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/schedules.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/timeout.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/expiry/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/expiry/run_expiry.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/__main__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/constants.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/es_metrics.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/heartbeat_formatter.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/helper.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/metrics_server.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/run_heartbeat_manager.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/run_metrics_aggregator.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/run_statistics_aggregator.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/plumber/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/plumber/run_plumber.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/client.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/creator/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/creator/run.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/creator/run_worker.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/loader/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/loader/run.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/loader/run_worker.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/replay.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/safelist_client.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/collection.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/controllers/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/controllers/interface.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/run_scaler.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/server_base.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/submission_client.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/tasking_client.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/helper.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/run_updater.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/crawler.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/department_map.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/safelist.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/stream_map.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/worker.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/workflow/__init__.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/workflow/run_workflow.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/SOURCES.txt +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/dependency_links.txt +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/requires.txt +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/top_level.txt +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/setup.cfg +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/setup.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_alerter.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_dispatcher.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_expiry.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_plumber.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_replay.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_scaler.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_scheduler.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_simulation.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_vacuum.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_worker_ingest.py +0 -0
- {assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/test/test_worker_submit.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.4.0.59
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/client.py
RENAMED
|
@@ -164,6 +164,9 @@ class DispatchClient:
|
|
|
164
164
|
dispatcher_id = queue.pop(timeout=5)
|
|
165
165
|
listed_dispatchers.discard(dispatcher_id)
|
|
166
166
|
|
|
167
|
+
def queued_submissions(self) -> list[dict]:
|
|
168
|
+
return self.submission_queue.content()
|
|
169
|
+
|
|
167
170
|
def outstanding_services(self, sid) -> Optional[dict[str, int]]:
|
|
168
171
|
"""
|
|
169
172
|
List outstanding services for a given submission and the number of file each
|
|
@@ -274,6 +274,10 @@ class Dispatcher(ThreadedCoreBase):
|
|
|
274
274
|
def instance_assignment_size(persistent_redis, instance_id):
|
|
275
275
|
return Hash(DISPATCH_TASK_ASSIGNMENT + instance_id, host=persistent_redis).length()
|
|
276
276
|
|
|
277
|
+
@staticmethod
|
|
278
|
+
def instance_assignment(persistent_redis, instance_id) -> list[str]:
|
|
279
|
+
return Hash(DISPATCH_TASK_ASSIGNMENT + instance_id, host=persistent_redis).keys()
|
|
280
|
+
|
|
277
281
|
@staticmethod
|
|
278
282
|
def all_queue_lengths(redis, instance_id):
|
|
279
283
|
return {
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/ingester.py
RENAMED
|
@@ -17,8 +17,8 @@ from random import random
|
|
|
17
17
|
from typing import Any, Iterable, List, Optional, Tuple
|
|
18
18
|
|
|
19
19
|
import elasticapm
|
|
20
|
-
from assemblyline.common.postprocess import ActionWorker
|
|
21
20
|
|
|
21
|
+
from assemblyline.common.postprocess import ActionWorker
|
|
22
22
|
from assemblyline_core.server_base import ThreadedCoreBase
|
|
23
23
|
from assemblyline.common.metrics import MetricsFactory
|
|
24
24
|
from assemblyline.common.str_utils import dotdump, safe_str
|
|
@@ -41,6 +41,7 @@ from assemblyline.odm.models.submission import SubmissionParams, Submission as D
|
|
|
41
41
|
from assemblyline.odm.models.alert import EXTENDED_SCAN_VALUES
|
|
42
42
|
from assemblyline.odm.messages.submission import Submission as MessageSubmission, SubmissionMessage
|
|
43
43
|
|
|
44
|
+
from assemblyline_core.dispatching.dispatcher import Dispatcher
|
|
44
45
|
from assemblyline_core.submission_client import SubmissionClient
|
|
45
46
|
from .constants import INGEST_QUEUE_NAME, drop_chance, COMPLETE_QUEUE_NAME
|
|
46
47
|
|
|
@@ -189,7 +190,8 @@ class Ingester(ThreadedCoreBase):
|
|
|
189
190
|
def try_run(self):
|
|
190
191
|
threads_to_maintain = {
|
|
191
192
|
'Retries': self.handle_retries,
|
|
192
|
-
'Timeouts': self.handle_timeouts
|
|
193
|
+
'Timeouts': self.handle_timeouts,
|
|
194
|
+
'Missing': self.handle_missing,
|
|
193
195
|
}
|
|
194
196
|
threads_to_maintain.update({f'Complete_{n}': self.handle_complete for n in range(COMPLETE_THREADS)})
|
|
195
197
|
threads_to_maintain.update({f'Ingest_{n}': self.handle_ingest for n in range(INGEST_THREADS)})
|
|
@@ -483,6 +485,64 @@ class Ingester(ThreadedCoreBase):
|
|
|
483
485
|
self.counter.increment_execution_time('cpu_seconds', time.process_time() - cpu_mark)
|
|
484
486
|
self.counter.increment_execution_time('busy_seconds', time.time() - time_mark)
|
|
485
487
|
|
|
488
|
+
def handle_missing(self) -> None:
|
|
489
|
+
"""
|
|
490
|
+
Messages get dropped or only partially processed when ingester and dispatcher containers scale up and down.
|
|
491
|
+
|
|
492
|
+
This loop checks for submissions that are in two invalid states:
|
|
493
|
+
- finished but still listed as being scanned by ingester (message probably dropped by ingester)
|
|
494
|
+
- listed by ingester but unknown by dispatcher (message could have been dropped on either end)
|
|
495
|
+
|
|
496
|
+
Loading all the info needed to do these checks is a bit slow, but doing them every 5 or 15 minutes
|
|
497
|
+
per ingester shouldn't be noteworthy. While these missing messages are bound to happen from time to time
|
|
498
|
+
they should be rare. With that in mind, a warning is raised whenever this worker processes something
|
|
499
|
+
so that if a constant stream of items are falling through and getting processed here it might stand out.
|
|
500
|
+
"""
|
|
501
|
+
last_round: set[str] = set()
|
|
502
|
+
|
|
503
|
+
while self.sleep(300 if last_round else 900):
|
|
504
|
+
# Get the current set of outstanding tasks
|
|
505
|
+
outstanding: dict[str, dict] = self.scanning.items()
|
|
506
|
+
|
|
507
|
+
# Get jobs being processed by dispatcher or in dispatcher queue
|
|
508
|
+
assignment: dict[str, str] = {}
|
|
509
|
+
for data in self.submit_client.dispatcher.queued_submissions():
|
|
510
|
+
assignment[data['submission']['sid']] = ''
|
|
511
|
+
for dis in Dispatcher.all_instances(self.redis_persist):
|
|
512
|
+
for key in Dispatcher.instance_assignment(self.redis_persist, dis):
|
|
513
|
+
assignment[key] = dis
|
|
514
|
+
|
|
515
|
+
# Filter out outstanding tasks currently assigned or in queue
|
|
516
|
+
outstanding = {
|
|
517
|
+
key: doc
|
|
518
|
+
for key, doc in outstanding.items()
|
|
519
|
+
if doc["submission"]["sid"] not in assignment
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
unprocessed = []
|
|
523
|
+
for key, data in outstanding.items():
|
|
524
|
+
task = IngestTask(data)
|
|
525
|
+
sid = task.submission.sid
|
|
526
|
+
|
|
527
|
+
# Check if its already complete in the database
|
|
528
|
+
from_db = self.datastore.submission.get_if_exists(sid)
|
|
529
|
+
if from_db and from_db.state == "completed":
|
|
530
|
+
self.log.warning("Completing a hanging finished submission [{}]", sid)
|
|
531
|
+
self.completed(from_db)
|
|
532
|
+
|
|
533
|
+
# Check for items that have been in an unknown state since the last round
|
|
534
|
+
# and put it back in processing
|
|
535
|
+
elif sid in last_round:
|
|
536
|
+
self.log.warning("Recovering a submission dispatcher hasn't processed [{}]", sid)
|
|
537
|
+
self.submit(task)
|
|
538
|
+
|
|
539
|
+
# Otherwise defer looking at this until next iteration
|
|
540
|
+
else:
|
|
541
|
+
unprocessed.append(sid)
|
|
542
|
+
|
|
543
|
+
# store items for next round
|
|
544
|
+
last_round = set(unprocessed)
|
|
545
|
+
|
|
486
546
|
def get_groups_from_user(self, username: str) -> List[str]:
|
|
487
547
|
# Reset the group cache at the top of each hour
|
|
488
548
|
if time.time()//HOUR_IN_SECONDS > self._user_groups_reset:
|
|
@@ -341,6 +341,10 @@ class DockerController(ControllerInterface):
|
|
|
341
341
|
names = list(self._profiles.keys())
|
|
342
342
|
return {name: self.get_target(name) for name in names}
|
|
343
343
|
|
|
344
|
+
def get_unavailable(self) -> dict[str, int]:
|
|
345
|
+
"""Get the number of containers the orchestration layer could not start."""
|
|
346
|
+
return {}
|
|
347
|
+
|
|
344
348
|
def set_target(self, service_name, target):
|
|
345
349
|
"""Change how many instances of a service docker is trying to keep up.
|
|
346
350
|
|
|
@@ -308,6 +308,7 @@ class KubernetesController(ControllerInterface):
|
|
|
308
308
|
pod_background.start()
|
|
309
309
|
|
|
310
310
|
self._deployment_targets: dict[str, int] = {}
|
|
311
|
+
self._deployment_unavailable: dict[str, int] = {}
|
|
311
312
|
deployment_background = threading.Thread(target=self._loop_forever(self._monitor_deployments), daemon=True)
|
|
312
313
|
deployment_background.start()
|
|
313
314
|
|
|
@@ -601,6 +602,7 @@ class KubernetesController(ControllerInterface):
|
|
|
601
602
|
watch = TypelessWatch()
|
|
602
603
|
|
|
603
604
|
self._deployment_targets = {}
|
|
605
|
+
self._deployment_unavailable = {}
|
|
604
606
|
label_selector = ','.join(f'{_n}={_v}' for _n, _v in self._labels.items() if _n != 'privilege')
|
|
605
607
|
|
|
606
608
|
for event in watch.stream(func=self.apps_api.list_namespaced_deployment,
|
|
@@ -613,9 +615,11 @@ class KubernetesController(ControllerInterface):
|
|
|
613
615
|
name = event['raw_object']['metadata']['labels'].get('component', None)
|
|
614
616
|
if name is not None:
|
|
615
617
|
self._deployment_targets[name] = event['raw_object']['spec']['replicas']
|
|
618
|
+
self._deployment_unavailable[name] = event['raw_object']['status'].get('unavailableReplicas', 0)
|
|
616
619
|
elif event['type'] == 'DELETED':
|
|
617
620
|
name = event['raw_object']['metadata']['labels'].get('component', None)
|
|
618
621
|
self._deployment_targets.pop(name, None)
|
|
622
|
+
self._deployment_unavailable.pop(name, None)
|
|
619
623
|
|
|
620
624
|
def _get_pod_used_namespace_cpu(self) -> float:
|
|
621
625
|
count = 0.0
|
|
@@ -875,6 +879,10 @@ class KubernetesController(ControllerInterface):
|
|
|
875
879
|
"""Get the target for running instances of all services."""
|
|
876
880
|
return self._deployment_targets
|
|
877
881
|
|
|
882
|
+
def get_unavailable(self) -> dict[str, int]:
|
|
883
|
+
"""Get the number of containers the orchestration layer could not start."""
|
|
884
|
+
return self._deployment_unavailable
|
|
885
|
+
|
|
878
886
|
def set_target(self, service_name: str, target: int):
|
|
879
887
|
"""Set the target for running instances of a service."""
|
|
880
888
|
for _ in range(10):
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/scaler_server.py
RENAMED
|
@@ -272,7 +272,13 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
272
272
|
# function properly.
|
|
273
273
|
for secret in re.findall(r'\${\w+}', open('/etc/assemblyline/config.yml', 'r').read()) + ['UI_SERVER']:
|
|
274
274
|
env_name = secret.strip("${}")
|
|
275
|
-
|
|
275
|
+
try:
|
|
276
|
+
core_env[env_name] = os.environ[env_name]
|
|
277
|
+
except KeyError:
|
|
278
|
+
# Don't pass through variables that scaler doesn't have
|
|
279
|
+
# they are likely specific to other components and shouldn't
|
|
280
|
+
# be shared with privileged services.
|
|
281
|
+
pass
|
|
276
282
|
|
|
277
283
|
labels = {
|
|
278
284
|
'app': 'assemblyline',
|
|
@@ -737,14 +743,9 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
737
743
|
# it is one big one, and let the orchestration layer sort out the details.
|
|
738
744
|
#
|
|
739
745
|
|
|
740
|
-
#
|
|
741
|
-
free_cpu,
|
|
742
|
-
|
|
743
|
-
free_cpu = total_cpu * self.get_cpu_overallocation() - used_cpu
|
|
744
|
-
|
|
745
|
-
free_memory, total_memory = self.controller.memory_info()
|
|
746
|
-
used_memory = total_memory - free_memory
|
|
747
|
-
free_memory = total_memory * self.get_memory_overallocation() - used_memory
|
|
746
|
+
# Get the processed resource numbers
|
|
747
|
+
free_cpu, _ = self.get_cpu_info(overallocation=True)
|
|
748
|
+
free_memory, _ = self.get_memory_info(overallocation=True)
|
|
748
749
|
|
|
749
750
|
# Make adjustments to the targets until everything is satisified
|
|
750
751
|
# or we don't have the resouces to make more adjustments
|
|
@@ -785,6 +786,44 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
785
786
|
self.log.info(f"Scaling service {name}: {old} -> {value}")
|
|
786
787
|
pool.call(self.controller.set_target, name, value)
|
|
787
788
|
|
|
789
|
+
def get_cpu_info(self, overallocation: bool) -> tuple[float, float]:
|
|
790
|
+
# Get the raw used resource numbers
|
|
791
|
+
free_cpu, total_cpu = self.controller.cpu_info()
|
|
792
|
+
|
|
793
|
+
# Recalculate the amount of free resources expanding the total quantity by the overallocation
|
|
794
|
+
if overallocation:
|
|
795
|
+
used_cpu = total_cpu - free_cpu
|
|
796
|
+
free_cpu = total_cpu * self.get_cpu_overallocation() - used_cpu
|
|
797
|
+
|
|
798
|
+
# Include the service containers not counted in the raw numbers because they are pending
|
|
799
|
+
for name, pending in self.controller.get_unavailable().items():
|
|
800
|
+
profile = self.profiles.get(name)
|
|
801
|
+
if not profile or not pending:
|
|
802
|
+
continue
|
|
803
|
+
|
|
804
|
+
free_cpu = free_cpu - profile.container_config.cpu_cores * pending
|
|
805
|
+
|
|
806
|
+
return (free_cpu, total_cpu)
|
|
807
|
+
|
|
808
|
+
def get_memory_info(self, overallocation: bool) -> tuple[float, float]:
|
|
809
|
+
# Get the raw used resource numbers
|
|
810
|
+
free_memory, total_memory = self.controller.memory_info()
|
|
811
|
+
|
|
812
|
+
# Recalculate the amount of free resources expanding the total quantity by the overallocation
|
|
813
|
+
if overallocation:
|
|
814
|
+
used_memory = total_memory - free_memory
|
|
815
|
+
free_memory = total_memory * self.get_memory_overallocation() - used_memory
|
|
816
|
+
|
|
817
|
+
# Include the service containers not counted in the raw numbers because they are pending
|
|
818
|
+
for name, pending in self.controller.get_unavailable().items():
|
|
819
|
+
profile = self.profiles.get(name)
|
|
820
|
+
if not profile or not pending:
|
|
821
|
+
continue
|
|
822
|
+
|
|
823
|
+
free_memory = free_memory - profile.container_config.ram_mb * pending
|
|
824
|
+
|
|
825
|
+
return (free_memory, total_memory)
|
|
826
|
+
|
|
788
827
|
def sync_metrics(self):
|
|
789
828
|
"""Check if there are any pub-sub messages we need."""
|
|
790
829
|
while self.sleep(METRIC_SYNC_INTERVAL):
|
|
@@ -889,8 +928,8 @@ class ScalerServer(ThreadedCoreBase):
|
|
|
889
928
|
export_metrics_once(service_name, Status, metrics, host=HOSTNAME,
|
|
890
929
|
counter_type='scaler_status', config=self.config, redis=self.redis)
|
|
891
930
|
|
|
892
|
-
memory, memory_total = self.
|
|
893
|
-
cpu, cpu_total = self.
|
|
931
|
+
memory, memory_total = self.get_memory_info(overallocation=False)
|
|
932
|
+
cpu, cpu_total = self.get_cpu_info(overallocation=False)
|
|
894
933
|
metrics = {
|
|
895
934
|
'memory_total': memory_total,
|
|
896
935
|
'cpu_total': cpu_total,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4.4.0.57
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/processing.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/alerter/run_alerter.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/archiver/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/archiver/run_archiver.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/__main__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/schedules.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/dispatching/timeout.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/expiry/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/expiry/run_expiry.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/__main__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/ingester/constants.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/es_metrics.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/metrics/helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/plumber/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/plumber/run_plumber.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/client.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/creator/run.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/loader/run.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/replay/replay.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/safelist_client.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/collection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/scaler/run_scaler.py
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/submission_client.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/tasking_client.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/helper.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/updater/run_updater.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/crawler.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/department_map.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/safelist.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/stream_map.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/vacuum/worker.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/workflow/__init__.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core/workflow/run_workflow.py
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/assemblyline_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{assemblyline-core-4.4.0.57 → assemblyline-core-4.4.0.59}/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
|