Skip to content

Commit 2622b0d

Browse files
committed
improve debug logs and make them less noisy
1 parent 87b0ce1 commit 2622b0d

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

internal-packages/testcontainers/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ const electricOrigin = async (
148148
} finally {
149149
// WARNING: Testcontainers by default will not wait until the container has stopped. It will simply issue the stop command and return immediately.
150150
// If you need to wait for the container to be stopped, you can provide a timeout. The unit of timeout option here is second
151-
152151
await container.stop({ timeout: 10 });
153152
}
154153
};

packages/cli-v3/src/entryPoints/managed/execution.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,16 @@ export class RunExecution {
208208
return;
209209
}
210210

211-
this.sendDebugLog(`snapshot has changed to: ${snapshot.executionStatus}`, snapshotMetadata);
211+
// DO NOT REMOVE (very noisy, but helpful for debugging)
212+
// this.sendDebugLog(`processing snapshot change: ${snapshot.executionStatus}`, snapshotMetadata);
212213

213214
// Reset the snapshot poll interval so we don't do unnecessary work
214215
this.snapshotPoller?.resetCurrentInterval();
215216

216217
switch (snapshot.executionStatus) {
217218
case "PENDING_CANCEL": {
219+
this.sendDebugLog("run was cancelled", snapshotMetadata);
220+
218221
const [error] = await tryCatch(this.cancel());
219222

220223
if (error) {
@@ -279,13 +282,12 @@ export class RunExecution {
279282
return;
280283
}
281284
case "EXECUTING": {
282-
this.sendDebugLog("run is now executing", snapshotMetadata);
283-
284285
if (completedWaitpoints.length === 0) {
286+
this.sendDebugLog("run is executing without completed waitpoints", snapshotMetadata);
285287
return;
286288
}
287289

288-
this.sendDebugLog("processing completed waitpoints", snapshotMetadata);
290+
this.sendDebugLog("run is executing with completed waitpoints", snapshotMetadata);
289291

290292
if (!this.taskRunProcess) {
291293
this.sendDebugLog("no task run process, ignoring completed waitpoints", snapshotMetadata);
@@ -301,7 +303,10 @@ export class RunExecution {
301303
return;
302304
}
303305
case "RUN_CREATED": {
304-
this.sendDebugLog("invalid status change", snapshotMetadata);
306+
this.sendDebugLog(
307+
"aborting execution: invalid status change: RUN_CREATED",
308+
snapshotMetadata
309+
);
305310

306311
this.abortExecution();
307312
return;
@@ -627,7 +632,7 @@ export class RunExecution {
627632
const snapshotStatus = this.convertAttemptStatusToSnapshotStatus(result.attemptStatus);
628633

629634
// Update our snapshot ID to match the completion result to ensure any subsequent API calls use the correct snapshot
630-
this.updateSnapshot(result.snapshot.friendlyId, snapshotStatus);
635+
this.updateSnapshotAfterCompletion(result.snapshot.friendlyId, snapshotStatus);
631636

632637
const { attemptStatus } = result;
633638

@@ -664,7 +669,7 @@ export class RunExecution {
664669
assertExhaustive(attemptStatus);
665670
}
666671

667-
private updateSnapshot(snapshotId: string, status: TaskRunExecutionStatus) {
672+
private updateSnapshotAfterCompletion(snapshotId: string, status: TaskRunExecutionStatus) {
668673
this.snapshotManager?.updateSnapshot(snapshotId, status);
669674
this.snapshotPoller?.updateSnapshotId(snapshotId);
670675
}
@@ -1000,7 +1005,7 @@ export class RunExecution {
10001005
);
10011006

10021007
if (!suspendResult.success) {
1003-
this.sendDebugLog("failed to suspend run, staying alive 🎶", {
1008+
this.sendDebugLog("suspension request failed, staying alive 🎶", {
10041009
suspendableSnapshot,
10051010
error: suspendResult.error,
10061011
});
@@ -1010,7 +1015,7 @@ export class RunExecution {
10101015
}
10111016

10121017
if (!suspendResult.data.ok) {
1013-
this.sendDebugLog("checkpoint: failed to suspend run", {
1018+
this.sendDebugLog("suspension request returned error, staying alive 🎶", {
10141019
suspendableSnapshot,
10151020
error: suspendResult.data.error,
10161021
});

packages/cli-v3/src/entryPoints/managed/snapshot.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ export class SnapshotManager {
144144

145145
// Skip if this is the current snapshot
146146
if (snapshot.friendlyId === this.state.id) {
147-
this.sendDebugLog("skipping update for duplicate snapshot", {
148-
statusCheckData,
149-
});
147+
// DO NOT REMOVE (very noisy, but helpful for debugging)
148+
// this.sendDebugLog("skipping update for duplicate snapshot", {
149+
// statusCheckData,
150+
// });
150151

151152
return false;
152153
}
@@ -279,7 +280,8 @@ export class SnapshotManager {
279280
(this.state.status === "EXECUTING_WITH_WAITPOINTS" ||
280281
this.state.status === "QUEUED_EXECUTING")
281282
) {
282-
this.sendDebugLog("run is now suspendable, executing handler");
283+
// DO NOT REMOVE (very noisy, but helpful for debugging)
284+
// this.sendDebugLog("run is now suspendable, executing handler");
283285
await this.onSuspendable(this.state);
284286
}
285287
}

0 commit comments

Comments
 (0)