Skip to content

Commit

Permalink
fix: cli args help text (#2528)
Browse files Browse the repository at this point in the history
* fix: cli args help text
  • Loading branch information
hanxiao authored Jun 1, 2021
1 parent 1d369e1 commit 60ee474
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Jina allows you to build deep learning-powered search-as-a-service in just minut
🌌 **Universal data type** - Large-scale indexing and querying of any kind of unstructured data: video, image, long/short text, music, source code, PDF, etc.

🌩️ **Fast & cloud-native** - Distributed architecture from day one. Scalable & cloud-native by design: enjoy
containerizing, distributing, sharding, async, REST/gRPC/WebSocket.
containerizing, distributing, streaming, paralleling, sharding, async scheduling with REST/gRPC/WebSocket.

⏱️ **Save time** - *The* design pattern of neural search systems, from zero to a production-ready system in minutes.

Expand Down
8 changes: 7 additions & 1 deletion cli/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def _gaa(key, parser):
if __name__ == '__main__':
_update_autocomplete()


ac_table = {
'commands': [
'--help',
Expand Down Expand Up @@ -70,7 +71,6 @@ def _gaa(key, parser):
'--help',
'--workdir',
'--download-proxy',
'--uses',
'--index-data-url',
'--port-expose',
'--unblock-query-flow',
Expand Down Expand Up @@ -103,6 +103,7 @@ def _gaa(key, parser):
'--memory-hwm',
'--on-error-strategy',
'--num-part',
'--freeze-network-settings',
'--uses-internal',
'--entrypoint',
'--docker-kwargs',
Expand Down Expand Up @@ -131,6 +132,7 @@ def _gaa(key, parser):
'--replicas',
'--polling',
'--scheduling',
'--external',
'--pod-role',
'--peas-hosts',
],
Expand Down Expand Up @@ -160,6 +162,7 @@ def _gaa(key, parser):
'--memory-hwm',
'--on-error-strategy',
'--num-part',
'--freeze-network-settings',
'--uses-internal',
'--entrypoint',
'--docker-kwargs',
Expand Down Expand Up @@ -188,6 +191,7 @@ def _gaa(key, parser):
'--replicas',
'--polling',
'--scheduling',
'--external',
'--pod-role',
'--peas-hosts',
],
Expand Down Expand Up @@ -230,6 +234,7 @@ def _gaa(key, parser):
'--memory-hwm',
'--on-error-strategy',
'--num-part',
'--freeze-network-settings',
'--max-message-size',
'--prefetch',
'--prefetch-on-recv',
Expand Down Expand Up @@ -282,6 +287,7 @@ def _gaa(key, parser):
'--memory-hwm',
'--on-error-strategy',
'--num-part',
'--freeze-network-settings',
'--uses-internal',
'--entrypoint',
'--docker-kwargs',
Expand Down
5 changes: 3 additions & 2 deletions jina/flow/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ def _rsetattr(obj, attr, val):
node_to_update.args.freeze_network_settings
and _rgetattr(node_to_update, attr_to_set) != value_to_set
):
org_value = _rgetattr(node_to_update, attr_to_set)
raise FlowTopologyError(
f'Cannot update the parameters of Pod {node_to_update.args.name} because it is frozen. '
f'{node_to_update.args.name} is expecting {attr_to_set} to be {value_to_set}'
f'Cannot set `{node_to_update.args.name}.{attr_to_set}={value_to_set!s}` '
f'because it is frozen to {org_value!s} by --freeze-network-settings'
)
_rsetattr(node_to_update, attr_to_set, value_to_set)

Expand Down
15 changes: 8 additions & 7 deletions jina/parsers/peapods/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ def mixin_base_pod_parser(parser):
help='The strategy of scheduling workload among Peas',
)

gp.add_argument(
'--external',
action='store_true',
default=False,
help='The Pod will be considered an external Pod that has been started independently from the Flow. This Pod '
'will not be context managed by the Flow, and is considered with `--freeze-network-settings`',
)

# hidden CLI used for internal only

gp.add_argument(
Expand All @@ -78,10 +86,3 @@ def mixin_base_pod_parser(parser):
Peas will be evenly distributed among the hosts. By default,
peas are running on host provided by the argument ``host``''',
)
gp.add_argument(
'--external',
action='store_true',
default=False,
help='The Pod will be considered a external Pod that has been started independently from the Pod. The Pod '
'will not be context managed by the Flow',
)
4 changes: 2 additions & 2 deletions jina/parsers/peapods/runtimes/zed.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def mixin_zed_runtime_parser(parser):
'--freeze-network-settings',
action='store_true',
default=False,
help='If set, then `host-in`, `host-out`, `port-in`, `port-out`, `socket-in`, `socket-out` network-related parameters can not be changed by the Flow during build time.'
'the Flow object would not be allowed to change them '
help='''If set, then `host-in`, `host-out`, `port-in`, `port-out`, `socket-in`, `socket-out` network-related
parameters are frozen. They can not be changed by the Flow during the build time. '''
if _SHOW_ALL_ARGS
else argparse.SUPPRESS,
)
20 changes: 6 additions & 14 deletions jina/peapods/pods/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,6 @@ def close(self):
"""
self.__exit__(None, None, None)

def block(self):
"""Block the process until user hits KeyboardInterrupt """

import threading

try:
threading.Event().wait()
except KeyboardInterrupt:
pass

@staticmethod
def _set_conditional_args(args):
if args.pod_role == PodRoleType.GATEWAY:
Expand Down Expand Up @@ -311,16 +301,18 @@ def _fill_in_host(bind_args: Namespace, connect_args: Namespace) -> str:
# in this case we (at local) need to know about remote the BIND address
return bind_args.host

@property
@abstractmethod
def head_args(self):
def head_args(self) -> Namespace:
"""Get the arguments for the `head` of this BasePod.
.. # noqa: DAR201
"""
...

@property
@abstractmethod
def tail_args(self):
def tail_args(self) -> Namespace:
"""Get the arguments for the `tail` of this BasePod.
.. # noqa: DAR201
Expand Down Expand Up @@ -404,7 +396,7 @@ def _parse_args(
return self._parse_base_pod_args(args)

@property
def head_args(self):
def head_args(self) -> Namespace:
"""Get the arguments for the `head` of this Pod.
Expand Down Expand Up @@ -436,7 +428,7 @@ def head_args(self, args):
raise ValueError('ambiguous head node, maybe it is deducted already?')

@property
def tail_args(self):
def tail_args(self) -> Namespace:
"""Get the arguments for the `tail` of this BasePod.
.. # noqa: DAR201
Expand Down

0 comments on commit 60ee474

Please sign in to comment.