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

replace --agent-type with subcommand, #1032, #1085 #1087

Merged
merged 8 commits into from
Sep 11, 2023
Merged

replace --agent-type with subcommand, #1032, #1085 #1087

merged 8 commits into from
Sep 11, 2023

Conversation

kba
Copy link
Member

@kba kba commented Sep 6, 2023

  • Instead of an option --agent-type, implement the behavior as subcommands, i.e.
ocrd-foo --agent-type worker ...

becomes

ocrd-foo worker ...

Also removes the exception handling because it does not actually handle the exceptions, just stringifies them and we want full stack traces if something goes wrong.

@MehmedGIT
Copy link
Contributor

Initially, I did not see a reason why we would need that change. However, now when I think about it, this refines the way we handle the worker and server subcommands. The --queue option is exclusive for the worker and the --address option is exclusive for the server.

So ocrd-* worker --help and ocrd-* server --help could have a more meaningful output for the general user.

Currently, ocrd-* --help is still lacking the --address flag and the additional processing worker flags (--create-queue and --queue-connect-attempts) added in #1075.

Options for Processing Worker server:
  --queue                         The RabbitMQ server address in format
                                  "amqp://{user}:{pass}@{host}:{port}/{vhost}"
                                  [amqp://admin:admin@localhost:5672]
  --database                      The MongoDB server address in format
                                  "mongodb://{host}:{port}"
                                  [mongodb://localhost:27018]
  --type                          type of processing: either "worker" or "server"

@MehmedGIT
Copy link
Contributor

I could already push here the adaptation changes needed in the ocrd network to use the subcommands.

@MehmedGIT
Copy link
Contributor

The bash library should still be adapted appropriately. Currently, it still accepts --type.

@kba kba marked this pull request as ready for review September 8, 2023 12:54
@kba
Copy link
Member Author

kba commented Sep 8, 2023

So ocrd-* worker --help and ocrd-* server --help could have a more meaningful output for the general user.

OK, so how about three --help variants. One for the general CLI which lists the worker/server subcommands but omits the sections Options for Processing Worker: and Options for Processor Server:. Then one for ocrd-* worker --help which lists only those options and one for ocrd-* server which lists those options plus the general Options for processing?

@MehmedGIT
Copy link
Contributor

That would be even better!

@kba
Copy link
Member Author

kba commented Sep 8, 2023

The bash library should still be adapted appropriately. Currently, it still accepts --type.

Implemented in e6a35a1, now to fix the errors I've introduced apparently :/

@kba
Copy link
Member Author

kba commented Sep 8, 2023

now to fix the errors I've introduced apparently :/

Debug echo&exit was still in there 🙃 time for weekend.

@kba kba merged commit d718553 into master Sep 11, 2023
2 checks passed
@kba kba deleted the worker-cli branch September 11, 2023 09:23
@kba kba mentioned this pull request Sep 12, 2023
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

Successfully merging this pull request may close these issues.

2 participants