scheduler.analysis.plugin

exception scheduler.analysis.plugin.AnalysisExceptionError

Bases: Exception

class scheduler.analysis.plugin.PluginRunner(plugin, config, schemata)

Bases: object

Parameters:
class Config(*args, **kwargs)

Bases: BaseModel

A class containing all parameters of the runner

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

process_count: int
timeout: int

Timeout in seconds after which the analysis is aborted

class Task(*args, **kwargs)

Bases: BaseModel

Contains all information a PluginWorker needs to analyze a file.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

dependencies: Dict

A dictionary containing plugin names as keys and their analysis as value.

path: str

The path of the file on the disk

scheduler_state: FileObject
virtual_file_path: Dict

The virtual file path of the file object See FileObject.

get_active_worker_count()

Returns the amount of workers that currently analyze a file

Return type:

int

get_queue_len()
Return type:

int

out_queue: Queue

Workers put the Task.scheduler_state and the finished analysis in the out_queue

queue_analysis(file_object)

Queues the analysis of file_object with self._plugin. The caller of this method has to ensure that the dependencies are fulfilled.

Parameters:

file_object (FileObject) –

shutdown()
start()
class scheduler.analysis.plugin.Worker(plugin, worker_config, in_queue, out_queue, stats, stats_count, stats_idx)

Bases: Process

A process that executes a plugin in a child process.

Parameters:
  • plugin (AnalysisPluginV0) –

  • worker_config (Config) –

  • in_queue (mp.Queue) –

  • out_queue (mp.Queue) –

  • stats (mp.Array) –

  • stats_count (mp.Value) –

  • stats_idx (mp.Value) –

class Config(*args, **kwargs)

Bases: BaseModel

A class containing all parameters of the worker

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

timeout: int

Timeout in seconds after which the analysis is aborted

exception CrashedError

Bases: Exception

SIGTERM_TIMEOUT = 5
exception TimeoutError(timeout)

Bases: Exception

Parameters:

timeout (float) –

is_working()
run()

Method to be run in sub-process; can be overridden in sub-class