@tradejs/cli 2.0.19 → 2.0.20

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.
@@ -76,6 +76,13 @@ var loadBacktestCheckpointResults = async ({
76
76
  }) => (0, import_redis.getHashJsonValues)(
77
77
  import_redis.redisKeys.backtestRunResults(userName, runId)
78
78
  );
79
+ var loadBacktestRunManifest = async ({
80
+ runId,
81
+ userName
82
+ }) => await (0, import_redis.getData)(
83
+ import_redis.redisKeys.backtestRun(userName, runId),
84
+ null
85
+ );
79
86
 
80
87
  // src/lib/aiExport.ts
81
88
  var resolveRunScopedAiChunks = async ({
@@ -90,6 +97,12 @@ var resolveRunScopedAiChunks = async ({
90
97
  if (!runId) {
91
98
  return null;
92
99
  }
100
+ const manifest = await loadBacktestRunManifest({ runId, userName });
101
+ if (manifest?.status === "running") {
102
+ throw new Error(
103
+ `AI export run "${runId}" is still running; wait for completion before merging its chunks`
104
+ );
105
+ }
93
106
  const chunkFiles = await (0, import_ai.listAiChunkFiles)({ strategyName, outDir, runId });
94
107
  if (!chunkFiles.length) {
95
108
  return {
@@ -109,7 +122,7 @@ var exportAiStrategy = async (params) => {
109
122
  const {
110
123
  outDir,
111
124
  strategyName,
112
- keepChunks,
125
+ keepChunks = true,
113
126
  requestedRunId,
114
127
  userName,
115
128
  now = Date.now