Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
16c0a3d7
Unverified
Commit
16c0a3d7
authored
Jun 21, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate task_result to null safety (#84939)
parent
a8232dd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
task_result.dart
dev/devicelab/lib/framework/task_result.dart
+9
-11
No files found.
dev/devicelab/lib/framework/task_result.dart
View file @
16c0a3d7
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:convert'
;
import
'dart:io'
;
...
...
@@ -25,13 +23,13 @@ class TaskResult {
:
succeeded
=
true
{
const
JsonEncoder
prettyJson
=
JsonEncoder
.
withIndent
(
' '
);
if
(
benchmarkScoreKeys
!=
null
)
{
for
(
final
String
key
in
benchmarkScoreKeys
)
{
if
(!
data
.
containsKey
(
key
))
{
for
(
final
String
key
in
benchmarkScoreKeys
!
)
{
if
(!
data
!
.
containsKey
(
key
))
{
throw
'Invalid benchmark score key "
$key
". It does not exist in task '
'result data
${prettyJson.convert(data)}
'
;
}
else
if
(
data
[
key
]
is
!
num
)
{
}
else
if
(
data
!
[
key
]
is
!
num
)
{
throw
'Invalid benchmark score for key "
$key
". It is expected to be a num '
'but was
${(data
[key] as Object).runtimeType}
:
${prettyJson.convert(data
[key])}
'
;
'but was
${(data
![key] as Object).runtimeType}
:
${prettyJson.convert(data!
[key])}
'
;
}
}
}
...
...
@@ -53,8 +51,8 @@ class TaskResult {
factory
TaskResult
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
final
bool
success
=
json
[
'success'
]
as
bool
;
if
(
success
)
{
final
List
<
String
>
benchmarkScoreKeys
=
(
json
[
'benchmarkScoreKeys'
]
as
List
<
dynamic
>
??
<
String
>[]).
cast
<
String
>();
final
List
<
String
>
detailFiles
=
(
json
[
'detailFiles'
]
as
List
<
dynamic
>
??
<
String
>[]).
cast
<
String
>();
final
List
<
String
>
benchmarkScoreKeys
=
(
json
[
'benchmarkScoreKeys'
]
as
List
<
dynamic
>
?
??
<
String
>[]).
cast
<
String
>();
final
List
<
String
>
detailFiles
=
(
json
[
'detailFiles'
]
as
List
<
dynamic
>
?
??
<
String
>[]).
cast
<
String
>();
return
TaskResult
.
success
(
json
[
'data'
]
as
Map
<
String
,
dynamic
>,
benchmarkScoreKeys:
benchmarkScoreKeys
,
detailFiles:
detailFiles
,
...
...
@@ -76,15 +74,15 @@ class TaskResult {
final
bool
succeeded
;
/// Task-specific JSON data
final
Map
<
String
,
dynamic
>
data
;
final
Map
<
String
,
dynamic
>
?
data
;
/// Files containing detail on the run (e.g. timeline trace files)
final
List
<
String
>
detailFiles
;
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.
final
List
<
String
>
benchmarkScoreKeys
;
final
List
<
String
>
?
benchmarkScoreKeys
;
/// Whether the task failed.
bool
get
failed
=>
!
succeeded
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment