ocrd_network.deployer module¶
Abstraction of the deployment functionality for processors.
The Processing Server provides the configuration parameters to the Deployer agent. The Deployer agent runs the RabbitMQ Server, MongoDB and the Processing Hosts. Each Processing Host may have several Processing Workers. Each Processing Worker is an instance of an OCR-D processor.
- class ocrd_network.deployer.Deployer(config_path: str)[source]¶
Bases:
object
- find_matching_processors(worker_only: bool = False, server_only: bool = False, docker_only: bool = False, native_only: bool = False, str_names_only: bool = False, unique_only: bool = False) List[str] | List[object] [source]¶
Finds and returns a list of matching data objects of type: DataProcessingWorker and DataProcessorServer.
worker_only
match only processors with worker statusserver_only
match only processors with server statusdocker_only
match only docker processorsnative_only
match only native processorsstr_only
returns the processor_name instead of data objectunique_only
remove duplicates from the matchesworker_only and server_only are mutually exclusive to each other docker_only and native_only are mutually exclusive to each other unique_only is allowed only together with str_names_only
- kill_all() None [source]¶
kill all started services: hosts, database, queue
The order of killing is important to optimize graceful shutdown in the future. If RabbitMQ server is killed before killing Processing Workers, that may have bad outcome and leave Processing Workers in an unpredictable state
- deploy_rabbitmq(image: str, detach: bool, remove: bool, ports_mapping: Dict | None = None) str [source]¶
- deploy_mongodb(image: str, detach: bool, remove: bool, ports_mapping: Dict | None = None) str [source]¶
- start_native_processor(ssh_client, processor_name: str, queue_url: str, database_url: str) str [source]¶
start a processor natively on a host via ssh
- Parameters:
ssh_client – paramiko SSHClient to execute commands on a host
processor_name – name of processor to run
queue_url – url to rabbitmq
database_url – url to database
- Returns:
pid of running process
- Return type:
str
- start_docker_processor(docker_client, processor_name: str, _queue_url: str, _database_url: str) str [source]¶