Skip to content
Merged
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
26 changes: 19 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ Dockerfile_tegra_dev
config_startup.json
.env

*/_local_cache/*
*/_data/*
*/_logs/*
*/_models/*
*/_output/*
*/_vector_db*
*/ratio1_*
**/_local_cache/**
**/_data/**
**/_logs/**
**/_models/**
**/_output/**
**/vectordb/**
**/_vector_db**/
**/ratio1_*
**/db_cache/**

.idea/**
.git/**
**/__pycache__/**

xperimental/llama_cpp/**

!**/_data/box_configuration/**
!**/authorized_addrs

.venv
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,32 @@ dmypy.json
# local python files
*__local__.py

*/_local_cache/*
*/ratio1_0*
*/_data/*
*/_logs/*
*/_output/*
*/_models/*
**/_local_cache/**
**/_data/**
**/_logs/**
**/_models/**
**/_output/**
**/vectordb/**
**/_vector_db**/
**/ratio1_*
**/db_cache/**

config_startup*.txt
config_startup*.json
config_startup*.yaml
config_startup*.yml
inference/model_testing/_local_cache/_logs/MPTF.txt
inference/model_testing/_local_cache/_logs/20211224_102325_MPTF_001_log.txt

vectordb
_vector_db_cache
_vector_db_cache_HNSWVectorDB
db_cache

plugins/libs/_cache/
core/utils/_cache/
Expand Down
2 changes: 1 addition & 1 deletion constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class JeevesCt:
JEEVES_API_SIGNATURES = [
"JEEVES_API",
"KEYSOFT_JEEVES",
"BASE_INFERENCE_API",
"LLM_INFERENCE_API",
]

JEEVES_AGENT_SIGNATURES = [
Expand Down
49 changes: 39 additions & 10 deletions extensions/business/cybersec/red_mesh/pentester_api_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"CHAINSTORE_PEERS": [],

"CHECK_JOBS_EACH" : 5,

"REDMESH_VERBOSE" : 10, # Verbosity level for debug messages (0 = off, 1+ = debug)

"NR_LOCAL_WORKERS" : 8,

Expand Down Expand Up @@ -155,8 +157,33 @@ def P(self, s, *args, **kwargs):
"""
s = "[REDMESH] " + s
return super(PentesterApi01Plugin, self).P(s, *args, **kwargs)




def Pd(self, s, *args, score=-1, **kwargs):
"""
Print debug message if verbosity level allows.

Parameters
----------
s : str
Message to print.
score : int, optional
Verbosity threshold (default: -1). Message prints if cfg_redmesh_verbose > score.
*args
Additional positional arguments passed to P().
**kwargs
Additional keyword arguments passed to P().

Returns
-------
None
"""
if self.cfg_redmesh_verbose > score:
s = "[DEBUG] " + s
self.P(s, *args, **kwargs)
return


def __post_init(self):
"""
Perform warmup: reconcile existing jobs in CStore, migrate legacy keys,
Expand Down Expand Up @@ -281,29 +308,28 @@ def _normalize_job_record(self, job_key, job_spec, migrate=False):
return job_key, normalized


def _ensure_worker_entry(self, job_id, job_spec):
def _get_worker_entry(self, job_id, job_spec):
"""
Ensure current worker has an entry in the distributed job spec.
Get the worker entry for this node from the job spec.

Parameters
----------
job_id : str
Identifier of the job.
job_spec : dict
Mutable job specification stored in CStore.
Job specification stored in CStore.

Returns
-------
dict
Worker entry for this edge node.
dict | None
Worker entry for this edge node, or None if not assigned.
"""
workers = job_spec.setdefault("workers", {})
worker_entry = workers.get(self.ee_addr)
if worker_entry is None:
self.P("No worker entry found for this node in job spec job_id={}, workers={}".format(
self.Pd("No worker entry found for this node in job spec job_id={}, workers={}".format(
job_id,
self.json_dumps(workers)),
color='r'
)
return worker_entry

Expand Down Expand Up @@ -460,7 +486,10 @@ def _maybe_launch_jobs(self, nr_local_workers=None):
enabled_features = job_specs.get("enabled_features", [])
if job_id is None:
continue
worker_entry = self._ensure_worker_entry(job_id, job_specs)
worker_entry = self._get_worker_entry(job_id, job_specs)
if worker_entry is None:
# This node is not assigned to this job, skip it
continue
current_worker_finished = worker_entry.get("finished", False)
if current_worker_finished:
continue
Expand Down
23 changes: 22 additions & 1 deletion extensions/business/deeploy/deeploy_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,28 @@ def _discover_plugin_instances(
):
"""
Discover the plugin instances for the given app_id and target nodes.
Returns a list of dictionaries containing infomration about plugin instances.

Returns a list of dictionaries containing information about plugin instances.

Parameters
----------
app_id : str
Generated application identifier in the form of {app_name}-{uuid4}.
job_id : str
Incremental job identifier. Interchangeable with app_id for discovery, but they are never the same.
target_nodes : list[str]
List of target node addresses to filter the search.
owner : str
Owner address to filter the search.
plugin_signature : str
Plugin signature to filter the search.
instance_id : str
Plugin instance ID to filter the search.

Returns
-------
list[dict]
List of discovered plugin instances with details.
"""
apps = self._get_online_apps(owner=owner, target_nodes=target_nodes)
self.P(f"online apps for owner {owner} and target_nodes {target_nodes}: {self.json_dumps(apps)}")
Expand Down
Loading
Loading