So I might have pulled your code apart, but anyway I found what I believe is a bug. What happens, if the task is returned with a <GENERATED> tag without dep? I presume that would make sense for the first task, as it doesn't rely on anything?
Anyways - I think a simple regex could do:
def fix_dep(tasks):
for task in tasks:
args = task["args"]
task["dep"] = []
for k, v in args.items():
if re.match(r'<GENERATED>.+', v): # Do nothing if there is no dependency
dep_task_id = int(v.split("-")[1])
if dep_task_id not in task["dep"]:
task["dep"].append(dep_task_id)
if len(task["dep"]) == 0:
task["dep"] = [-1]
return tasks
So I might have pulled your code apart, but anyway I found what I believe is a bug. What happens, if the task is returned with a
<GENERATED>
tag without dep? I presume that would make sense for the first task, as it doesn't rely on anything?Anyways - I think a simple regex could do:
https://github.com/microsoft/JARVIS/blob/8d925aa33ff058375d1c891fffc63a65150d5009/server/awesome_chat.py#L245