report list of detail files so devicelab can save them (#64009)

This commit is contained in:
Jim Graham
2020-08-20 10:58:25 -07:00
committed by GitHub
parent 2d0634eb32
commit 9e86e9fb1e
4 changed files with 51 additions and 13 deletions

View File

@@ -189,7 +189,10 @@ class _TaskRunner {
/// A result of running a single task.
class TaskResult {
/// Constructs a successful result.
TaskResult.success(this.data, {this.benchmarkScoreKeys = const <String>[]})
TaskResult.success(this.data, {
this.benchmarkScoreKeys = const <String>[],
this.detailFiles,
})
: succeeded = true,
message = 'success' {
const JsonEncoder prettyJson = JsonEncoder.withIndent(' ');
@@ -219,6 +222,7 @@ class TaskResult {
TaskResult.failure(this.message)
: succeeded = false,
data = null,
detailFiles = null,
benchmarkScoreKeys = const <String>[];
/// Whether the task succeeded.
@@ -227,6 +231,9 @@ class TaskResult {
/// Task-specific JSON data
final Map<String, dynamic> data;
/// Files containing detail on the run (e.g. timeline trace files)
final List<String> detailFiles;
/// Keys in [data] that store scores that will be submitted to Cocoon.
///
/// Each key is also part of a benchmark's name tracked by Cocoon.
@@ -245,6 +252,7 @@ class TaskResult {
/// {
/// "success": true|false,
/// "data": arbitrary JSON data valid only for successful results,
/// "detailFiles": list of filenames containing detail on the run
/// "benchmarkScoreKeys": [
/// contains keys into "data" that represent benchmarks scores, which
/// can be uploaded, for example. to golem, valid only for successful
@@ -259,6 +267,8 @@ class TaskResult {
if (succeeded) {
json['data'] = data;
if (detailFiles != null)
json['detailFiles'] = detailFiles;
json['benchmarkScoreKeys'] = benchmarkScoreKeys;
} else {
json['reason'] = message;