bulltrackers-module 1.0.299 → 1.0.300

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,7 +1,7 @@
1
1
  /**
2
2
  * FILENAME: computation-system/helpers/computation_dispatcher.js
3
3
  * PURPOSE: "Smart Dispatcher" - Analyzes state, initializes Run Counters, and dispatches tasks.
4
- * UPDATED: Added per-date logging to visualize progress during large backfills.
4
+ * UPDATED: FIXED DEADLOCK by separating concurrency limits for Dates vs Tasks.
5
5
  */
6
6
 
7
7
  const { getExpectedDateStrings, getEarliestDataDates, normalizeName, DEFINITIVE_EARLIEST_DATES } = require('../utils/utils.js');
@@ -37,7 +37,7 @@ async function checkCrashForensics(db, date, pass, computationName) {
37
37
  const lastRSS = data.telemetry.lastMemory.rssMB || 0;
38
38
 
39
39
  if (lastRSS > OOM_THRESHOLD_MB) {
40
- console.log(`[Dispatcher] 🕵️‍♀️ Forensics: ${computationName} likely OOM'd at ${lastRSS}MB. Routing to HIGH-MEM.`);
40
+ // console.log(`[Dispatcher] 🕵️‍♀️ Forensics: ${computationName} likely OOM'd at ${lastRSS}MB. Routing to HIGH-MEM.`);
41
41
  return 'high-mem';
42
42
  }
43
43
  }
@@ -104,10 +104,11 @@ async function dispatchComputationPass(config, dependencies, computationManifest
104
104
  const manifestMap = new Map(computationManifest.map(c => [normalizeName(c.name), c]));
105
105
  const tasksToDispatch = [];
106
106
 
107
- // Concurrency limit for analysis & forensics (Parallelize the historical scan)
108
- const limit = pLimit(20);
107
+ // [FIX] Separate concurrency limits to prevent DEADLOCK
108
+ const dateLimit = pLimit(20); // Parallel Days
109
+ const forensicsLimit = pLimit(50); // Parallel Checks per day
109
110
 
110
- const analysisPromises = allExpectedDates.map(d => limit(async () => {
111
+ const analysisPromises = allExpectedDates.map(d => dateLimit(async () => {
111
112
  try {
112
113
  const fetchPromises = [
113
114
  fetchComputationStatus(d, config, dependencies),
@@ -158,8 +159,8 @@ async function dispatchComputationPass(config, dependencies, computationManifest
158
159
 
159
160
  const validToRun = [...report.runnable, ...report.reRuns];
160
161
 
161
- // [NEW] Parallel Forensics Check
162
- await Promise.all(validToRun.map(item => limit(async () => {
162
+ // [FIX] Use separate 'forensicsLimit' here to avoid deadlock with 'dateLimit'
163
+ await Promise.all(validToRun.map(item => forensicsLimit(async () => {
163
164
  const compName = normalizeName(item.name);
164
165
 
165
166
  // 1. Determine Resource Requirements
@@ -181,8 +182,8 @@ async function dispatchComputationPass(config, dependencies, computationManifest
181
182
  });
182
183
  })));
183
184
 
184
- // [UPDATED] Add Heartbeat Log
185
- logger.log('INFO', `[Dispatcher] Analyzed ${d}: ${validToRun.length} tasks identified.`);
185
+ // [PROGRESS LOG] This should now fire correctly
186
+ logger.log('INFO', `[Dispatcher] Analyzed ${d}: ${validToRun.length} tasks (Cumulative: ${tasksToDispatch.length})`);
186
187
 
187
188
  } catch (e) {
188
189
  logger.log('ERROR', `[Dispatcher] Failed analysis for ${d}: ${e.message}`);
@@ -220,7 +221,7 @@ async function dispatchComputationPass(config, dependencies, computationManifest
220
221
 
221
222
  // 3. Create Audit Ledger Entries
222
223
  const finalDispatched = [];
223
- const txnLimit = pLimit(20);
224
+ const txnLimit = pLimit(50); // Increased txn throughput
224
225
 
225
226
  const txnPromises = tasksToDispatch.map(task => txnLimit(async () => {
226
227
  const ledgerRef = db.collection(`computation_audit_ledger/${task.date}/passes/${task.pass}/tasks`).doc(task.computation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulltrackers-module",
3
- "version": "1.0.299",
3
+ "version": "1.0.300",
4
4
  "description": "Helper Functions for Bulltrackers.",
5
5
  "main": "index.js",
6
6
  "files": [