Basic#

Tip

JCloud client is an opensource project. Check here for its repository.

Install#

pip install jcloud
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.

Login#

jc login

You can use a Google/GitHub account to register and login. Without logging in, you can’t do anything.

Deploy#

In Jina’s idiom, a project is a Flow, which represents an end-to-end task such as indexing, searching or recommending. In this README, we will use “project” and “Flow” interchangeably.

A Flow can have two types of file structure: a single YAML file or a project folder.

A single YAML file#

A self-contained YAML file, consisting of all configs at the Flow-level and Executor-level.

All Executors’ uses must follow the format jinahub+docker://MyExecutor (from Jina Hub) to avoid any local file dependencies.

e.g.-

# flow.yml
jtype: Flow
executors:
  - name: sentencizer
    uses: jinahub+docker://Sentencizer

To deploy,

jc deploy flow.yml

A project folder#

Just like a regular Python project, you can have sub-folders of Executor implementations; and a flow.yml on the top-level to connect all Executors together.

You can create an example local project using jc new. The default structure looks like:

.
├── .env
├── executor1
│   ├── config.yml
│   ├── executor.py
│   └── requirements.txt
└── flow.yml

where,

  • executor1 directory has all Executor related code/config. You can read the best practices for file structures. Multiple such Executor directories can be created.

  • flow.yml Your Flow YAML.

  • .env All environment variables used during deployment.

To deploy,

jc deploy ./hello

The Flow is successfully deployed when you see:

../../../_images/deploy.png

You will get a Flow ID, say 173503c192. This ID is required to manage, view logs and remove the Flow.

As this Flow is deployed with default gRPC gateway (feel free to change it to http or websocket), you can use jina.Client to access it:

from jina import Client, Document

c = Client(host='https://173503c192.wolf.jina.ai')
print(c.post('/', Document(text='hello')))

View logs#

To watch the logs in realtime:

jc logs 173503c192

You can also stream logs for a particular Executor by passing its name:

jc logs 173503c192 --executor sentencizer

Remove Flows#

You can either remove a single Flow, multiple selected Flows or even all Flows by passing different kind of identifiers.

To remove a single Flow:

jc remove 173503c192

To remove multiple selected Flows:

jc remove 173503c192 887f6313e5 ddb8a2c4ef

To remove all Flows:

jc remove all

By default, removing multiple selected / all Flows would be in interactive mode where confirmation will be sent prior to the deletion, to make it non-interactive to better suit your use case, set below environment variable before running the command:

export JCLOUD_NO_INTERACTIVE=1

Get status#

jc status 173503c192
../../../_images/status.png

List Flows#

jc list

You can see the ALIVE Flows deployed by you.

../../../_images/list.png

You can also filter your Flows by passing a status:

jc list --status FAILED
../../../_images/list_failed.png

Or see all the flows:

jc list --status ALL
../../../_images/list_all.png