File size: 6,087 Bytes
76d9c4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
---
title: Workspace
version: EN
---

### read_workspace
```python
vessl.read_workspace(
   workspace_id: int, **kwargs
)
```
Read workspace in the default organization. If you want to override the
default organization, then pass `organization_name` as `**kwargs`.

**Args**
* `workspace_id` (int) : Workspace ID.

**Example**
```python
vessl.read_workspace(
    workspace_id=123456,
)
```

----

## list_workspaces
```python
vessl.list_workspaces(
   cluster_id: int = None, statuses: List[str] = None, mine: bool = True, **kwargs
)
```
List workspaces in the default organization. If you want to override the
default organization, then pass `organization_name` as `**kwargs`.

**Args**
* `cluster_id` (int) : Defaults to None.
* `statuses` (List[str]) : A list of status filter. Defaults to None.
* `mine` (bool) : True if list only my workspaces, False otherwise. Defaults
    to True.

**Example**
```python
vessl.list_workspaces(
    cluster_id=123456,
    statuses=["running"],
)
```

----

## create_workspace
```python
vessl.create_workspace(
   name: str, cluster_name: str, cluster_node_names: List[str] = None,
   kernel_resource_spec_name: str = None, processor_type: str = None,
   cpu_limit: float = None, memory_limit: str = None, gpu_type: str = None,
   gpu_limit: int = None, kernel_image_url: str = None, max_hours: int = 24,
   dataset_mounts: List[str] = None, local_files: List[str] = None,
   use_vesslignore: bool = True, root_volume_size: str = '100Gi', ports: List[Dict[str,
   Any]] = None, init_script: str = None, **kwargs
)
```
Create workspace in the default organization. If you want to override the
default organization, then pass `organization_name` as `**kwargs`.

**Args**
* `name` (str) : Workspace name.
* `cluster_name` (str) : Cluster name(must be specified before other options).
* `cluster_node_names` (List[str]) : A list of candidate cluster node names.
    Defaults to None.
* `kernel_resource_spec_name` (str) :  Resource type to run an experiment (for
    managed cluster only). Defaults to None.
* `cpu_limit` (float) : Number of vCPUs (for custom cluster only). Defaults to
    None.
* `memory_limit` (str) : Memory limit in GiB (for custom cluster only).
    Defaults to None.
* `gpu_type` (str) : GPU type (for custom cluster only). Defaults to None.
* `gpu_limit` (int) : Number of GPU cores (for custom cluster only). Defaults
    to None.
* `kernel_image_url` (str) : Kernel docker image URL. Defaults to None.
* `max_hours` (int) : Max hours limit to run. Defaults to 24.
* `dataset_mounts` (List[str]) : A list of dataset mounts. Defaults to None.
* `local_files` (List[str]) : A list of local file mounts. Defaults to None.
* `use_vesslignore` (bool) : True if local files matching glob patterns
    in .vesslignore files should be ignored. Patterns apply relative to
    the directory containing that .vesslignore file.
* `root_volume_size` (str) : Root volume size. Defaults to "100Gi".
* `ports` (List[Dict[str, Any]]) : Port numbers to expose. Defaults to None.
processor_type(str) cpu or gpu (for custom cluster only). Defaults to
    None.
init_script(str) Custom init script. Defaults to None.

**Example**
```python
vessl.create_workspace(
    name="modern-kick",
    cluster_name="aws-apne2",
    kernel_resource_spec_name="v1.cpu-0.mem-1",
    kernel_image_url="public.ecr.aws/vessl/kernels:py36.full-cpu.jupyter",
)
```

----

## list_workspace_logs
```python
vessl.list_workspace_logs(
   workspace_id: int, tail: int = 200, **kwargs
)
```
List experiment logs in the default organization. If you want to override
the default organization, then pass `organization_name` as `**kwargs`.

**Args**
* `workspace_id` (int) : Workspace ID.
* `tail` (int) : The number of lines to display from the end. Display all if
    -1. Defaults to 200.

**Example**
```python
 vessl.list_workspace_logs(
    workspace_id=123456,
 )
```

----

## start_workspace
```python
vessl.start_workspace(
   workspace_id: int, **kwargs
)
```
Start the workspace container in the default organization. If you want to
override the default organization, then pass `organization_name` as
`**kwargs`.

**Args**
* `workspace_id` (int) : Workspace ID.

**Example**
```python
vessl.start_workspace(
    workspace_id=123456,
)
```

----

## stop_workspace
```python
vessl.stop_workspace(
   workspace_id: int, **kwargs
)
```
Stop the workspace container in the default organization. If you want to
override the default organization, then pass `organization_name` as
`**kwargs`.

**Args**
* `workspace_id` (int) : Workspace ID.

**Example**
```python
vessl.stop_workspace(
    workspace_id=123456,
)
```

----

## terminate_workspace
```python
vessl.terminate_workspace(
   workspace_id: int, **kwargs
)
```
Terminate the workspace container in the default organization. If you
want to override the default organization, then pass `organization_name` as
`**kwargs`.

**Args**
* `workspace_id` (int) : Workspace ID.

**Example**
```python
vessl.terminate_workspace(
    workspace_id=123456,
)
```

----

## backup_workspace
```python
vessl.backup_workspace()
```
Backup the home directory of the workspace. This command should be called
inside a workspace.

**Example**
```python
vessl.backup_workspace()
```

----

## restore_workspace
```python
vessl.restore_workspace()
```
Restore the home directory from the previous backup. This command should
be called inside a workspace.

**Example**
```python
vessl.restore_workspace()
```

----

## connect_workspace_ssh
```python
vessl.connect_workspace_ssh(
   private_key_path: str
)
```
Connect to a running workspace via SSH.

**Args**
* `private_key_path` (str) : SSH private key path

**Example**
```python
vessl.connect_workspace_ssh(
    private_key_path="~/.ssh/key_path",
)
```

----

## update_vscode_remote_ssh
```python
vessl.update_vscode_remote_ssh(
   private_key_path: str
)
```
Update .ssh/config file for VSCode Remote-SSH plugin.

**Args**
* `private_key_path` (str) : SSH private key path

**Example**
```python
vessl.update_vscode_remote_ssh(
    private_key_path="~/.ssh/key_path",
)
```