ocrd_validators.processing_server_config_validator module

Validating configuration file for the Processing-Server

class ocrd_validators.processing_server_config_validator.ProcessingServerConfigValidator(schema, validator_class=<class 'jsonschema.validators.Draft6Validator'>)[source]

Bases: JsonValidator

JsonValidator validating against the schema for the Processing Server

Construct a JsonValidator.

Parameters:
  • schema (dict) –

  • validator_class (Draft6Validator|DefaultValidatingDraft6Validator) –

static validate(obj, schema={'$defs': {'address': {'anyOf': [{'format': 'hostname'}, {'format': 'ipv4'}], 'type': 'string'}, 'credentials': {'additionalProperties': False, 'properties': {'password': {'type': 'string'}, 'username': {'type': 'string'}}, 'required': ['username', 'password'], 'type': 'object'}, 'port': {'maximum': 65535, 'minimum': 1, 'type': 'integer'}, 'ssh': {'additionalProperties': False, 'oneOf': [{'required': ['username', 'password']}, {'required': ['username', 'path_to_privkey']}], 'properties': {'password': {'type': 'string'}, 'path_to_privkey': {'description': 'Path to private key file', 'type': 'string'}, 'username': {'type': 'string'}}, 'type': 'object'}}, '$id': 'https://ocr-d.de/spec/web-api/config.schema.yml', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'additionalProperties': False, 'description': 'Schema for the Processing Broker configuration file', 'properties': {'database': {'additionalProperties': False, 'description': 'Information about the MongoDB', 'properties': {'address': {'$ref': '#/$defs/address', 'description': 'The IP address or domain name of the machine where MongoDB is deployed'}, 'credentials': {'$ref': '#/$defs/credentials', 'description': 'The credentials for the MongoDB'}, 'port': {'$ref': '#/$defs/port', 'description': 'The port number of the MongoDB'}, 'skip_deployment': {'description': 'set to true to deploy database yourself', 'type': 'boolean'}, 'ssh': {'$ref': '#/$defs/ssh', 'description': 'Information required for an SSH connection'}}, 'required': ['address', 'port'], 'type': 'object'}, 'hosts': {'description': 'A list of hosts where Processing Servers will be deployed', 'items': {'additionalProperties': False, 'anyOf': [{'required': ['workers']}, {'required': ['servers']}], 'description': 'A host where one or many Processing Servers will be deployed', 'oneOf': [{'required': ['password']}, {'required': ['path_to_privkey']}], 'properties': {'address': {'$ref': '#/$defs/address', 'description': 'The IP address or domain name of the target machine'}, 'password': {'type': 'string'}, 'path_to_privkey': {'description': 'Path to private key file', 'type': 'string'}, 'servers': {'description': 'List of processor servers that will be deployed', 'items': {'additionalProperties': False, 'properties': {'deploy_type': {'default': 'native', 'description': 'Should the processor server be deployed natively or with Docker', 'enum': ['native', 'docker'], 'type': 'string'}, 'name': {'description': 'Name of the processor', 'examples': ['ocrd-cis-ocropy-binarize', 'ocrd-olena-binarize'], 'pattern': '^ocrd-.*$', 'type': 'string'}, 'port': {'$ref': '#/$defs/port', 'description': 'The port number to be deployed on the host'}}, 'required': ['name', 'port'], 'type': 'object'}, 'minItems': 1, 'type': 'array'}, 'username': {'type': 'string'}, 'workers': {'description': 'List of processing workers that will be deployed', 'items': {'additionalProperties': False, 'properties': {'deploy_type': {'default': 'native', 'description': 'Should the processing worker be deployed natively or with Docker', 'enum': ['native', 'docker'], 'type': 'string'}, 'name': {'description': 'Name of the processor', 'examples': ['ocrd-cis-ocropy-binarize', 'ocrd-olena-binarize'], 'pattern': '^ocrd-.*$', 'type': 'string'}, 'number_of_instance': {'default': 1, 'description': 'Number of instances to be deployed', 'minimum': 1, 'type': 'integer'}}, 'required': ['name'], 'type': 'object'}, 'minItems': 1, 'type': 'array'}}, 'required': ['address', 'username'], 'type': 'object'}, 'type': 'array'}, 'internal_callback_url': {'description': 'optionally set the host for the internal_callback_url, for example "http://172.17.0.1:8080"', 'type': 'string'}, 'process_queue': {'additionalProperties': False, 'description': 'Information about the Message Queue', 'properties': {'address': {'$ref': '#/$defs/address', 'description': 'The IP address or domain name of the machine where the Message Queue is deployed'}, 'credentials': {'$ref': '#/$defs/credentials', 'description': 'The credentials for the Message Queue'}, 'port': {'$ref': '#/$defs/port', 'description': 'The port number of the Message Queue'}, 'skip_deployment': {'description': 'set to true to deploy queue yourself', 'type': 'boolean'}, 'ssh': {'$ref': '#/$defs/ssh', 'description': 'Information required for an SSH connection'}}, 'required': ['address', 'port'], 'type': 'object'}}, 'required': ['process_queue'], 'type': 'object'})[source]

Validate against schema for Processing-Server