Skip to content

Commit

Permalink
refactor: improved logging of streaming batch execution results
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha87 committed Jul 11, 2024
1 parent dfd6241 commit de6cd74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/activity/exe-script-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class ExeScriptExecutor {
const batchId = await this.send(script);
const batchSize = JSON.parse(script.text).length;

this.logger.debug(`Script sent.`, { batchId });
this.logger.debug(`Script sent.`, { batchId, script });
return { batchId, batchSize };
} catch (error) {
const message = getMessageFromApiError(error);
Expand Down Expand Up @@ -235,7 +235,7 @@ export class ExeScriptExecutor {
private parseEventToResult(event: StreamingBatchEvent, batchSize: number): Result {
// StreamingBatchEvent has a slightly more extensive structure,
// including a return code that could be added to the Result entity... (?)
return new Result({
const result = new Result({
index: event.index,
eventDate: event.timestamp,
result: event?.kind?.finished
Expand All @@ -250,5 +250,9 @@ export class ExeScriptExecutor {
message: event?.kind?.finished?.message,
isBatchFinished: event.index + 1 >= batchSize && Boolean(event?.kind?.finished),
});

this.logger.debug("Received stream batch execution result", { result });

return result;
}
}
2 changes: 1 addition & 1 deletion src/activity/exe-unit/batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class Batch {
this.executor.activity.agreement.provider,
error,
);
this.logger.debug("Error in batch script execution");
this.logger.debug("Error in batch script execution", { error });
this.script
.after(allResults)
.then(() => reject(golemError))
Expand Down

0 comments on commit de6cd74

Please sign in to comment.