Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class Unpacking(BaseModel):
max_depth: int
memory_limit: int = 2048

throttle_interval: float
throttle_limit: int

delay: float
Expand Down
3 changes: 3 additions & 0 deletions src/config/fact-core-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ whitelist = [
max-depth = 8
# Memory limit in MiB.
# memory-limit = 2048
# halt unpacking temporarily if the cumulated input queue length of all analysis plugins reaches this value
throttle-limit = 100
# time interval in seconds to check if throttling should be enabled
throttle-interval = 2
# tcp port(s) for task server
base-port = 9900
# if you experience FileNotFound errors during unpacking, increasing this value slightly might help
Expand Down
1 change: 1 addition & 0 deletions src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def backend_config(request, common_config, firmware_file_storage_directory) -> c
'whitelist': [],
'max_depth': 8,
'memory_limit': 2048,
'throttle_interval': 0.5,
'throttle_limit': 50,
'delay': 0.0,
'base_port': 9900,
Expand Down
7 changes: 2 additions & 5 deletions src/scheduler/unpacking_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ class NoFreeWorker(RuntimeError): # noqa: N818
pass


THROTTLE_INTERVAL = 2


class UnpackingScheduler:
"""
This scheduler performs unpacking on firmware objects
Expand Down Expand Up @@ -103,7 +100,7 @@ def shutdown(self):
self.in_queue.close()
stop_processes(
[self.work_load_process, self.extraction_process],
THROTTLE_INTERVAL,
config.backend.unpacking.throttle_interval,
)
self.stop_containers()
self._clean_tmp_dirs()
Expand Down Expand Up @@ -318,7 +315,7 @@ def _work_load_monitor(self):
message += ' (throttled)'

log_function(color_string(message, TerminalColors.WARNING))
sleep(THROTTLE_INTERVAL)
sleep(config.backend.unpacking.throttle_interval)
logging.debug('Stopped unpacking work load monitor')

def _get_combined_analysis_workload(self):
Expand Down