ocrd_network.processing_server module¶
- class ocrd_network.processing_server.ProcessingServer(config_path: str, host: str, port: int)[source]¶
Bases:
FastAPI
FastAPI app to make ocr-d processor calls
The Processing-Server receives calls conforming to the ocr-d webapi regarding the processing part. It can run ocrd-processors and provides endpoints to discover processors and watch the job status. The Processing-Server does not execute the processors itself but starts up a queue and a database to delegate the calls to processing workers. They are started by the Processing-Server and the communication goes through the queue.
- start() None [source]¶
deploy agents (db, queue, workers) and start the processing server with uvicorn
- async on_shutdown() None [source]¶
hosts and pids should be stored somewhere
ensure queue is empty or processor is not currently running
connect to hosts and kill pids
- create_message_queues() None [source]¶
Create the message queues based on the occurrence of workers.name in the config file.
- static create_processing_message(job: DBProcessorJob) OcrdProcessingMessage [source]¶
- async push_processor_job(processor_name: str, data: PYJobInput) PYJobOutput [source]¶
- async push_to_processing_queue(processor_name: str, processing_message: OcrdProcessingMessage)[source]¶
- async push_to_processor_server(processor_name: str, processor_server_url: str, job_input: PYJobInput) PYJobOutput [source]¶
- async get_processor_job(processor_name: str, job_id: str) PYJobOutput [source]¶
- async remove_from_request_cache(result_message: PYResultMessage)[source]¶
- async task_sequence_to_processing_jobs(tasks: List[ProcessorTask], mets_path: str, page_id: str, agent_type: str = 'worker') List[PYJobOutput] [source]¶
- async run_workflow(workflow: UploadFile, mets_path: str, agent_type: str = 'worker', page_id: str | None = None, page_wise: bool = False, workflow_callback_url: str | None = None) PYWorkflowJobOutput [source]¶