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

feat: include jcloud cli #5074

Merged
merged 23 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b64adb9
feat: include jcloud cli
alaeddine-13 Aug 17, 2022
9c340ff
style: fix overload and cli autocomplete
jina-bot Aug 17, 2022
0e6997a
chore: improve help message
alaeddine-13 Aug 17, 2022
66c01a4
Merge branch 'feat-jcloud-cli' of https://github.com/jina-ai/jina int…
alaeddine-13 Aug 17, 2022
eafca59
chore: try jina cli with modified jcloud
alaeddine-13 Aug 18, 2022
da1169a
Merge branch 'master' into feat-jcloud-cli
alaeddine-13 Aug 18, 2022
91ad8c8
chore: try jina cli with modified jcloud
alaeddine-13 Aug 18, 2022
fbab23c
fix: merge conflicts
alaeddine-13 Aug 18, 2022
aaef1a1
chore: add jcloud to silent print
alaeddine-13 Aug 18, 2022
83775f4
fix: fix requirements
alaeddine-13 Aug 18, 2022
49d8fd9
fix: fix requirements
alaeddine-13 Aug 18, 2022
87885d5
style: fix overload and cli autocomplete
jina-bot Aug 18, 2022
c414bde
chore: update help message
alaeddine-13 Aug 18, 2022
9445c30
Merge branch 'feat-jcloud-cli' of https://github.com/jina-ai/jina int…
alaeddine-13 Aug 18, 2022
c81f4cd
chore: update cli args dist
alaeddine-13 Aug 18, 2022
d7ee8f3
chore: add jcloud
alaeddine-13 Aug 18, 2022
7305c0d
style: fix overload and cli autocomplete
jina-bot Aug 18, 2022
8b13968
chore: update docstring
alaeddine-13 Aug 18, 2022
2d183ad
Merge branch 'feat-jcloud-cli' of https://github.com/jina-ai/jina int…
alaeddine-13 Aug 18, 2022
3046bf8
docs: update docs
alaeddine-13 Aug 18, 2022
67fc438
fix(cli): jina auth cli error
hanxiao Aug 18, 2022
1236d85
Merge branch 'feat-jcloud-cli' of https://github.com/jina-ai/jina int…
hanxiao Aug 18, 2022
8ea3f43
style: fix overload and cli autocomplete
jina-bot Aug 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/fundamentals/jcloud/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ At this point, Jina Cloud hosts all your Jina projects and offers computational/

## Basic
### Install

If you have {ref}`installed jina <swagger-ui>`, there is no need to install `jcloud` CLI. However, you still can
install the CLI individually:
```bash
pip install jcloud
jc -h
Expand All @@ -30,6 +31,14 @@ jc -h
In case `jc` is already occupied by another tool, please use `jcloud` instead. If your pip install doesn't register bash commands for you, you can run `python -m jcloud -h`.
```

```{important}
You can use the `jcloud` CLI in 2 ways:
* If you installed it with `jina`, all of its commands come under the `jina cloud` command. Try `jina cloud --help` for
more info.
* If you installed it individually, all of its commands come under the `jc` or `jcloud` executable.
For the rest of this section, we will be using `jc` command rather than `jina cloud`.
```

### Login

```bash
Expand Down
3 changes: 2 additions & 1 deletion extra-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ grpcio-health-checking>=1.46.0: core
pyyaml>=5.3.1: core
packaging>=20.0: core
docarray>=0.13.14: core
jina-hubble-sdk==0.12.4: core
jina-hubble-sdk>=0.13.0: core
jcloud>=0.0.35: core
uvloop: perf,standard,devel
prometheus_client: perf,standard,devel
fastapi>=0.76.0: standard,devel
Expand Down
23 changes: 17 additions & 6 deletions jina/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,34 @@ def get_main_parser():
)
)

from hubble.parsers import get_main_parser as get_hubble_parser

get_hubble_parser(
sp.add_parser(
'auth',
description='Login to Jina AI with your GitHub/Google/Email account',
formatter_class=_chf,
help='Login to Jina AI',
)
)

set_hub_parser(
sp.add_parser(
'hub',
help='Push/pull an Executor to/from Jina Hub',
help='Manage Executor on Jina Hub',
description='Push/Pull an Executor to/from Jina Hub',
formatter_class=_chf,
)
)

from hubble.parsers import get_main_parser as get_hubble_parser
from jcloud.parsers import get_main_parser as get_jcloud_parser

get_hubble_parser(
get_jcloud_parser(
sp.add_parser(
'auth',
description='Login to Jina AI with your GitHub/Google/Email account',
'cloud',
description='Manage Flows on Jina Cloud',
formatter_class=_chf,
help='Login to Jina AI',
help='Manage Flows on Jina Cloud',
)
)

Expand Down
3 changes: 2 additions & 1 deletion jina/resources/extra-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ grpcio-health-checking>=1.46.0: core
pyyaml>=5.3.1: core
packaging>=20.0: core
docarray>=0.13.14: core
jina-hubble-sdk==0.12.4: core
jina-hubble-sdk>=0.13.0: core
jcloud>=0.0.35: core
uvloop: perf,standard,devel
prometheus_client: perf,standard,devel
fastapi>=0.76.0: standard,devel
Expand Down
2 changes: 1 addition & 1 deletion jina_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def _get_run_args(print_args: bool = True):

console = get_rich_console()

silent_print = {'help', 'hub', 'export', 'auth'}
silent_print = {'help', 'hub', 'export', 'auth', 'cloud'}

parser = get_main_parser()
if len(sys.argv) > 1:
Expand Down
10 changes: 10 additions & 0 deletions jina_cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,13 @@ def auth(args: 'Namespace'):
from hubble import api

getattr(api, args.auth_cli.replace('-', '_'))(args)


def cloud(args: 'Namespace'):
"""
Use jcloud (Jina Cloud) commands
:param args: arguments coming from the CLI.
"""
from jcloud import api

getattr(api, args.jc_cli.replace('-', '_'))(args)
38 changes: 30 additions & 8 deletions jina_cli/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
'export',
'new',
'gateway',
'hub',
'auth',
'hub',
'cloud',
'help',
'pod',
'deployment',
Expand Down Expand Up @@ -150,6 +151,13 @@
'--retries',
'--floating',
],
'auth login': ['--help', '--force'],
'auth logout': ['--help'],
'auth token create': ['--help', '--expire'],
'auth token delete': ['--help'],
'auth token list': ['--help'],
'auth token': ['--help', 'create', 'delete', 'list'],
'auth': ['--help', 'login', 'logout', 'token'],
'hub new': [
'--help',
'--name',
Expand Down Expand Up @@ -183,13 +191,27 @@
'--force',
],
'hub': ['--help', 'new', 'push', 'pull'],
'auth login': ['--help', '--force'],
'auth logout': ['--help'],
'auth token create': ['--help', '--expire'],
'auth token delete': ['--help'],
'auth token list': ['--help'],
'auth token': ['--help', 'create', 'delete', 'list'],
'auth': ['--help', 'login', 'logout', 'token'],
'cloud login': ['--help'],
'cloud deploy': ['--help', '--name', '--workspace', '--env-file'],
'cloud list': ['--help', '--status'],
'cloud logs': ['--help', '--executor'],
'cloud status': ['--help'],
'cloud remove': ['--help'],
'cloud new': ['--help'],
'cloud survey': ['--help'],
'cloud': [
'--help',
'--version',
'--loglevel',
'login',
'deploy',
'list',
'logs',
'status',
'remove',
'new',
'survey',
],
'help': ['--help'],
'pod': [
'--help',
Expand Down