Skip to content

Commit 2e51e58

Browse files
committed
Merge remote-tracking branch 'origin/remove-processor-server'
2 parents a70501d + 9b8d93a commit 2e51e58

1 file changed

Lines changed: 4 additions & 40 deletions

File tree

web_api.md

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ distributed environment. This setup greatly improves the flexibility, scalabilit
1212
* **Processing Worker**: a Processing Worker is an [OCR-D Processor](https://ocr-d.de/en/spec/glossary#ocr-d-processor)
1313
running as a worker, i.e. listening to the Process Queue, pulling new jobs when available, processing them, and
1414
pushing the updated job statuses back to the queue if necessary.
15-
* **Processor Server**: a Processor Server is an [OCR-D Processor](https://ocr-d.de/en/spec/glossary#ocr-d-processor)
16-
running as a server over HTTP. It accepts requests, executes the processor with parameters provided in the requests,
17-
and returns responses.
1815
* **Workflow Server**: a Workflow Server is a server which exposes REST endpoints in the `Workflow` section of
1916
the [Web API specification](openapi.yml). In particular, with a `POST /workflow/run` request a workflow can be
2017
executed. The Workflow Server comprises a chain of call to the `POST /processor/run/{executable}` endpoint in an
@@ -70,7 +67,7 @@ i.e. workspaces residing in the server's file system.
7067

7168
## 4. Suggested OCR-D System Architecture
7269

73-
This document presents two possible architecture setup using OCR-D Network and the technical details behind. In both
70+
This document presents a possible architecture setup using OCR-D Network and the technical details behind. In the
7471
setup, all servers are implemented using [FastAPI](https://fastapi.tiangolo.com/). Behind the scene, it
7572
runs [Uvicorn](https://www.uvicorn.org/), an [ASGI](https://asgi.readthedocs.io/en/latest/) web server implementation
7673
for Python. [RabbitMQ](https://www.rabbitmq.com/) is used for the Process Queue, and [MongoDB](https://www.mongodb.com/)
@@ -80,7 +77,7 @@ recommend using [Traefik](https://doc.traefik.io/traefik/).
8077
### 4.1 Processors as workers
8178

8279
<figure>
83-
<img src="/assets/web-api-distributed-queue.jpg" alt="Distributed architecture where processors are deployed as workers."/>
80+
<img src="/assets/web-api-distributed-queue.jpg" alt="Distributed architecture with processors deployed as workers."/>
8481
<figcaption align="center">
8582
<b>Fig. 1:</b> A distributed architecture with message queue. In this architecture, processors are deployed as workers.
8683
</figcaption>
@@ -112,26 +109,9 @@ To get data into the NFS, one could use the `POST /workspace` endpoint to
112109
upload [OCRD-ZIP](https://ocr-d.de/en/spec/ocrd_zip)files. However, this approach is only appropriate for testing or
113110
very limited data sizes. Usually, Workspace Server should be able to pull data from other storage.
114111

115-
### 4.2 Processors as servers
116-
117-
<figure>
118-
<img src="/assets/web-api-distributed.jpg" alt="Distributed architecture where processors are deployed as servers."/>
119-
<figcaption align="center">
120-
<b>Fig. 2:</b> A distributed architecture where processors are deployed as servers.
121-
</figcaption>
122-
</figure>
123-
124-
The difference between this architecture and the one shown in Fig. 1 is the processors. In this architecture, each
125-
processor runs as a server and exposes one endpoint. When the Processing Server receives a request, it will forward that
126-
request to the respective Processor Server and wait for the response.
127-
128-
This architecture is simpler than the other one, since there is no need to have a Process Queue involved. Without a
129-
queue, all communications are synchronous. It means that clients need to wait for responses from Processing Server. It
130-
might take a long time, therefore high timeout is recommended.
131-
132112
## 5. Usage
133113

134-
Both setups above can be used as follows:
114+
The setup above can be used as follows:
135115

136116
1. Retrieve information about the system via endpoints in the `Discovery` section.
137117
2. Create a workspace (from an [OCRD-ZIP](https://ocr-d.de/en/spec/ocrd_zip) or METS URL) via the `POST /workspace`
@@ -374,23 +354,7 @@ $ ocrd network processing-worker <processor-name> --queue=<queue-address> --data
374354
* `--database`: a [MongoDB connection string](https://www.mongodb.com/docs/manual/reference/connection-string/) to a
375355
running instance.
376356

377-
### 6.5 Processor Server
378-
379-
Same as Processing Worker, there are also two ways to start a Processor Server:
380-
381-
```shell
382-
# 1. Use processor name
383-
$ <processor-name> server --address=<server-address> --database=<database-address>
384-
385-
# 2. Use ocrd CLI bundled with OCR-D/core
386-
$ ocrd network processor-server <processor-name> --queue=<queue-address> --database=<database-address>
387-
```
388-
389-
* `--address`: The URL/address to run the processor server on, format: host:port.
390-
* `--database`: a [MongoDB connection string](https://www.mongodb.com/docs/manual/reference/connection-string/) to a
391-
running instance.
392-
393-
### 6.6 Database
357+
### 6.5 Database
394358

395359
A database is required to store necessary information such as users requests, jobs statuses, workspaces,
396360
etc. [MongoDB](https://www.mongodb.com/) is used in this case. To connect to MongoDB via a Graphical User

0 commit comments

Comments
 (0)