Skip to content

Commit 363b35c

Browse files
authored
Merge pull request #56 from InfuseAI/feature/sc-21133/ph-apps
add apps and apptemplates
2 parents 5425a67 + a3cf4b7 commit 363b35c

File tree

10 files changed

+1388
-4
lines changed

10 files changed

+1388
-4
lines changed

docs/CLI/apps.md

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
2+
# Primehub Apps
3+
4+
```
5+
Usage:
6+
primehub apps <command>
7+
8+
Manage PrimeHub Applications
9+
10+
Available Commands:
11+
create Install an application
12+
delete Stop the PrimeHub Application
13+
get Get the PrimeHub Application
14+
list List PrimeHub Applications
15+
logs Get logs of the PrimeHub Application by id
16+
start Start the PrimeHub Application
17+
stop Stop the PrimeHub Application
18+
19+
Options:
20+
-h, --help Show the help
21+
22+
Global Options:
23+
--config CONFIG Change the path of the config file (Default: ~/.primehub/config.json)
24+
--endpoint ENDPOINT Override the GraphQL API endpoint
25+
--token TOKEN Override the API Token
26+
--group GROUP Override the current group
27+
--json Output the json format (output human-friendly format by default)
28+
29+
```
30+
31+
32+
### create
33+
34+
Install an application
35+
36+
37+
```
38+
primehub apps create
39+
```
40+
41+
42+
* *(optional)* file: The file path of PrimeHub application configuration
43+
44+
45+
46+
47+
### delete
48+
49+
Stop the PrimeHub Application
50+
51+
52+
```
53+
primehub apps delete <id>
54+
```
55+
56+
* id
57+
58+
59+
60+
61+
62+
### get
63+
64+
Get the PrimeHub Application
65+
66+
67+
```
68+
primehub apps get <id>
69+
```
70+
71+
* id
72+
73+
74+
75+
76+
77+
### list
78+
79+
List PrimeHub Applications
80+
81+
82+
```
83+
primehub apps list
84+
```
85+
86+
87+
88+
89+
90+
### logs
91+
92+
Get logs of the PrimeHub Application by id
93+
94+
95+
```
96+
primehub apps logs <id>
97+
```
98+
99+
* id: The job id
100+
101+
102+
* *(optional)* follow: Wait for additional logs to be appended
103+
104+
* *(optional)* tail: Show last n lines
105+
106+
107+
108+
109+
### start
110+
111+
Start the PrimeHub Application
112+
113+
114+
```
115+
primehub apps start <id>
116+
```
117+
118+
* id
119+
120+
121+
122+
123+
124+
### stop
125+
126+
Stop the PrimeHub Application
127+
128+
129+
```
130+
primehub apps stop <id>
131+
```
132+
133+
* id
134+
135+
136+
137+
138+
139+
140+
## Examples
141+
142+
The `create` action helps you to install a new PrimeHub application. It shows an example that can be used to create
143+
a `code-server` application:
144+
145+
```
146+
$ primehub apps create
147+
PrimeHub application configuration is required.
148+
149+
Example:
150+
{
151+
"templateId": "code-server",
152+
"id": "code-server-26fcc",
153+
"displayName": "my-code-server-26fcc",
154+
"env": [
155+
{
156+
"name": "key1",
157+
"value": "value1"
158+
}
159+
],
160+
"instanceType": "cpu-1",
161+
"scope": "primehub"
162+
}
163+
164+
* the scope field could be one of the ['public', 'primehub', 'group']
165+
```
166+
167+
It follows our convention accepting a STDIN or with a real file by `--file` optional:
168+
169+
```
170+
$ primehub apps create <<EOF
171+
{
172+
"templateId": "code-server",
173+
"id": "code-server-26fcc",
174+
"displayName": "my-code-server-26fcc",
175+
"env": [
176+
{
177+
"name": "key1",
178+
"value": "value1"
179+
}
180+
],
181+
"instanceType": "cpu-1",
182+
"scope": "primehub"
183+
}
184+
EOF
185+
```
186+
187+
After the application created, it could be found at list:
188+
189+
```
190+
$ primehub apps list
191+
id: code-server-26fcc
192+
displayName: my-code-server-26fcc
193+
appVersion: v3.9.2
194+
appName: code-server
195+
appDefaultEnv: None
196+
appTemplate:
197+
name: Code Server
198+
docLink: https://github.com/cdr/code-server
199+
description: Run VS Code on any machine anywhere and access it in the browser.
200+
groupName: phusers
201+
instanceType: cpu-1
202+
instanceTypeSpec:
203+
name: cpu-1
204+
displayName: CPU 1 XD
205+
cpuLimit: 1
206+
memoryLimit: 2
207+
gpuLimit: 0
208+
scope: primehub
209+
appUrl: http://primehub-python-sdk.primehub.io/console/apps/code-server-26fcc
210+
internalAppUrl: http://app-code-server-26fcc:8080/console/apps/code-server-26fcc
211+
svcEndpoints: ['app-code-server-26fcc:8080']
212+
env: [{'name': 'key1', 'value': 'value1'}]
213+
stop: False
214+
status: Ready
215+
message: Deployment is ready
216+
pods: [{'logEndpoint': 'http://primehub-python-sdk.primehub.io/api/logs/pods/app-code-server-26fcc-765bf579c5-srcft'}]
217+
```

