bulltrackers-module 1.0.307 → 1.0.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FILENAME: computation-system/WorkflowOrchestrator.js
|
|
3
|
-
* UPDATED:
|
|
3
|
+
* UPDATED: Added missing groupByPass export.
|
|
4
4
|
* Includes Content-Based Short-Circuiting for both Upstream and Historical dependencies.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -13,6 +13,19 @@ const { MetaExecutor } = require('./executor
|
|
|
13
13
|
|
|
14
14
|
const STATUS_IMPOSSIBLE_PREFIX = 'IMPOSSIBLE';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* [FIX] Groups manifest entries by their pass number.
|
|
18
|
+
* Required by the Dispatcher to identify current work-sets.
|
|
19
|
+
*/
|
|
20
|
+
function groupByPass(manifest) {
|
|
21
|
+
const passes = {};
|
|
22
|
+
manifest.forEach(calc => {
|
|
23
|
+
if (!passes[calc.pass]) passes[calc.pass] = [];
|
|
24
|
+
passes[calc.pass].push(calc);
|
|
25
|
+
});
|
|
26
|
+
return passes;
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
/**
|
|
17
30
|
* [NEW] Core Short-Circuit Logic.
|
|
18
31
|
* Checks if a dependency (either a different node or "yesterday's self") is satisfied.
|
|
@@ -76,6 +89,7 @@ function analyzeDateExecution(dateStr, calcsInPass, rootDataStatus, dailyStatus,
|
|
|
76
89
|
const yesterday = new Date(dateStr + 'T00:00:00Z');
|
|
77
90
|
yesterday.setUTCDate(yesterday.getUTCDate() - 1);
|
|
78
91
|
|
|
92
|
+
// Only block if yesterday is a valid data date.
|
|
79
93
|
if (yesterday >= DEFINITIVE_EARLIEST_DATES.absoluteEarliest) {
|
|
80
94
|
const check = isDependencyReady(calc.name, true, null, prevDailyStatus, manifestMap, stored);
|
|
81
95
|
if (!check.ready) isBlockedByHistory = true;
|
|
@@ -148,4 +162,4 @@ async function executeDispatchTask(dateStr, pass, targetComputation, config, dep
|
|
|
148
162
|
return { date: dateStr, updates };
|
|
149
163
|
}
|
|
150
164
|
|
|
151
|
-
module.exports = { executeDispatchTask, analyzeDateExecution };
|
|
165
|
+
module.exports = { executeDispatchTask, analyzeDateExecution, groupByPass };
|
|
@@ -48,7 +48,7 @@ async function handleComputationTask(message, config, dependencies) {
|
|
|
48
48
|
|
|
49
49
|
logger.log('INFO', `[Worker] 📥 Task: ${computation} (${date}) [Tier: ${resourceTier}]`);
|
|
50
50
|
|
|
51
|
-
// 1. Audit Lease
|
|
51
|
+
// 1. Audit Lease (Lease on life for the monitor to see)
|
|
52
52
|
await db.doc(ledgerPath).set({
|
|
53
53
|
status: 'IN_PROGRESS',
|
|
54
54
|
workerId: process.env.K_REVISION || os.hostname(),
|
|
@@ -84,6 +84,7 @@ async function handleComputationTask(message, config, dependencies) {
|
|
|
84
84
|
composition: calcUpdate.composition
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
// Mark ledger as completed
|
|
87
88
|
await db.doc(ledgerPath).update({ status: 'COMPLETED', completedAt: new Date() });
|
|
88
89
|
await recordRunAttempt(db, { date, computation, pass }, 'SUCCESS', null, metrics, triggerReason, resourceTier);
|
|
89
90
|
|
|
@@ -94,9 +95,9 @@ async function handleComputationTask(message, config, dependencies) {
|
|
|
94
95
|
if (isDeterministic || (message.deliveryAttempt || 1) >= MAX_RETRIES) {
|
|
95
96
|
await db.doc(ledgerPath).set({ status: 'FAILED', error: err.message, failedAt: new Date() }, { merge: true });
|
|
96
97
|
await recordRunAttempt(db, { date, computation, pass }, 'FAILURE', { message: err.message, stage: err.stage || 'FATAL' }, { peakMemoryMB: heartbeat.getPeak() }, triggerReason, resourceTier);
|
|
97
|
-
return; //
|
|
98
|
+
return; // Exit without throwing to prevent endless Pub/Sub retries for dead logic
|
|
98
99
|
}
|
|
99
|
-
throw err; // Trigger Pub/Sub retry
|
|
100
|
+
throw err; // Trigger Pub/Sub retry for non-deterministic transient errors
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|