( executedAction: dataform.IActionResult, executionAction: dataform.IExecutionAction, dryRun?: boolean )
| 321 | } |
| 322 | |
| 323 | export function printExecutedAction( |
| 324 | executedAction: dataform.IActionResult, |
| 325 | executionAction: dataform.IExecutionAction, |
| 326 | dryRun?: boolean |
| 327 | ) { |
| 328 | const jobIds = executedAction.tasks |
| 329 | .filter(task => task.metadata?.bigquery?.jobId) |
| 330 | .map(task => task.metadata.bigquery.jobId); |
| 331 | const bytesBilled = executedAction.tasks |
| 332 | .filter(task => task.metadata?.bigquery?.jobId) |
| 333 | .map(task => { |
| 334 | const bytes = task.metadata.bigquery?.totalBytesBilled?.toNumber?.() ?? 0; |
| 335 | return formatBytesInHumanReadableFormat(bytes); |
| 336 | }); |
| 337 | |
| 338 | const executionSuffix = formatExecutionSuffix(jobIds, bytesBilled); |
| 339 | |
| 340 | switch (executedAction.status) { |
| 341 | case dataform.ActionResult.ExecutionStatus.SUCCESSFUL: { |
| 342 | switch (executionAction.type) { |
| 343 | case "table": { |
| 344 | writeStdOut( |
| 345 | `${successOutput(`Table ${dryRun ? "dry run success" : "created"}: `)} ${datasetString( |
| 346 | executionAction.target, |
| 347 | executionAction.tableType, |
| 348 | executionAction.tasks.length === 0 |
| 349 | )}${executionSuffix}` |
| 350 | ); |
| 351 | return; |
| 352 | } |
| 353 | case "assertion": { |
| 354 | writeStdOut( |
| 355 | `${successOutput( |
| 356 | `Assertion ${dryRun ? "dry run success" : "passed"}: ` |
| 357 | )} ${assertionString( |
| 358 | executionAction.target, |
| 359 | executionAction.tasks.length === 0 |
| 360 | )}${executionSuffix}` |
| 361 | ); |
| 362 | return; |
| 363 | } |
| 364 | case "operation": { |
| 365 | writeStdOut( |
| 366 | `${successOutput( |
| 367 | `Operation ${dryRun ? "dry run success" : "completed successfully"}: ` |
| 368 | )} ${operationString( |
| 369 | executionAction.target, |
| 370 | executionAction.tasks.length === 0 |
| 371 | )}${executionSuffix}` |
| 372 | ); |
| 373 | return; |
| 374 | } |
| 375 | } |
| 376 | } |
| 377 | case dataform.ActionResult.ExecutionStatus.FAILED: { |
| 378 | switch (executionAction.type) { |
| 379 | case "table": { |
| 380 | writeStdErr( |
no test coverage detected