Skip to content

Commit 89fb947

Browse files
why is this 1
1 parent b73776c commit 89fb947

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

pioreactorui/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ def export_datasets() -> ResponseReturnValue:
11061106
publish_to_error_log(msg, "export_datasets")
11071107
return {"result": status, "filename": None, "msg": msg}, 500
11081108

1109-
if not status:
1109+
if status == b"false":
11101110
publish_to_error_log(msg, "export_datasets")
11111111
return {"result": status, "filename": None, "msg": msg}, 500
11121112

@@ -1740,15 +1740,15 @@ def setup_worker_pioreactor() -> ResponseReturnValue:
17401740
return {"msg": str(e)}, 500
17411741

17421742
try:
1743-
status, msg = result(blocking=True, timeout=250)
1743+
status = result(blocking=True, timeout=250)
17441744
except HueyException:
1745-
status, msg = False, "Timed out, see logs."
1745+
status = False
17461746
publish_to_log(status, "setup_worker_pioreactor")
1747+
publish_to_log(str(bool(status)), "setup_worker_pioreactor")
17471748
if status:
17481749
return {"msg": f"Worker {new_name} added successfully."}, 200
17491750
else:
1750-
publish_to_error_log(msg, "setup_worker_pioreactor")
1751-
return {"msg": msg}, 500
1751+
return {"msg": f"Failed to add worker {new_name}"}, 500
17521752

17531753

17541754
@api.route("/workers", methods=["PUT"])

pioreactorui/tasks.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,14 @@ def pio_run(*args: str, env: dict[str, str] = {}) -> bool:
8484

8585

8686
@huey.task()
87-
def add_new_pioreactor(new_pioreactor_name: str, version: str, model: str) -> tuple[bool, str]:
87+
def add_new_pioreactor(new_pioreactor_name: str, version: str, model: str) -> bool:
8888
logger.info(f"Adding new pioreactor {new_pioreactor_name}, {model} {version}")
8989
result = run(
9090
[PIO_EXECUTABLE, "workers", "add", new_pioreactor_name, "-v", version, "-m", model],
91-
capture_output=True,
92-
text=True,
9391
)
9492
cache.evict("config")
9593
logger.info(result.returncode)
96-
if result.returncode != 0:
97-
return False, str(result.stderr.strip())
98-
else:
99-
return True, str(result.stderr.strip())
94+
return result.returncode == 0
10095

10196

10297
@huey.task()

0 commit comments

Comments
 (0)