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
WorkflowMarkovChain
WorkflowMarkovChain.copy()
WorkflowMarkovChain.from_dict()
WorkflowMarkovChain.from_grpc_object()
WorkflowMarkovChain.from_json_file()
WorkflowMarkovChain.markov_next_state()
WorkflowMarkovChain.reset()
WorkflowMarkovChain.step_forward()
WorkflowMarkovChain.to_dict()
WorkflowMarkovChain.to_grpc_object()
- csle_collector.client_manager.dao.workflow_service module
- csle_collector.client_manager.dao.workflows_config module
WorkflowsConfig
WorkflowsConfig.commands()
WorkflowsConfig.copy()
WorkflowsConfig.create_execution_config()
WorkflowsConfig.from_dict()
WorkflowsConfig.from_grpc_object()
WorkflowsConfig.from_json_file()
WorkflowsConfig.get_workflow_mc()
WorkflowsConfig.get_workflow_service()
WorkflowsConfig.to_dict()
WorkflowsConfig.to_grpc_object()
- 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:
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: GetClientsMsg, context: ServicerContext) 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, ArrivalThread] [source]
Gets the arrival thread
- Returns
The arrival thread if it is initialized, otherwise None
- get_producer_thread() Union[None, ProducerThread] [source]
Gets the producer thread
- Returns
The producer thread if it is initialized, otherwise None
- startClients(request: StartClientsMsg, context: ServicerContext) 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: StartProducerMsg, context: ServicerContext) 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 = 1739104500.074135, num_clients: int = 0, rate: float = 20, service_time: float = 4)[source]
Bases:
JSONSerializable
DTO representing information about the client population
- copy() ClientPopulationMetrics [source]
- Returns
a copy of the object
- static from_dict(d: Dict[str, Any]) 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) 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) ClientPopulationMetrics [source]
Converts a kafka record to a DTO
- Parameters
record – the kafka record
- Returns
the DTO
- get_deltas(stats_prime: 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() 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: ClientManagerStub, timeout=60) 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: ClientManagerStub, time_step_len_seconds: int, workflows_config: WorkflowsConfig, clients: List[Client], timeout=60) 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: 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: 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: 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