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 status server_only match only processors with server status docker_only match only docker processors native_only match only native processors str_only returns the processor_name instead of data object unique_only remove duplicates from the matches

worker_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

resolve_processor_server_url(processor_name) str[source]
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_hosts(mongodb_url: str, rabbitmq_url: str) None[source]
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]
kill_rabbitmq() None[source]
kill_mongodb() None[source]
kill_hosts() None[source]
kill_processing_workers(host_data: DataHost) None[source]
kill_processor_servers(host_data: DataHost) None[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]
start_native_processor_server(ssh_client, processor_name: str, agent_address: str, database_url: str) str[source]
start_unix_mets_server(mets_path: str) Path[source]
stop_unix_mets_server(mets_server_url: str) None[source]