outerbounds 0.3.52rc4__py3-none-any.whl → 0.3.52rc5__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- outerbounds/command_groups/workstations_cli.py +32 -12
- outerbounds/utils/schema.py +1 -1
- {outerbounds-0.3.52rc4.dist-info → outerbounds-0.3.52rc5.dist-info}/METADATA +1 -1
- {outerbounds-0.3.52rc4.dist-info → outerbounds-0.3.52rc5.dist-info}/RECORD +6 -6
- {outerbounds-0.3.52rc4.dist-info → outerbounds-0.3.52rc5.dist-info}/WHEEL +0 -0
- {outerbounds-0.3.52rc4.dist-info → outerbounds-0.3.52rc5.dist-info}/entry_points.txt +0 -0
@@ -196,11 +196,25 @@ def configure_cloud_workstation(config_dir=None, profile=None, binary=None, outp
|
|
196
196
|
default="",
|
197
197
|
help="The named metaflow profile in which your workstation exists",
|
198
198
|
)
|
199
|
-
|
199
|
+
@click.option(
|
200
|
+
"-o",
|
201
|
+
"--output",
|
202
|
+
default="json",
|
203
|
+
help="Show output in the specified format.",
|
204
|
+
type=click.Choice(["json"]),
|
205
|
+
)
|
206
|
+
def list_workstations(config_dir=None, profile=None, output="json"):
|
207
|
+
list_response = OuterboundsCommandResponse()
|
208
|
+
list_step = CommandStatus(
|
209
|
+
"listWorkstations",
|
210
|
+
OuterboundsCommandStatus.OK,
|
211
|
+
"Workstation list successfully fetched!",
|
212
|
+
)
|
213
|
+
list_response.add_or_update_data("workstations", [])
|
214
|
+
|
200
215
|
try:
|
201
216
|
if not profile:
|
202
217
|
profile = metaflowconfig.get_metaflow_profile()
|
203
|
-
|
204
218
|
metaflow_token = metaflowconfig.get_metaflow_token_from_config(
|
205
219
|
config_dir, profile
|
206
220
|
)
|
@@ -210,17 +224,23 @@ def list_workstations(config_dir=None, profile=None):
|
|
210
224
|
workstations_response = requests.get(
|
211
225
|
f"{api_url}/v1/workstations", headers={"x-api-key": metaflow_token}
|
212
226
|
)
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
click.
|
219
|
-
"Error: {}".format(json.dumps(workstations_response.json(), indent=4))
|
220
|
-
)
|
227
|
+
workstations_response.raise_for_status()
|
228
|
+
list_response.add_or_update_data(
|
229
|
+
"workstations", workstations_response.json()["workstations"]
|
230
|
+
)
|
231
|
+
if output == "json":
|
232
|
+
click.echo(json.dumps(list_response.as_dict(), indent=4))
|
221
233
|
except Exception as e:
|
222
|
-
|
223
|
-
|
234
|
+
list_step.update(
|
235
|
+
OuterboundsCommandStatus.FAIL, "Failed to list workstations", ""
|
236
|
+
)
|
237
|
+
list_response.add_step(list_step)
|
238
|
+
if output == "json":
|
239
|
+
list_response.add_or_update_data("error", str(e))
|
240
|
+
click.echo(json.dumps(list_response.as_dict(), indent=4))
|
241
|
+
else:
|
242
|
+
click.secho("Failed to list workstations", fg="red", err=True)
|
243
|
+
click.secho("Error: {}".format(str(e)), fg="red", err=True)
|
224
244
|
|
225
245
|
|
226
246
|
@cli.command(help="Hibernate workstation", hidden=True)
|
outerbounds/utils/schema.py
CHANGED
@@ -63,11 +63,11 @@ class OuterboundsCommandResponse:
|
|
63
63
|
self._message = "We found one or more warnings with your installation."
|
64
64
|
|
65
65
|
def as_dict(self):
|
66
|
+
self._data["steps"] = [step.as_dict() for step in self._steps]
|
66
67
|
return {
|
67
68
|
"status": self.status.value,
|
68
69
|
"code": self._code,
|
69
70
|
"message": self._message,
|
70
|
-
"steps": [step.as_dict() for step in self._steps],
|
71
71
|
"metadata": self.metadata,
|
72
72
|
"data": self._data,
|
73
73
|
}
|
@@ -3,12 +3,12 @@ outerbounds/cli_main.py,sha256=e9UMnPysmc7gbrimq2I4KfltggyU7pw59Cn9aEguVcU,74
|
|
3
3
|
outerbounds/command_groups/__init__.py,sha256=QPWtj5wDRTINDxVUL7XPqG3HoxHNvYOg08EnuSZB2Hc,21
|
4
4
|
outerbounds/command_groups/cli.py,sha256=61VsBlPG2ykP_786eCyllqeM8DMhPAOfj2FhktrSd7k,207
|
5
5
|
outerbounds/command_groups/local_setup_cli.py,sha256=fHZJTFJJO49X0_uhAmDwyOMtvOZVlbMxAF9iLs8euwo,40672
|
6
|
-
outerbounds/command_groups/workstations_cli.py,sha256=
|
6
|
+
outerbounds/command_groups/workstations_cli.py,sha256=f3gwHMZPHzeOcGj5VfC5tZZA18JQhFzy2LRGzqAosOk,19286
|
7
7
|
outerbounds/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
outerbounds/utils/kubeconfig.py,sha256=l1mUP1j9VIq3fsffi5bJ1Nk-hYlwd1dIqkpj7DvVS1E,7936
|
9
9
|
outerbounds/utils/metaflowconfig.py,sha256=_Khqzu0KE6X05KkVbb39GXN6CFpG2WRr6Xs35pT2l7A,3299
|
10
|
-
outerbounds/utils/schema.py,sha256=
|
11
|
-
outerbounds-0.3.
|
12
|
-
outerbounds-0.3.
|
13
|
-
outerbounds-0.3.
|
14
|
-
outerbounds-0.3.
|
10
|
+
outerbounds/utils/schema.py,sha256=Ht_Yf5uoKO0m36WXHZLSPmWPH6EFWXfZDQsiAUquc5k,2160
|
11
|
+
outerbounds-0.3.52rc5.dist-info/METADATA,sha256=XUUknKD5TQrXjRRdnGHCiH3G07aZPWdnbeUYs1xyfOo,1367
|
12
|
+
outerbounds-0.3.52rc5.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
13
|
+
outerbounds-0.3.52rc5.dist-info/entry_points.txt,sha256=7ye0281PKlvqxu15rjw60zKg2pMsXI49_A8BmGqIqBw,47
|
14
|
+
outerbounds-0.3.52rc5.dist-info/RECORD,,
|
File without changes
|
File without changes
|