jina-ai / jina

☁️ Build multimodal AI applications with cloud-native stack
https://docs.jina.ai
Apache License 2.0
20.98k stars 2.22k forks source link

jina ping not working #392

Closed maximilianwerk closed 4 years ago

maximilianwerk commented 4 years ago

Describe the bug The command jina ping localhost 12345 is not runnable. It results in

usage: jina ping [-h] [--timeout] [--retries] [--print-response] host port
jina ping: error: the following arguments are required: host, port

This makes running the tutorial about jina pod remotely not runnable.

Describe how you solve it

This happens due to the default argument collection in jina/main/__init__.py:_get_run_args. The host and port of the ping command line tool are the only missing arguments, which are not flags, but positional arguments and have no default value. Adding a default value makes it runnable again. Anyhow, the given default values don't make to much sense. Introducing a special logic for the ping use-case in the _get_run_args function seems to be a bad choice as well. Thus bad default arguments might be fine, since ping usually is used with a host and port.

Fix is here.

hanxiao commented 4 years ago

Thanks a lot for reporting and making a PR. Apparently we have some permission issue on our CICD system and it didn't run for you, we are solving it.

The real problem of jina ping is in the way of fetching default_args. I fixed it in #394

maximilianwerk commented 4 years ago

While I agree, that the default_args fetching was not resilient enough for the use case at hand, I wonder if the whole custom build logic about argument parsing and auto-completion is not something a framework like Click should solve. While a framework most probably will not suit each and every detailed use case, it takes away a lot of implementation effort (and consecutive bug fixing), such that the developers of Jina can focus on the apparent strength of Jina: building an A-class neural search framework.