docs/CLI/apptemplates.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
2+
# Primehub Apptemplates
3+
4+
```
5+
Usage:
6+
primehub apptemplates <command>
7+
8+
Get PhAppTemplates
9+
10+
Available Commands:
11+
get Get a PhApp template
12+
list List PhApp templates
13+
14+
Options:
15+
-h, --help Show the help
16+
17+
Global Options:
18+
--config CONFIG Change the path of the config file (Default: ~/.primehub/config.json)
19+
--endpoint ENDPOINT Override the GraphQL API endpoint
20+
--token TOKEN Override the API Token
21+
--group GROUP Override the current group
22+
--json Output the json format (output human-friendly format by default)
23+
24+
```
25+
26+
27+
### get
28+
29+
Get a PhApp template
30+
31+
32+
```
33+
primehub apptemplates get <id>
34+
```
35+
36+
* id
37+
38+
39+
40+
41+
42+
### list
43+
44+
List PhApp templates
45+
46+
47+
```
48+
primehub apptemplates list
49+
```
50+
51+
52+
53+
54+
55+
56+
## Examples
57+
58+
The `list` action will show you each template that is registered to the PrimeHub
59+
60+
```
61+
primehub apptemplates list
62+
```
63+
64+
```
65+
id: code-server
66+
name: Code Server
67+
version: v3.9.2
68+
description: Run VS Code on any machine anywhere and access it in the browser.
69+
docLink: https://github.com/cdr/code-server
70+
image: codercom/code-server:3.9.2
71+
72+
id: label-studio
73+
name: Label Studio
74+
version: 1.1.0
75+
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.
76+
docLink: https://labelstud.io/guide/
77+
image: heartexlabs/label-studio:1.1.0
78+
79+
id: matlab
80+
name: Matlab
81+
version: r2020b
82+
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.
83+
docLink: https://ngc.nvidia.com/catalog/containers/partners:matlab/tags
84+
image: nvcr.io/partners/matlab:r2020b
85+
86+
id: mlflow
87+
name: MLflow
88+
version: v1.9.1
89+
description: MLflow is an open source platform to manage the ML lifecycle, including experimentation, reproducibility, deployment, and a central model registry.
90+
docLink: https://www.mlflow.org/docs/1.9.1/index.html
91+
image: larribas/mlflow:1.9.1
92+
93+
id: streamlit
94+
name: Streamlit
95+
version: v0.79.0
96+
description: Streamlit turns data scripts into shareable web apps in minutes. All in Python. All for free. No front‑end experience required.
97+
docLink: https://docs.primehub.io/docs/primehub-app-builtin-streamlit
98+
image: infuseai/streamlit:v0.79.0
99+
```
100+
101+
You could get one of them with `get` action and the id of a template:
102+
103+
```
104+
primehub apptemplates get code-server
105+
```
106+
107+
108+
```
109+
id: code-server
110+
name: Code Server
111+
version: v3.9.2
112+
description: Run VS Code on any machine anywhere and access it in the browser.
113+
docLink: https://github.com/cdr/code-server
114+
image: codercom/code-server:3.9.2
115+
```

docs/CLI/deployments.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ stop: False
284284
endpointAccessType: public
285285
endpointClients: []
286286
status: Deployed
287-
endpoint: https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
287+
endpoint: http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
288288
availableReplicas: 1
289289
message: Deployment is deployed and available now
290290
pods: [{'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-8qgvf'}]
@@ -324,7 +324,7 @@ primehub deployments get quickstart-iris-cfmnh --json | jq
324324
"endpointAccessType": "public",
325325
"endpointClients": [],
326326
"status": "Deployed",
327-
"endpoint": "https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions",
327+
"endpoint": "http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions",
328328
"availableReplicas": 1,
329329
"message": "Deployment is deployed and available now",
330330
"pods": [
@@ -360,8 +360,8 @@ stop: False
360360
endpointAccessType: public
361361
endpointClients: []
362362
status: Deploying
363-
endpoint: https://qty0712-microk8s.aws.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
363+
endpoint: http://primehub-python-sdk.primehub.io/deployment/quickstart-iris-cfmnh/api/v1.0/predictions
364364
availableReplicas: 1
365365
message: Deployment is being deployed and not available now
366366
pods: [{'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-8qgvf'}, {'name': 'deploy-quickstart-iris-cfmnh-68889b97cc-wxzs8'}]
367-
```
367+
```

0 commit comments

Comments
 (0)