Skip to content

Commit

Permalink
Merge pull request #56 from InfuseAI/feature/sc-21133/ph-apps
Browse files Browse the repository at this point in the history
add apps and apptemplates
  • Loading branch information
qrtt1 authored Oct 13, 2021
2 parents 5425a67 + a3cf4b7 commit 363b35c
Show file tree
Hide file tree
Showing 10 changed files with 1,388 additions and 4 deletions.
217 changes: 217 additions & 0 deletions docs/CLI/apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@

# Primehub Apps

```
Usage:
primehub apps <command>
Manage PrimeHub Applications
Available Commands:
create Install an application
delete Stop the PrimeHub Application
get Get the PrimeHub Application
list List PrimeHub Applications
logs Get logs of the PrimeHub Application by id
start Start the PrimeHub Application
stop Stop the PrimeHub Application
Options:
-h, --help Show the help
Global Options:
--config CONFIG Change the path of the config file (Default: ~/.primehub/config.json)
--endpoint ENDPOINT Override the GraphQL API endpoint
--token TOKEN Override the API Token
--group GROUP Override the current group
--json Output the json format (output human-friendly format by default)
```


### create

Install an application


```
primehub apps create
```


* *(optional)* file: The file path of PrimeHub application configuration




### delete

Stop the PrimeHub Application


```
primehub apps delete <id>
```

* id





### get

Get the PrimeHub Application


```
primehub apps get <id>
```

* id





### list

List PrimeHub Applications


```
primehub apps list
```





### logs

Get logs of the PrimeHub Application by id


```
primehub apps logs <id>
```

* id: The job id


* *(optional)* follow: Wait for additional logs to be appended

* *(optional)* tail: Show last n lines




### start

Start the PrimeHub Application


```
primehub apps start <id>
```

* id





### stop

Stop the PrimeHub Application


```
primehub apps stop <id>
```

* id






## Examples

The `create` action helps you to install a new PrimeHub application. It shows an example that can be used to create
a `code-server` application:

```
$ primehub apps create
PrimeHub application configuration is required.
Example:
{
"templateId": "code-server",
"id": "code-server-26fcc",
"displayName": "my-code-server-26fcc",
"env": [
{
"name": "key1",
"value": "value1"
}
],
"instanceType": "cpu-1",
"scope": "primehub"
}
* the scope field could be one of the ['public', 'primehub', 'group']
```

It follows our convention accepting a STDIN or with a real file by `--file` optional:

```
$ primehub apps create <<EOF
{
"templateId": "code-server",
"id": "code-server-26fcc",
"displayName": "my-code-server-26fcc",
"env": [
{
"name": "key1",
"value": "value1"
}
],
"instanceType": "cpu-1",
"scope": "primehub"
}
EOF
```

After the application created, it could be found at list:

```
$ primehub apps list
id: code-server-26fcc
displayName: my-code-server-26fcc
appVersion: v3.9.2
appName: code-server
appDefaultEnv: None
appTemplate:
name: Code Server
docLink: https://github.com/cdr/code-server
description: Run VS Code on any machine anywhere and access it in the browser.
groupName: phusers
instanceType: cpu-1
instanceTypeSpec:
name: cpu-1
displayName: CPU 1 XD
cpuLimit: 1
memoryLimit: 2
gpuLimit: 0
scope: primehub
appUrl: http://primehub-python-sdk.primehub.io/console/apps/code-server-26fcc
internalAppUrl: http://app-code-server-26fcc:8080/console/apps/code-server-26fcc
svcEndpoints: ['app-code-server-26fcc:8080']
env: [{'name': 'key1', 'value': 'value1'}]
stop: False
status: Ready
message: Deployment is ready
pods: [{'logEndpoint': 'http://primehub-python-sdk.primehub.io/api/logs/pods/app-code-server-26fcc-765bf579c5-srcft'}]
```
115 changes: 115 additions & 0 deletions docs/CLI/apptemplates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@

# Primehub Apptemplates

```
Usage:
primehub apptemplates <command>
Get PhAppTemplates
Available Commands:
get Get a PhApp template
list List PhApp templates
Options:
-h, --help Show the help
Global Options:
--config CONFIG Change the path of the config file (Default: ~/.primehub/config.json)
--endpoint ENDPOINT Override the GraphQL API endpoint
--token TOKEN Override the API Token
--group GROUP Override the current group
--json Output the json format (output human-friendly format by default)
```


### get

Get a PhApp template


```
primehub apptemplates get <id>
```

* id





### list

List PhApp templates


```
primehub apptemplates list
```






## Examples

The `list` action will show you each template that is registered to the PrimeHub

```
primehub apptemplates list
```

```
id: code-server
name: Code Server
version: v3.9.2
description: Run VS Code on any machine anywhere and access it in the browser.
docLink: https://github.com/cdr/code-server
image: codercom/code-server:3.9.2
id: label-studio
name: Label Studio
version: 1.1.0
description: Label Studio is an open source data labeling tool for labeling and exploring multiple types of data. You can perform many different types of labeling for many different data formats.
docLink: https://labelstud.io/guide/
image: heartexlabs/label-studio:1.1.0
id: matlab
name: Matlab
version: r2020b
description: MATLAB is a programming platform designed for engineers and scientists. The MATLAB Deep Learning Container provides algorithms, pretrained models, and apps to create, train, visualize, and optimize deep neural networks.
docLink: https://ngc.nvidia.com/catalog/containers/partners:matlab/tags
image: nvcr.io/partners/matlab:r2020b
id: mlflow
name: MLflow
version: v1.9.1
description: MLflow is an open source platform to manage the ML lifecycle, including experimentation, reproducibility, deployment, and a central model registry.
docLink: https://www.mlflow.org/docs/1.9.1/index.html
image: larribas/mlflow:1.9.1
id: streamlit
name: Streamlit
version: v0.79.0
description: Streamlit turns data scripts into shareable web apps in minutes. All in Python. All for free. No front‑end experience required.
docLink: https://docs.primehub.io/docs/primehub-app-builtin-streamlit
image: infuseai/streamlit:v0.79.0
```

You could get one of them with `get` action and the id of a template:

```
primehub apptemplates get code-server
```


```
id: code-server
name: Code Server
version: v3.9.2
description: Run VS Code on any machine anywhere and access it in the browser.
docLink: https://github.com/cdr/code-server
image: codercom/code-server:3.9.2
```
8 changes: 4 additions & 4 deletions docs/CLI/deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ stop: False
endpointAccessType: public
endpointClients: []
status: Deployed
endpoint: https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
endpoint: http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
availableReplicas: 1
message: Deployment is deployed and available now
pods: [{'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-8qgvf'}]
Expand Down Expand Up @@ -324,7 +324,7 @@ primehub deployments get quickstart-iris-cfmnh --json | jq
"endpointAccessType": "public",
"endpointClients": [],
"status": "Deployed",
"endpoint": "https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions",
"endpoint": "http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions",
"availableReplicas": 1,
"message": "Deployment is deployed and available now",
"pods": [
Expand Down Expand Up @@ -360,8 +360,8 @@ stop: False
endpointAccessType: public
endpointClients: []
status: Deploying
endpoint: https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
endpoint: http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
availableReplicas: 1
message: Deployment is being deployed and not available now
pods: [{'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-8qgvf'}, {'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-wxzs8'}]
```
```
Loading

0 comments on commit 363b35c

Please sign in to comment.