Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions osism/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ def first(iterable, condition=lambda x: True):


def fetch_task_output(
task_id, timeout=os.environ.get("OSISM_TASK_TIMEOUT", 300), enable_play_recap=False
task_id,
timeout=int(os.environ.get("OSISM_TASK_TIMEOUT", 300)),
enable_play_recap=False,
):
r = _init_redis()
rc = 0
Expand Down Expand Up @@ -401,6 +403,7 @@ def fetch_task_output(
elif message_type == "action" and message_content == "quit":
r.close()
return rc
r.close()
raise TimeoutError


Expand All @@ -410,7 +413,7 @@ def push_task_output(task_id, line):

def finish_task_output(task_id, rc=None):
r = _init_redis()
if rc:
if rc is not None:
r.xadd(task_id, {"type": "rc", "content": rc})
r.xadd(task_id, {"type": "action", "content": "quit"})

Expand Down
Loading