feat(FN-4813): complete Step 5 — add isolation transition runtime restart path
Fusion-Task-Id: FN-4813 Fusion-Task-Lineage: 846893a5-2afa-4817-8f64-8c444d2fd713
This commit is contained in:
committed by
gsxdsm
parent
2ca18e983a
commit
63adddadf9
@@ -999,64 +999,58 @@ export class Scheduler {
|
||||
this.wasNodeDispatchValidationBlocked.delete(task.id);
|
||||
}
|
||||
|
||||
// Enforce unavailable-node policy
|
||||
// Enforce unavailable-node policy + owning-node handoff policy
|
||||
if (effectiveNode.nodeId !== undefined && this.options.nodeHealthMonitor) {
|
||||
let skipUnavailableNodePolicy = false;
|
||||
|
||||
if (freshTask.checkoutNodeId) {
|
||||
if (freshTask.checkoutNodeId && freshTask.checkedOutBy) {
|
||||
const ownerNodeHealth = this.options.nodeHealthMonitor.getNodeHealth(freshTask.checkoutNodeId);
|
||||
if (ownerNodeHealth === "offline" || ownerNodeHealth === "error") {
|
||||
const handoffDecision = decideOwningNodeHandoff({
|
||||
task: freshTask,
|
||||
ownerNodeId: freshTask.checkoutNodeId,
|
||||
ownerNodeHealth,
|
||||
localNodeId: settings.defaultNodeId ?? "local",
|
||||
localNodeId: "local",
|
||||
handoffPolicy: settings.owningNodeHandoffPolicy,
|
||||
});
|
||||
|
||||
if (handoffDecision.action === "park") {
|
||||
if (!this.wasNodeBlocked.has(task.id)) {
|
||||
this.wasNodeBlocked.add(task.id);
|
||||
schedulerLog.log(`Task ${task.id} dispatch blocked — ${handoffDecision.reason}`);
|
||||
await this.store.logEntry(task.id, handoffDecision.reason);
|
||||
const reason = `Owning-node handoff parked dispatch: ${handoffDecision.reason}`;
|
||||
schedulerLog.log(`Task ${task.id} dispatch blocked — ${reason}`);
|
||||
await this.store.logEntry(task.id, reason);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
await this.store.logEntry(task.id, `Owning-node handoff applied: ${handoffDecision.reason}`);
|
||||
if (handoffDecision.action === "reassign-local") {
|
||||
effectiveNode = { nodeId: undefined, source: "local" };
|
||||
await this.store.logEntry(task.id, `Owner handoff: ${handoffDecision.reason}`);
|
||||
} else if (handoffDecision.action === "reassign-any") {
|
||||
skipUnavailableNodePolicy = true;
|
||||
await this.store.logEntry(task.id, `Owner handoff: ${handoffDecision.reason}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipUnavailableNodePolicy) {
|
||||
const nodeHealth = this.options.nodeHealthMonitor.getNodeHealth(effectiveNode.nodeId);
|
||||
const decision = applyUnavailableNodePolicy({
|
||||
effectiveNode,
|
||||
nodeHealth,
|
||||
policy: settings.unavailableNodePolicy,
|
||||
});
|
||||
const nodeHealth = this.options.nodeHealthMonitor.getNodeHealth(effectiveNode.nodeId);
|
||||
const decision = applyUnavailableNodePolicy({
|
||||
effectiveNode,
|
||||
nodeHealth,
|
||||
policy: settings.unavailableNodePolicy,
|
||||
});
|
||||
|
||||
if (!decision.allowed) {
|
||||
if (!this.wasNodeBlocked.has(task.id)) {
|
||||
this.wasNodeBlocked.add(task.id);
|
||||
schedulerLog.log(`Task ${task.id} dispatch blocked — ${decision.reason}`);
|
||||
await this.store.logEntry(task.id, decision.reason);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
this.wasNodeBlocked.delete(task.id);
|
||||
|
||||
if (decision.fallbackToLocal) {
|
||||
schedulerLog.log(`Task ${task.id} falling back to local — ${decision.reason}`);
|
||||
if (!decision.allowed) {
|
||||
if (!this.wasNodeBlocked.has(task.id)) {
|
||||
this.wasNodeBlocked.add(task.id);
|
||||
schedulerLog.log(`Task ${task.id} dispatch blocked — ${decision.reason}`);
|
||||
await this.store.logEntry(task.id, decision.reason);
|
||||
effectiveNode = { nodeId: undefined, source: "local" };
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
this.wasNodeBlocked.delete(task.id);
|
||||
|
||||
if (decision.fallbackToLocal) {
|
||||
schedulerLog.log(`Task ${task.id} falling back to local — ${decision.reason}`);
|
||||
await this.store.logEntry(task.id, decision.reason);
|
||||
effectiveNode = { nodeId: undefined, source: "local" };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user