-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-execution.js
More file actions
55 lines (48 loc) · 1.14 KB
/
Copy pathcheck-execution.js
File metadata and controls
55 lines (48 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require("dotenv").config();
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
async function main() {
// Find the most recent failed execution
const execution = await prisma.execution.findFirst({
where: {
status: "FAILED",
},
orderBy: {
createdAt: "desc",
},
select: {
id: true,
status: true,
errorMessage: true,
createdAt: true,
finishedAt: true,
},
});
if (execution) {
console.log("Recent Failed Execution:");
console.log(JSON.stringify(execution, null, 2));
// Now get the logs
const logs = await prisma.executionLog.findMany({
where: {
executionId: execution.id,
},
orderBy: {
occurredAt: "asc",
},
select: {
message: true,
level: true,
occurredAt: true,
metadata: true,
},
});
console.log("\nExecution Logs:");
logs.forEach((log) => {
console.log(`${log.occurredAt} [${log.level}] ${log.message}`);
});
} else {
console.log("No failed execution found");
}
await prisma.$disconnect();
}
main().catch(console.error);