-
Notifications
You must be signed in to change notification settings - Fork 32
Standalone Processor Server (#884 + #974) #1030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
1c37ad5
basics of the procesor server
MehmedGIT 42f16ab
Adapt the fix from #974
MehmedGIT ba92c87
check defaults, pass shallow copy
MehmedGIT 0644b9e
complete processor server internals
MehmedGIT cdb73d5
implement most of the logic for everything
MehmedGIT 6476ebb
fix some nasty errors
MehmedGIT 0f8367c
use cleaner approach with sys.exit()
MehmedGIT 4151a40
remove initLogging from processing worker
MehmedGIT 36fec45
log exceptions of the processing server
MehmedGIT b2ad725
fix serialization/deserialization
MehmedGIT 275d98b
refactoring: first portion
MehmedGIT 498ed40
refactoring: second portion
MehmedGIT 94c76e0
small improvements
MehmedGIT d9af9a0
Merge branch 'master' into processor-server
MehmedGIT bf44190
return: deploy type as enum
MehmedGIT 1b91ccb
Merge branch 'processor-server' of github.com:OCR-D/core into process…
MehmedGIT 863ae4a
separate: creation/execution of job task
MehmedGIT 8e59e1c
add background tasks caveat
MehmedGIT dbf1af6
change tool/version read
MehmedGIT c31c5b7
combine network cli under a group
MehmedGIT 93482d3
remove unnecessary files
MehmedGIT f5c34f9
clean network cli
MehmedGIT 7bf5e78
abstract network cli in ocrd_network
MehmedGIT 5ee1903
implement skeleton for client
MehmedGIT 845bc09
refactor: naming
MehmedGIT 94cec8e
fix typo
MehmedGIT b1ce98b
full cli path of ocrd_network
MehmedGIT 4a5200b
full paths network cli
MehmedGIT 0b1b551
setup.py - ocrd_network.cli
MehmedGIT ee61852
flexible config: either worker/server or both
MehmedGIT 03a77bd
adapt runtime data for worker/server
MehmedGIT bb83ade
Add type option to bashlib-call and help output
joschrew 845cbb6
Fix process worker/server bashlib invocation
joschrew d680e90
processor server: blocking api
MehmedGIT 4b5d48e
Use async req to processor servers
MehmedGIT 0520742
:todo: reference discussion on number of pages
kba 7d7991e
Merge branch 'master' into processor-server
kba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| """ | ||
| OCR-D CLI: start the processor server | ||
|
|
||
| .. click:: ocrd.cli.processor_server:processor_server_cli | ||
| :prog: ocrd processor-server | ||
| :nested: full | ||
| """ | ||
| import click | ||
| import logging | ||
| from ocrd_utils import initLogging | ||
| from ocrd_network import ( | ||
| DatabaseParamType, | ||
| ProcessingServerParamType, | ||
| ProcessorServer, | ||
| ) | ||
|
|
||
|
|
||
| @click.command('processor-server') | ||
| @click.argument('processor_name', required=True, type=click.STRING) | ||
| @click.option('--agent_address', | ||
| help='The URL of the processor server, format: host:port', | ||
| type=ProcessingServerParamType(), | ||
| required=True) | ||
| @click.option('-d', '--database', | ||
| default="mongodb://localhost:27018", | ||
| help='The URL of the MongoDB, format: mongodb://host:port', | ||
| type=DatabaseParamType(), | ||
| required=True) | ||
| def processor_server_cli(processor_name: str, agent_type: str, agent_address: str, database: str): | ||
| """ | ||
| Start ocr-d processor as a server | ||
| """ | ||
| initLogging() | ||
| # TODO: Remove before the release | ||
| logging.getLogger('ocrd.network').setLevel(logging.DEBUG) | ||
|
|
||
| try: | ||
| # TODO: Better validate that inside the ProcessorServer itself | ||
| host, port = agent_address.split(':') | ||
| processor_server = ProcessorServer( | ||
| mongodb_addr=database, | ||
| processor_name=processor_name, | ||
| processor_class=None, # For readability purposes assigned here | ||
| ) | ||
| processor_server.run_server(host=host, port=int(port)) | ||
| except Exception as e: | ||
| raise Exception("Processor server has failed with error") from e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.