perstack 0.0.65 → 0.0.67

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.
package/dist/bin/cli.js CHANGED
@@ -20,7 +20,7 @@ import { useRun } from '@perstack/react';
20
20
  // package.json
21
21
  var package_default = {
22
22
  name: "perstack",
23
- version: "0.0.65",
23
+ version: "0.0.67",
24
24
  description: "PerStack CLI"};
25
25
  function getEnv(envPath) {
26
26
  const env = Object.fromEntries(
@@ -433,6 +433,13 @@ function getEventContents(jobId, runId, maxStepNumber) {
433
433
  }
434
434
  return events;
435
435
  }
436
+ function getRunIdsByJobId(jobId) {
437
+ const runsDir = path10__default.resolve(getJobDir(jobId), "runs");
438
+ if (!existsSync(runsDir)) {
439
+ return [];
440
+ }
441
+ return readdirSync(runsDir, { withFileTypes: true }).filter((dir) => dir.isDirectory()).map((dir) => dir.name);
442
+ }
436
443
  var FileSystemStorage = class {
437
444
  basePath;
438
445
  constructor(config = {}) {
@@ -1444,9 +1451,6 @@ function getMostRecentRun() {
1444
1451
  }
1445
1452
  return runs[0];
1446
1453
  }
1447
- function getRunsByJobId(jobId) {
1448
- return getAllRuns2().filter((r) => r.jobId === jobId);
1449
- }
1450
1454
  function getCheckpointsByJobId2(jobId) {
1451
1455
  return getCheckpointsByJobId(jobId);
1452
1456
  }
@@ -1493,10 +1497,10 @@ function getEventContents2(jobId, runId, maxStepNumber) {
1493
1497
  return getEventContents(jobId, runId, maxStepNumber);
1494
1498
  }
1495
1499
  function getAllEventContentsForJob(jobId, maxStepNumber) {
1496
- const runs = getRunsByJobId(jobId);
1500
+ const runIds = getRunIdsByJobId(jobId);
1497
1501
  const allEvents = [];
1498
- for (const run of runs) {
1499
- const events = getEventContents(jobId, run.runId, maxStepNumber);
1502
+ for (const runId of runIds) {
1503
+ const events = getEventContents(jobId, runId, maxStepNumber);
1500
1504
  allEvents.push(...events);
1501
1505
  }
1502
1506
  return allEvents.sort((a, b) => a.timestamp - b.timestamp);