({
absolutePath,
file,
pythonEnv,
options,
summary,
blockResults,
}: {
absolutePath: string
file: DeepnoteFile
pythonEnv: string
options: RunOptions
summary: ExecutionSummary
blockResults: BlockResult[]
})
| 1243 | } |
| 1244 | |
| 1245 | async function buildMachineRunResult({ |
| 1246 | absolutePath, |
| 1247 | file, |
| 1248 | pythonEnv, |
| 1249 | options, |
| 1250 | summary, |
| 1251 | blockResults, |
| 1252 | }: { |
| 1253 | absolutePath: string |
| 1254 | file: DeepnoteFile |
| 1255 | pythonEnv: string |
| 1256 | options: RunOptions |
| 1257 | summary: ExecutionSummary |
| 1258 | blockResults: BlockResult[] |
| 1259 | }): Promise<RunResult> { |
| 1260 | const result: RunResult = { |
| 1261 | success: summary.failedBlocks === 0, |
| 1262 | path: absolutePath, |
| 1263 | executedBlocks: summary.executedBlocks, |
| 1264 | totalBlocks: summary.totalBlocks, |
| 1265 | failedBlocks: summary.failedBlocks, |
| 1266 | totalDurationMs: summary.totalDurationMs, |
| 1267 | blocks: blockResults, |
| 1268 | } |
| 1269 | |
| 1270 | const shouldIncludeContext = options.context || summary.failedBlocks > 0 |
| 1271 | if (!shouldIncludeContext) { |
| 1272 | return result |
| 1273 | } |
| 1274 | |
| 1275 | try { |
| 1276 | debug('Generating context info...') |
| 1277 | const { stats, lint, dag } = await analyzeProject(file, { |
| 1278 | notebook: options.notebook, |
| 1279 | pythonInterpreter: pythonEnv, |
| 1280 | }) |
| 1281 | const blockMap = buildBlockMap(file, { notebook: options.notebook }) |
| 1282 | |
| 1283 | if (options.context) { |
| 1284 | result.project = { |
| 1285 | stats, |
| 1286 | issues: { |
| 1287 | errors: lint.issueCount.errors, |
| 1288 | warnings: lint.issueCount.warnings, |
| 1289 | details: lint.issues.map(issue => ({ |
| 1290 | code: issue.code, |
| 1291 | message: issue.message, |
| 1292 | severity: issue.severity, |
| 1293 | blockId: issue.blockId, |
| 1294 | blockLabel: issue.blockLabel, |
| 1295 | })), |
| 1296 | }, |
| 1297 | } |
| 1298 | |
| 1299 | const dagNodeMap = new Map(dag.nodes.map(n => [n.id, n])) |
| 1300 | const issuesByBlock = new Map<string, typeof lint.issues>() |
| 1301 | for (const issue of lint.issues) { |
| 1302 | const arr = issuesByBlock.get(issue.blockId) ?? [] |
no test coverage detected