ocrd_network.models package¶
DB prefix stands for Database Models PY prefix stands for Pydantic Models
- class ocrd_network.models.DBProcessorJob(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, job_id: str, processor_name: str, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, state: JobState = JobState.unset, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, parameters: dict | None = None, depends_on: List[str] | None = None, result_queue_name: str | None = None, callback_url: str | None = None, internal_callback_url: str | None = None, start_time: datetime | None = None, end_time: datetime | None = None, exec_time: str | None = None, log_file_path: str | None = None)[source]¶
Bases:
Document
Job representation in the database
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- job_id: str¶
- processor_name: str¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- description: str | None¶
- input_file_grps: List[str]¶
- output_file_grps: List[str] | None¶
- page_id: str | None¶
- parameters: dict | None¶
- depends_on: List[str] | None¶
- result_queue_name: str | None¶
- callback_url: str | None¶
- internal_callback_url: str | None¶
- start_time: datetime | None¶
- end_time: datetime | None¶
- exec_time: str | None¶
- log_file_path: str | None¶
- to_job_output() PYJobOutput [source]¶
- class ocrd_network.models.DBWorkflowJob(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, job_id: str, page_id: str, page_wise: bool = False, processing_job_ids: Dict, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, workflow_callback_url: str | None = None)[source]¶
Bases:
Document
Workflow job representation in the database
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- job_id: str¶
- page_id: str¶
- page_wise: bool¶
- processing_job_ids: Dict¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- description: str | None¶
- workflow_callback_url: str | None¶
- to_job_output() PYWorkflowJobOutput [source]¶
- class ocrd_network.models.DBWorkspace(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, workspace_id: str, workspace_mets_path: str, ocrd_identifier: str, bagit_profile_identifier: str, ocrd_base_version_checksum: str | None = None, ocrd_mets: str | None = None, bag_info_adds: dict | None = None, mets_server_url: str | None = None, deleted: bool = False)[source]¶
Bases:
Document
Model to store a workspace in the mongo-database.
Information to handle workspaces and from bag-info.txt are stored here.
- ocrd_identifier Ocrd-Identifier
- Type:
mandatory
- bagit_profile_identifier BagIt-Profile-Identifier
- Type:
mandatory
- ocrd_base_version_checksum Ocrd-Base-Version-Checksum
- Type:
mandatory
- ocrd_mets Ocrd-Mets
- Type:
optional
- bag_info_adds bag-info.txt can also
key-value-pairs which are saved here
- Type:
optionally
- deleted the document is deleted if set, however, the record is still preserved
- pages_locked a data structure that holds output `fileGrp`s and their respective locked `page_id`
that are currently being processed by an OCR-D processor (server or worker). If no page_id field is set, an identifier “all_pages” will be used.
- mets_server_url If set, the reading from and writing to the mets file happens through the METS Server
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- workspace_id: str¶
- workspace_mets_path: str¶
- ocrd_identifier: str¶
- bagit_profile_identifier: str¶
- ocrd_base_version_checksum: str | None¶
- ocrd_mets: str | None¶
- bag_info_adds: dict | None¶
- mets_server_url: str | None¶
- deleted: bool¶
- class ocrd_network.models.DBWorkflowScript(*args, _id: PydanticObjectId | None = None, revision_id: UUID | None = None, workflow_id: str, content: str, content_hash: str)[source]¶
Bases:
Document
Model to store a workflow-script in the database
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- workflow_id: str¶
- content: str¶
- content_hash: str¶
- class ocrd_network.models.PYJobInput(*, processor_name: str | None = None, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, parameters: dict = {}, result_queue_name: str | None = None, callback_url: str | None = None, agent_type: AgentType = AgentType.PROCESSING_WORKER, job_id: str | None = None, depends_on: List[str] | None = None)[source]¶
Bases:
BaseModel
Wraps the parameters required to make a run-processor-request
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- processor_name: str | None¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- description: str | None¶
- input_file_grps: List[str]¶
- output_file_grps: List[str] | None¶
- page_id: str | None¶
- parameters: dict¶
- result_queue_name: str | None¶
- callback_url: str | None¶
- job_id: str | None¶
- depends_on: List[str] | None¶
- class Config[source]¶
Bases:
object
- schema_extra = {'example': {'agent_type': AgentType.PROCESSING_WORKER, 'description': 'The description of this execution', 'input_file_grps': ['DEFAULT'], 'output_file_grps': ['OCR-D-BIN'], 'page_id': 'PHYS_0001..PHYS_0003', 'parameters': {}, 'path_to_mets': '/path/to/mets.xml'}}¶
- class ocrd_network.models.PYJobOutput(*, job_id: str, processor_name: str, state: JobState = JobState.unset, path_to_mets: str | None = None, workspace_id: str | None = None, input_file_grps: List[str], output_file_grps: List[str] | None = None, page_id: str | None = None, log_file_path: str | None = None)[source]¶
Bases:
BaseModel
Wraps output information for a job-response
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- job_id: str¶
- processor_name: str¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- input_file_grps: List[str]¶
- output_file_grps: List[str] | None¶
- page_id: str | None¶
- log_file_path: str | None¶
- class ocrd_network.models.PYOcrdTool(*, executable: str, categories: List[str], description: str, input_file_grp: List[str], output_file_grp: List[str] | None = None, steps: List[str], parameters: dict | None = None)[source]¶
Bases:
BaseModel
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- executable: str¶
- categories: List[str]¶
- description: str¶
- input_file_grp: List[str]¶
- output_file_grp: List[str] | None¶
- steps: List[str]¶
- parameters: dict | None¶
- class ocrd_network.models.PYResultMessage(*, job_id: str, state: JobState = JobState.unset, path_to_mets: str | None = None, workspace_id: str | None = None)[source]¶
Bases:
BaseModel
Wraps the parameters required to make a result message request
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- job_id: str¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- class ocrd_network.models.PYWorkflowJobOutput(*, processing_job_ids: Dict[str, List[str]], page_id: str, page_wise: bool = False, job_id: str, path_to_mets: str | None = None, workspace_id: str | None = None, description: str | None = None)[source]¶
Bases:
BaseModel
Wraps output information for a workflow job-response
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- processing_job_ids: Dict[str, List[str]]¶
- page_id: str¶
- page_wise: bool¶
- job_id: str¶
- path_to_mets: str | None¶
- workspace_id: str | None¶
- description: str | None¶
Submodules¶
- ocrd_network.models.job module
PYJobInput
PYJobInput.processor_name
PYJobInput.path_to_mets
PYJobInput.workspace_id
PYJobInput.description
PYJobInput.input_file_grps
PYJobInput.output_file_grps
PYJobInput.page_id
PYJobInput.parameters
PYJobInput.result_queue_name
PYJobInput.callback_url
PYJobInput.agent_type
PYJobInput.job_id
PYJobInput.depends_on
PYJobInput.Config
PYJobOutput
DBProcessorJob
DBProcessorJob.job_id
DBProcessorJob.processor_name
DBProcessorJob.path_to_mets
DBProcessorJob.workspace_id
DBProcessorJob.description
DBProcessorJob.state
DBProcessorJob.input_file_grps
DBProcessorJob.output_file_grps
DBProcessorJob.page_id
DBProcessorJob.parameters
DBProcessorJob.depends_on
DBProcessorJob.result_queue_name
DBProcessorJob.callback_url
DBProcessorJob.internal_callback_url
DBProcessorJob.start_time
DBProcessorJob.end_time
DBProcessorJob.exec_time
DBProcessorJob.log_file_path
DBProcessorJob.Settings
DBProcessorJob.to_job_output()
DBProcessorJob.id
DBProcessorJob.revision_id
PYWorkflowJobOutput
DBWorkflowJob
DBWorkflowJob.job_id
DBWorkflowJob.page_id
DBWorkflowJob.page_wise
DBWorkflowJob.processing_job_ids
DBWorkflowJob.path_to_mets
DBWorkflowJob.workspace_id
DBWorkflowJob.description
DBWorkflowJob.workflow_callback_url
DBWorkflowJob.Settings
DBWorkflowJob.to_job_output()
DBWorkflowJob.id
DBWorkflowJob.revision_id
- ocrd_network.models.messages module
- ocrd_network.models.ocrd_tool module
- ocrd_network.models.workflow module
- ocrd_network.models.workspace module
DBWorkspace
DBWorkspace.workspace_id
DBWorkspace.workspace_mets_path
DBWorkspace.ocrd_identifier
DBWorkspace.bagit_profile_identifier
DBWorkspace.ocrd_base_version_checksum
DBWorkspace.ocrd_mets
DBWorkspace.bag_info_adds
DBWorkspace.mets_server_url
DBWorkspace.deleted
DBWorkspace.Settings
DBWorkspace.id
DBWorkspace.revision_id