Browse Source

Updated prompt script for fetching a taskname, instead of inventing one

Yentl Van Tendeloo 3 years ago
parent
commit
777d6063b3
1 changed files with 4 additions and 10 deletions
  1. 4 10
      scripts/prompt.py

+ 4 - 10
scripts/prompt.py

@@ -35,23 +35,17 @@ def remote_print(string):
     print(string)
 
 local_print("Welcome to the local shell!")
+
 try:
     address = sys.argv[1]
 except IndexError:
     address = "http://127.0.0.1:8001"
+
 try:
     taskname = sys.argv[2]
 except IndexError:
-    import random
-    taskname = str(random.random())
-
-# If task doesn't exist yet, we create it
-
-data = urlencode({"op": "set_input", "value": '"%s"' % taskname, "taskname": "task_manager"})
-urlopen(Request(address, data.encode())).read()
-
-
-
+    data = urlencode({"op": "get_output", "taskname": "task_manager"})
+    taskname = json.loads(urlopen(Request(address, data.encode())).read())
 
 local_print("Switching context to Modelverse: all data is piped.")
 local_print("Use command $ to switch to HUTN parsing mode.")