From f2dd1ffc349fc5868005e7e97e2d5ba9009986f1 Mon Sep 17 00:00:00 2001 From: stroblme Date: Wed, 26 Aug 2026 21:46:14 +0200 Subject: [PATCH] Show resources on the example's training node The example's `fit` is what a real training node looks like, so it is where `resources={"cpus": 2}` belongs -- beside the `device="gpu"` it already carries, since the two answer different questions about the same node. Co-Authored-By: Claude Opus 5 (1M context) --- examples/myresearch/train.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/myresearch/train.py b/examples/myresearch/train.py index 22499b2..ddcdf7b 100644 --- a/examples/myresearch/train.py +++ b/examples/myresearch/train.py @@ -19,6 +19,7 @@ from fluksio import Port, node device="gpu", device_policy="prefer", timeout=600, + resources={"cpus": 2}, ) def fit(dataset, lr, epochs=25): """Train, reporting the loss as it goes. @@ -28,6 +29,12 @@ def fit(dataset, lr, epochs=25): why there is no `log_metric()` to call. `device="gpu"` with `device_policy="prefer"` sends this to a worker carrying that label when one is attached, and runs it here when none is. + + `resources` is what a real training node needs and the rest of a flow does + not: two cores held for the length of the call, and a worker started with + thread limits saying so — otherwise a numerical library sizes itself to + every core on the machine, and a sweep of these starves the engine. A GPU + one would say `{"gpus": 1}` and hold the card exclusively. """ rows = json.loads(open(fluksio.load_artifact(dataset)).read())["rows"] loss = 1.0