Skip to content

Commit 82d4e67

Browse files
John-Braggrobert-closekennydanielJohn Bragg
authored
Dev 330 (#99)
* INSIGHTS-12 Initial structure of insight functionality * INSIGHTS-12 Added todo statements * INSIGHTS-12 Moved Insights out of client * INSIGHTS-12 Adjusted insight methods to reside in the client class. Removed the ability to collect insights before sending, now the every time the user invokes the collectInsights method, it will also send. This prevents any State issues with the algorithm. * INSIGHTS-12 Added a todo. Tests fail for unknown reasons at this time * INSIGHTS-12 Fixed method call. Added a todo to get url from config if necessary. * INSIGHTS-12 Fixed method call. * INSIGHTS-12 added json serialization. might not be needed * INSIGHTS-12 commented test temporarily * INSIGHTS-12 comment updates and json .encode change * INSIGHTS-12 comment update * INSIGHTS-12 changed method signatures to match documentation https://insights1.enthalpy.click/developers/clients/python#publishing-algorithmia-insights * INSIGHTS-12 Added system property for queue reader url * INSIGHTS-12 Fixed URL to not be https * INSIGHTS-12 minor version update * INSIGHTS-12 revert change * INSIGHTS-12 removed todo * INSIGHTS-12 uncommented test. May start failing again in the pipeline. * INSIGHTS-12 commented test. * INSIGHTS-12 changed version. Removed unused import. * INSIGHTS-12 changed url to include /v1/ * Allow listing of non-data:// files on cli * Allow catting non-data:// files on cli * Fix tests * restructured list_languages method * return error instead of printing for unit test Co-authored-by: robert-close <[email protected]> Co-authored-by: Kenny Daniel <[email protected]> Co-authored-by: Kenny Daniel <[email protected]> Co-authored-by: John Bragg <[email protected]>
1 parent 8fe7046 commit 82d4e67

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Algorithmia/CLI.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,14 @@ def get_environment_by_language(self,language,client):
296296

297297
def list_languages(self, client):
298298
response = client.get_supported_languages()
299-
return response
299+
table = []
300+
if "error" not in response:
301+
table.append("{:<25} {:<35}".format('Name','Description'))
302+
for lang in response:
303+
table.append("{:<25} {:<35}".format(lang['name'],lang['display_name']))
304+
else:
305+
table.append(json.dumps(response))
306+
return table
300307

301308

302309
def getBuildLogs(self, user, algo, client):

Algorithmia/__main__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ def main():
202202

203203
elif args.cmd == 'languages':
204204
response = CLI().list_languages(client)
205-
print("{:<25} {:<35}".format('Name','Description'))
206-
for lang in response:
207-
print("{:<25} {:<35}".format(lang['name'],lang['display_name']))
205+
for line in response:
206+
print(line)
208207

209208
elif args.cmd == 'template':
210209
CLI().get_template(args.envid,args.dest,client)

Test/CLI_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ def test_get_environment(self):
181181

182182
def test_list_languages(self):
183183
result = CLI().list_languages(self.client)
184-
if("error" in result):
184+
if("error" in result[0]):
185185
print(result)
186-
self.assertTrue(result is not None and "name" in result[0])
186+
self.assertTrue(result is not None and "anaconda3" in result[1])
187187

188188

189189
def test_rm(self):

0 commit comments

Comments
 (0)