Passed
Pull Request — master (#1030)
by Konstantin
02:43
created

ocrd_network.cli.processing_server   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 16
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A processing_server_cli() 0 18 1
1
import click
2
from .. import (
3
    ProcessingServer,
4
    ServerAddressParamType
5
)
6
7
8
@click.command('processing-server')
9
@click.argument('path_to_config', required=True, type=click.STRING)
10
@click.option('-a', '--address',
11
              default="localhost:8080",
12
              help='The URL of the Processing server, format: host:port',
13
              type=ServerAddressParamType(),
14
              required=True)
15
def processing_server_cli(path_to_config, address: str):
16
    """
17
    Start the Processing Server
18
    (proxy between the user and the
19
    Processing Worker(s) / Processor Server(s))
20
    """
21
22
    # Note, the address is already validated with the type field
23
    host, port = address.split(':')
24
    processing_server = ProcessingServer(path_to_config, host, port)
25
    processing_server.start()
26