Skip to content

Commit

Permalink
Merge pull request #1209 from SpiNNakerManchester/fix_bmp_issue
Browse files Browse the repository at this point in the history
Allow starting with faulty BMPs
  • Loading branch information
Christian-B authored Nov 13, 2024
2 parents 0d5fba9 + 4ab69dc commit 68a25eb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ private List<Worker> makeWorkers() {
r.getString("address"));
return null;
}, bmpId);
var control = controllerFactory.create(m.get(), coords, boards);
var worker = new Worker(control, bmpId);
var worker = new Worker(m.get(), coords, boards, bmpId);
workers.put(row.getInt("bmp_id"), worker);
return worker;
}));
Expand Down Expand Up @@ -1054,18 +1053,39 @@ boolean isSameJob(PowerChange p) {
/** A worker of a given BMP. */
private final class Worker implements Runnable {
/** What are we controlling? */
private final SpiNNakerControl control;
private SpiNNakerControl control;

private final SpallocAPI.Machine machine;

private final BMPCoords coords;

private final Map<BMPBoard, String> boards;

/** Which boards are we looking at? */
private final int bmpId;

Worker(SpiNNakerControl control, int bmpId) {
this.control = control;
Worker(SpallocAPI.Machine machine, BMPCoords coords,
Map<BMPBoard, String> boards, int bmpId) {
this.machine = machine;
this.coords = coords;
this.boards = boards;
this.bmpId = bmpId;

log.debug("Created worker for boards {}", bmpId);
}

private SpiNNakerControl getControl() {
if (control == null) {
try {
control = controllerFactory.create(machine, coords, boards);
} catch (Exception e) {
log.error("Could not create control for BMP '{}'",
bmpId, e);
}
}
return control;
}

/**
* Periodically call to update, or trigger externally.
*/
Expand All @@ -1076,7 +1096,7 @@ public synchronized void run() {
try {
var changes = getRequestedOperations();
for (var change : changes) {
change.processRequest(control);
change.processRequest(getControl());
}
} catch (Exception e) {
log.error("unhandled exception for BMP '{}'", bmpId, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private Constants() {
public static final double BMP_POWER_ON_TIMEOUT = 10.0;

/** Timeout for other BMP commands to reply (in seconds). */
public static final double BMP_TIMEOUT = 0.75;
public static final double BMP_TIMEOUT = 2.0;

/** Time to sleep after powering on boards (in seconds). */
public static final double BMP_POST_POWER_ON_SLEEP_TIME = 5.0;
Expand Down

0 comments on commit 68a25eb

Please sign in to comment.