csle_collector.client_manager package
Subpackages
- csle_collector.client_manager.dao package
- Submodules
- csle_collector.client_manager.dao.arrival_config module
- csle_collector.client_manager.dao.client module
- csle_collector.client_manager.dao.client_arrival_type module
- csle_collector.client_manager.dao.constant_arrival_config module
- csle_collector.client_manager.dao.eptmp_arrival_config module
- csle_collector.client_manager.dao.piece_wise_constant_arrival_config module
- csle_collector.client_manager.dao.sine_arrival_config module
- csle_collector.client_manager.dao.spiking_arrival_config module
- csle_collector.client_manager.dao.workflow_markov_chain module
- csle_collector.client_manager.dao.workflow_service module
- csle_collector.client_manager.dao.workflows_config module
- Module contents
- csle_collector.client_manager.threads package
Submodules
csle_collector.client_manager.client_manager module
- class csle_collector.client_manager.client_manager.ClientManagerServicer[source]
Bases:
csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerServicer
gRPC server for managing the running clients. Allows to start/stop clients remotely and also to query the state of the clients.
- getClients(request: client_manager_pb2.GetClientsMsg, context: grpc.ServicerContext) client_manager_pb2.ClientsDTO [source]
Gets the state of the clients
- Parameters
request – the gRPC request
context – the gRPC context
- Returns
a clients DTO with the state of the clients
- get_arrival_thread() Union[None, csle_collector.client_manager.threads.arrival_thread.ArrivalThread] [source]
Gets the arrival thread
- Returns
The arrival thread if it is initialized, otherwise None
- get_producer_thread() Union[None, csle_collector.client_manager.threads.producer_thread.ProducerThread] [source]
Gets the producer thread
- Returns
The producer thread if it is initialized, otherwise None
- startClients(request: client_manager_pb2.StartClientsMsg, context: grpc.ServicerContext) client_manager_pb2.ClientsDTO [source]
Starts/Restarts the Poisson process(es) that generate(s) clients
- Parameters
request – the gRPC request
context – the gRPC context
- Returns
a clients DTO with the state of the clients
- startProducer(request: client_manager_pb2.StartProducerMsg, context: grpc.ServicerContext) client_manager_pb2.ClientsDTO [source]
Starts/Restarts the producer thread that pushes data to Kafka
- Parameters
request – the gRPC request
context – the gRPC context
- Returns
a clients DTO with the state of the clients
- csle_collector.client_manager.client_manager.serve(port: int = 50044, log_dir: str = '/', log_file_name: str = 'client_manager.log', max_workers: int = 10) None [source]
Starts the gRPC server for managing clients
- Parameters
port – the port that the server will listen to
log_dir – the directory to write the log file
log_file_name – the file name of the log
max_workers – the maximum number of GRPC workers
- Returns
None
csle_collector.client_manager.client_manager_pb2 module
Generated protocol buffer code.
csle_collector.client_manager.client_manager_pb2_grpc module
Client and server classes corresponding to protobuf-defined services.
- class csle_collector.client_manager.client_manager_pb2_grpc.ClientManager[source]
Bases:
object
Interface exported by the server
- static getClients(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
- static startClients(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
- static startProducer(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None)[source]
- class csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerServicer[source]
Bases:
object
Interface exported by the server
csle_collector.client_manager.client_manager_util module
- class csle_collector.client_manager.client_manager_util.ClientManagerUtil[source]
Bases:
object
Class with utility functions related to the Client Manager
csle_collector.client_manager.client_population_metrics module
- class csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics(ip: str = '', ts: float = 1725112594.4345574, num_clients: int = 0, rate: float = 20, service_time: float = 4)[source]
Bases:
csle_base.json_serializable.JSONSerializable
DTO representing information about the client population
- copy() csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics [source]
- Returns
a copy of the object
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics [source]
Converts a dict representation of the object into an instance :param d: the dict representation :return: the created instance
- static from_json_file(json_file_path: str) csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- static from_kafka_record(record: str) csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics [source]
Converts a kafka record to a DTO
- Parameters
record – the kafka record
- Returns
the DTO
- get_deltas(stats_prime: csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics) Tuple[List[float], List[str]] [source]
Get the deltas between two stats objects
- Parameters
stats_prime – the stats object to compare with
- Returns
the deltas and the labels
- get_values() Tuple[List[float], List[str]] [source]
Get the current values
- Returns
the values and the labels
- static schema() csle_collector.client_manager.client_population_metrics.ClientPopulationMetrics [source]
- Returns
get the schema of the DTO
csle_collector.client_manager.query_clients module
- csle_collector.client_manager.query_clients.get_clients(stub: csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerStub, timeout=60) client_manager_pb2.ClientsDTO [source]
Queries the server for the client state
- Parameters
stub – the stub to send the remote gRPC to the server
timeout – the GRPC timeout (seconds)
- Returns
a clientsDTO describing the state of the clients
- csle_collector.client_manager.query_clients.start_clients(stub: csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerStub, time_step_len_seconds: int, workflows_config: csle_collector.client_manager.dao.workflows_config.WorkflowsConfig, clients: List[csle_collector.client_manager.dao.client.Client], timeout=60) client_manager_pb2.ClientsDTO [source]
Starts the client arrival process
- Parameters
stub – the stub to the gRPC server
time_step_len_seconds – length of a time-step in the emulation
workflows_config – configuration of the workflows
clients – list of client profiles
timeout – the timeout for sending a request to the GRPC server
- Returns
a clients DTO describing the state of the clients
- csle_collector.client_manager.query_clients.start_producer(stub: csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerStub, ip: str, port: int, time_step_len_seconds: int, timeout=60)[source]
Stops the producer process
- Parameters
stub – the stub to the gRPC server
ip – ip of the kafka server to produce to
port – port of the kafka server to produce to
timeout – the GRPC timeout (seconds)
- Returns
a clientsDTO describing the state of the clients
- csle_collector.client_manager.query_clients.stop_clients(stub: csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerStub, timeout=60)[source]
Stops the client arrival process
- Parameters
stub – the stub to the gRPC server
timeout – the GRPC timeout (seconds)
- Returns
a clientsDTO describing the state of the clients
- csle_collector.client_manager.query_clients.stop_producer(stub: csle_collector.client_manager.client_manager_pb2_grpc.ClientManagerStub, timeout=60)[source]
Stops the producer process
- Parameters
stub – the stub to the gRPC server
timeout – the GRPC timeout (seconds)
- Returns
a clientsDTO describing the state of the clients