Skip to content

Commit 68a2946

Browse files
set broadcast get timeout to higher
1 parent 60070aa commit 68a2946

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Some big changes internally
1212
- adding `/experiments/<exp>` to the end of endpoint `/api/workers/unit1/jobs/settings/job_name/stirring/`
1313
- removed `/api/workers/jobs/stop/experiments/<exp>`, use `/api/workers/$broadcast/jobs/stop/experiments/<exp>` instead.
1414
- removed `/api/experiments/<experiment>/jobs/settings/job_name/<job_name>`, use `/workers/$broadcast/jobs/settings/job_name/<job_name>/experiments/<experiment>`
15-
- external models in .pioreactor/models
15+
- New external models in .pioreactor/models
1616

1717
### 25.7.2
1818

core/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"python-dotenv==1.0.1",
2626
"Werkzeug==3.1.0",
2727
"packaging==24.1",
28-
"pydantic==2.0.0",
28+
"pydantic==2.11.7",
2929
"mcp-utils==1.0.0",
3030
]
3131

requirements/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ python-dotenv==1.0.1
1616
Werkzeug==3.1.0
1717
itsdangerous==2.2.0
1818
blinker==1.9.0
19-
pydantic==2.0.0
19+
pydantic==2.11.7
2020
mcp-utils==1.0.0

web/pioreactorui/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def as_json_response(json: str) -> ResponseReturnValue:
6969
return Response(json, mimetype="application/json")
7070

7171

72-
def broadcast_get_across_cluster(endpoint: str, timeout: float = 1.0, return_raw=False) -> Result:
72+
def broadcast_get_across_cluster(endpoint: str, timeout: float = 5.0, return_raw=False) -> Result:
7373
assert endpoint.startswith("/unit_api")
7474
return tasks.multicast_get_across_cluster(
7575
endpoint=endpoint, workers=get_all_workers(), timeout=timeout, return_raw=return_raw
@@ -1163,7 +1163,7 @@ def uninstall_plugin_across_cluster(pioreactor_unit: str) -> DelayedResponseRetu
11631163

11641164
@api.route("/units/<pioreactor_unit>/capabilities", methods=["GET"])
11651165
@api.route("/workers/<pioreactor_unit>/capabilities", methods=["GET"])
1166-
def get_capabilities(pioreactor_unit) -> ResponseReturnValue:
1166+
def get_capabilities(pioreactor_unit: str) -> ResponseReturnValue:
11671167
if pioreactor_unit == UNIVERSAL_IDENTIFIER:
11681168
return create_task_response(broadcast_get_across_cluster("/unit_api/capabilities"))
11691169
else:

web/pioreactorui/mcp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def get_unit_capabilties(unit: str, condensed: bool = False) -> list:
208208
the job name, automation name (if any), and lists of argument and option names.
209209
"""
210210
caps = get_from_leader(f"/api/units/{unit}/capabilities")
211-
return caps if not condensed else {unit: _condense_capabilities(_caps) for unit, _caps in caps.items()}
211+
return caps if not condensed else {unit_: _condense_capabilities(caps_) for unit_, caps_ in caps.items()}
212212

213213

214214
@mcp.tool()
@@ -266,7 +266,7 @@ def stop_job(experiment: str, job: str | None, unit: str = UNIVERSAL_IDENTIFIER)
266266
"""
267267
if job is None:
268268
return post_into_leader(f"/api/workers/{unit}/jobs/stop/experiments/{experiment}")
269-
elif job is not None:
269+
else:
270270
return post_into_leader(f"/api/workers/{unit}/jobs/stop/job_name/{job}/experiments/{experiment}")
271271

272272

web/pioreactorui/tasks.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pioreactor.logging import create_logger
1919
from pioreactor.mureq import HTTPErrorStatus
2020
from pioreactor.mureq import HTTPException
21+
from pioreactor.mureq import Response
2122
from pioreactor.pubsub import delete_from
2223
from pioreactor.pubsub import get_from
2324
from pioreactor.pubsub import patch_into
@@ -61,16 +62,16 @@
6162
)
6263

6364

64-
def _process_delayed_json_response(worker: str, r: Any) -> tuple[str, Any]:
65+
def _process_delayed_json_response(worker: str, response: Response) -> tuple[str, Any]:
6566
"""
6667
Handle delayed HTTP responses (202 with result_url_path) and immediate 200 responses.
6768
Returns the worker and the appropriate JSON data or result value.
6869
"""
69-
data = r.json()
70-
if r.status_code == 202 and "result_url_path" in data:
70+
data = response.json()
71+
if response.status_code == 202 and "result_url_path" in data:
7172
sleep(0.1)
7273
return _get_from_worker(worker, data["result_url_path"])
73-
if r.status_code == 200:
74+
if response.status_code == 200:
7475
if "task_id" in data:
7576
return worker, data["result"]
7677
else:
@@ -462,7 +463,7 @@ def _get_from_worker(
462463

463464
except (HTTPErrorStatus, HTTPException) as e:
464465
logger.error(
465-
f"Could not get from {worker}'s {address=}/{endpoint=}, sent {json=} and returned {e}. Check connection? Check port?"
466+
f"Could not get from {worker}'s {address=}, {endpoint=}, sent {json=} and returned {e}. Check connection? Check port?"
466467
)
467468
return worker, None
468469
except DecodeError:

0 commit comments

Comments
 (0)