ocrd 3.8.1__py3-none-any.whl → 3.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ocrd/processor/base.py +51 -43
- ocrd/processor/ocrd_page_result.py +74 -0
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/METADATA +1 -1
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/RECORD +15 -15
- ocrd_models/ocrd_page.py +20 -0
- ocrd_models/ocrd_page_generateds.py +1273 -69
- ocrd_network/cli/client.py +6 -2
- ocrd_network/client.py +4 -0
- ocrd_network/client_utils.py +9 -2
- ocrd_network/constants.py +1 -1
- ocrd_network/rabbitmq_utils/helpers.py +1 -1
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/LICENSE +0 -0
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/WHEEL +0 -0
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/entry_points.txt +0 -0
- {ocrd-3.8.1.dist-info → ocrd-3.9.1.dist-info}/top_level.txt +0 -0
ocrd_network/cli/client.py
CHANGED
|
@@ -212,13 +212,17 @@ def workflow_cli():
|
|
|
212
212
|
@workflow_cli.command('check-status')
|
|
213
213
|
@click.option('--address', type=URL, help=ADDRESS_HELP)
|
|
214
214
|
@click.option('-j', '--workflow-job-id', required=True)
|
|
215
|
-
|
|
215
|
+
@click.option('-v', '--verbose', default=False, is_flag=True)
|
|
216
|
+
def check_workflow_job_status(address: Optional[str], workflow_job_id: str, verbose: bool = False):
|
|
216
217
|
"""
|
|
217
218
|
Check the status of a previously submitted workflow job.
|
|
218
219
|
"""
|
|
219
220
|
client = Client(server_addr_processing=address)
|
|
220
221
|
try:
|
|
221
|
-
|
|
222
|
+
if verbose:
|
|
223
|
+
job_status = client.check_workflow_status(workflow_job_id)
|
|
224
|
+
else:
|
|
225
|
+
job_status = client.check_workflow_status_simple(workflow_job_id)
|
|
222
226
|
except RequestException as e:
|
|
223
227
|
print(
|
|
224
228
|
getattr(e, 'detail_message', str(e)),
|
ocrd_network/client.py
CHANGED
|
@@ -6,6 +6,7 @@ from .client_utils import (
|
|
|
6
6
|
get_ps_processing_job_log,
|
|
7
7
|
get_ps_processing_job_status,
|
|
8
8
|
get_ps_workflow_job_status,
|
|
9
|
+
get_ps_workflow_job_status_simple,
|
|
9
10
|
poll_job_status_till_timeout_fail_or_success,
|
|
10
11
|
poll_wf_status_till_timeout_fail_or_success,
|
|
11
12
|
post_ps_processing_request,
|
|
@@ -43,6 +44,9 @@ class Client:
|
|
|
43
44
|
def check_job_status(self, job_id: str):
|
|
44
45
|
return get_ps_processing_job_status(self.server_addr_processing, processing_job_id=job_id)
|
|
45
46
|
|
|
47
|
+
def check_workflow_status_simple(self, workflow_job_id: str):
|
|
48
|
+
return get_ps_workflow_job_status_simple(self.server_addr_processing, workflow_job_id=workflow_job_id)
|
|
49
|
+
|
|
46
50
|
def check_workflow_status(self, workflow_job_id: str):
|
|
47
51
|
return get_ps_workflow_job_status(self.server_addr_processing, workflow_job_id=workflow_job_id)
|
|
48
52
|
|
ocrd_network/client_utils.py
CHANGED
|
@@ -3,6 +3,7 @@ import os
|
|
|
3
3
|
from requests import get as request_get, post as request_post, RequestException, Response
|
|
4
4
|
from requests.exceptions import JSONDecodeError
|
|
5
5
|
from time import sleep
|
|
6
|
+
from typing import Any
|
|
6
7
|
from .constants import JobState, NETWORK_PROTOCOLS
|
|
7
8
|
|
|
8
9
|
|
|
@@ -16,7 +17,7 @@ def _poll_endpoint_status(ps_server_host: str, job_id: str, job_type: str, tries
|
|
|
16
17
|
if job_type == "processor":
|
|
17
18
|
job_state = get_ps_processing_job_status(ps_server_host, job_id)
|
|
18
19
|
if job_type == "workflow":
|
|
19
|
-
job_state =
|
|
20
|
+
job_state = get_ps_workflow_job_status_simple(ps_server_host, job_id)
|
|
20
21
|
if print_state:
|
|
21
22
|
print(f"State of the {job_type} job {job_id}: {job_state}")
|
|
22
23
|
if job_state == JobState.success or job_state == JobState.failed:
|
|
@@ -77,7 +78,7 @@ def get_ps_processing_job_status(ps_server_host: str, processing_job_id: str) ->
|
|
|
77
78
|
return getattr(JobState, job_state.lower())
|
|
78
79
|
|
|
79
80
|
|
|
80
|
-
def
|
|
81
|
+
def get_ps_workflow_job_status_simple(ps_server_host: str, workflow_job_id: str) -> JobState:
|
|
81
82
|
request_url = f"{ps_server_host}/workflow/job-simple/{workflow_job_id}"
|
|
82
83
|
response = request_get(url=request_url, headers={"accept": "application/json; charset=utf-8"})
|
|
83
84
|
_raise_if_error(response)
|
|
@@ -86,6 +87,12 @@ def get_ps_workflow_job_status(ps_server_host: str, workflow_job_id: str) -> Job
|
|
|
86
87
|
return getattr(JobState, job_state.lower())
|
|
87
88
|
|
|
88
89
|
|
|
90
|
+
def get_ps_workflow_job_status(ps_server_host: str, workflow_job_id: str) -> Any:
|
|
91
|
+
request_url = f"{ps_server_host}/workflow/job/{workflow_job_id}"
|
|
92
|
+
response = request_get(url=request_url, headers={"accept": "application/json; charset=utf-8"})
|
|
93
|
+
_raise_if_error(response)
|
|
94
|
+
return response
|
|
95
|
+
|
|
89
96
|
def post_ps_processing_request(ps_server_host: str, processor: str, job_input: dict) -> str:
|
|
90
97
|
request_url = f"{ps_server_host}/processor/run/{processor}"
|
|
91
98
|
response = request_post(
|
ocrd_network/constants.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
2
|
|
|
3
3
|
DOCKER_IMAGE_MONGO_DB = "mongo"
|
|
4
|
-
DOCKER_IMAGE_RABBIT_MQ = "rabbitmq:
|
|
4
|
+
DOCKER_IMAGE_RABBIT_MQ = "rabbitmq:4.2-management"
|
|
5
5
|
# These feature flags are required by default to use the newer version
|
|
6
6
|
DOCKER_RABBIT_MQ_FEATURES = "quorum_queue,implicit_default_bindings,classic_mirrored_queue_version"
|
|
7
7
|
|
|
@@ -25,7 +25,7 @@ def __connect_rabbitmq_client(
|
|
|
25
25
|
except ValueError as error:
|
|
26
26
|
raise Exception("Failed to parse RabbitMQ connection data") from error
|
|
27
27
|
logger.info(f"Connecting client to RabbitMQ server: {rmq_host}:{rmq_port}{rmq_vhost}")
|
|
28
|
-
logger.debug(f"RabbitMQ client authenticates with username: {rmq_username}, password: {rmq_password}")
|
|
28
|
+
# logger.debug(f"RabbitMQ client authenticates with username: {rmq_username}, password: {rmq_password}")
|
|
29
29
|
while attempts > 0:
|
|
30
30
|
try:
|
|
31
31
|
if client_type == "consumer":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|