Skip to content
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

ocrd network processing-worker can only invoke cli #1085

Closed
joschrew opened this issue Aug 31, 2023 · 3 comments
Closed

ocrd network processing-worker can only invoke cli #1085

joschrew opened this issue Aug 31, 2023 · 3 comments

Comments

@joschrew
Copy link
Contributor

For starting workers with docker-compose I use commands like this:
command: ocrd network processing-worker --database $MONGODB_URL --queue $RABBITMQ_URL --create-queue --queue-connect-attempts 5 ocrd-anybaseocr-crop.
That creates a ProcessingWorker class with processor_class set to None. This finally leads to call run_cli in process_helpers.py.invoke_processor().
Maybe it is possible to provide the class (string with class-name is not sufficient) somehow with the ocrd network processing-worker command.

@kba
Copy link
Member

kba commented Sep 4, 2023

Maybe it is possible to provide the class (string with class-name is not sufficient) somehow with the ocrd network processing-worker command.

Possible only for processors that are installed in the same python environment as the processing worker, not possible in general IIUC.

@kba
Copy link
Member

kba commented Sep 5, 2023

Recap of the discussion yesterday:

  • We do need a generic solution to add the worker CLI to the processor CLI because that is the only way we can reasonably access the processor class which allows for caching etc.
  • The processor API should be extended in such a way that the worker CLI is programmatically added without requiring changes to the processors themselves
  • If that is not possible without hacking click's internals, then we need to adapt all the processors to add the additional CLI themselves.

@kba
Copy link
Member

kba commented Sep 6, 2023

There is no way for ocrd network processing-worker to be able to reliably deduce the python class of a processor just from the CLI name. For pythonic processors, ocrd-* --agent-type {worker,server} (or ocrd-* [server|worker] is the way to go, for bashlib processors we need ocrd network processing-worker is the only way.

@kba kba closed this as completed Sep 6, 2023
kba added a commit that referenced this issue Sep 11, 2023
replace --agent-type with subcommand, #1032, #1085
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants