|
@@ -420,19 +420,22 @@ class ModelverseInterface(AtomicDEVS):
|
|
|
self.state.blocked = True
|
|
|
self.state.task_to_spawner[task_name] = None
|
|
|
# NOTE We now know that there is something to do on an other task, so we just wait for that event to come in
|
|
|
- self.state.operations.insert(0, [])
|
|
|
- self.state.operations.insert(0, [])
|
|
|
- self.state.operations.insert(0, [])
|
|
|
+ print("Adding 3 empty lists")
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
elif prev_output.startswith("Finished task: "):
|
|
|
self.state.blocked = True
|
|
|
elif " : " in prev_output:
|
|
|
task_name, _ = prev_output.split(" : ", 1)
|
|
|
+ print("Got new task to monitor: " + task_name)
|
|
|
+ print("Adding 3 empty lists")
|
|
|
self.state.blocked = True
|
|
|
self.state.task_to_spawner[task_name] = None
|
|
|
# NOTE We now know that there is something to do on an other task, so we just wait for that event to come in
|
|
|
- self.state.operations.insert(0, [])
|
|
|
- self.state.operations.insert(0, [])
|
|
|
- self.state.operations.insert(0, [])
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
+ self.state.operations.insert(0, None)
|
|
|
else:
|
|
|
print("UNKNOWN: " + str(prev_output))
|
|
|
|
|
@@ -442,22 +445,23 @@ class ModelverseInterface(AtomicDEVS):
|
|
|
if inp[0] in self.state.send_operations:
|
|
|
self.state.send_operations[inp[0]].pop(0)
|
|
|
|
|
|
- if inp[1].startswith("Please edit this model before sending next input: "):
|
|
|
- _, model_name = inp[1].split("Please edit this model before sending next input: ", 1)
|
|
|
- new_taskname = str(uuid.uuid4())
|
|
|
- self.state.send_operations[new_taskname] = [[], ["admin"], ["admin"], ["quiet"], ["model_modify", model_name, ""]] + self.state.keyed_operations.get(self.state.task_to_operation[inp[0]], []) + [["exit"]]
|
|
|
- print("Modifying model " + str(model_name))
|
|
|
- print("On taskname " + str(new_taskname))
|
|
|
- self.state.create_additional_task.append(new_taskname)
|
|
|
- self.state.task_to_spawner[new_taskname] = inp[0]
|
|
|
- elif inp[1].startswith("Please perform manual operation "):
|
|
|
- _, op_name = inp[1].split("Please perform manual operation ", 1)
|
|
|
- self.state.task_to_operation[inp[0]] = op_name[1:-1]
|
|
|
-
|
|
|
- if not self.state.send_operations[inp[0]]:
|
|
|
- del self.state.send_operations[inp[0]]
|
|
|
-
|
|
|
- # At the end of these operations, so finish up!
|
|
|
+ if inp[1].startswith("Please edit this model before sending next input: "):
|
|
|
+ _, model_name = inp[1].split("Please edit this model before sending next input: ", 1)
|
|
|
+ new_taskname = str(uuid.uuid4())
|
|
|
+ self.state.send_operations[new_taskname] = [[], ["admin"], ["admin"], ["quiet"], ["model_modify", model_name, ""]] + self.state.keyed_operations.get(self.state.task_to_operation[inp[0]], []) + [["exit"]]
|
|
|
+ print("Modifying model " + str(model_name))
|
|
|
+ print("On taskname " + str(new_taskname))
|
|
|
+ self.state.create_additional_task.append(new_taskname)
|
|
|
+ self.state.task_to_spawner[new_taskname] = inp[0]
|
|
|
+ elif inp[1].startswith("Please perform manual operation "):
|
|
|
+ _, op_name = inp[1].split("Please perform manual operation ", 1)
|
|
|
+ self.state.task_to_operation[inp[0]] = op_name[1:-1]
|
|
|
+
|
|
|
+ if inp[0] in self.state.send_operations and not self.state.send_operations[inp[0]]:
|
|
|
+ del self.state.send_operations[inp[0]]
|
|
|
+
|
|
|
+ # At the end of these operations, so finish up!
|
|
|
+ if inp[0] in self.state.task_to_spawner:
|
|
|
if self.state.task_to_spawner[inp[0]] is not None:
|
|
|
self.state.keyed_operations.pop(self.state.task_to_operation[self.state.task_to_spawner[inp[0]]], None)
|
|
|
self.state.additional_operations.insert(0, [])
|
|
@@ -482,7 +486,7 @@ class ModelverseInterface(AtomicDEVS):
|
|
|
return {self.to_mvk: outp}
|
|
|
else:
|
|
|
return {}
|
|
|
- elif self.state.operations:
|
|
|
+ elif self.state.operations and self.state.operations[0] is not None:
|
|
|
print("REQUEST: " + str(self.state.operations[0]))
|
|
|
return {self.to_mvk: [(self.taskname, self.state.operations[0])]}
|
|
|
else:
|