Flutter Engine
The Flutter Engine
Functions | Variables
upload_dm_results Namespace Reference

Functions

def RunSteps (api)
 
def GenTests (api)
 
def main (dm_dir, build_number, builder_name)
 

Variables

string PYTHON_VERSION_COMPATIBILITY = "PY3"
 
list DEPS
 
string DM_JSON = 'dm.json'
 
string VERBOSE_LOG = 'verbose.log'
 

Function Documentation

◆ GenTests()

def upload_dm_results.GenTests (   api)

Definition at line 84 of file upload_dm_results.py.

84def GenTests(api):
85 builder = 'Upload-Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All'
86 yield (
87 api.test('normal_bot') +
88 api.properties(buildername=builder,
89 gs_bucket='skia-infra-gm',
90 revision='abc123',
91 path_config='kitchen')
92 )
93
94 yield (
95 api.test('alternate_bucket') +
96 api.properties(buildername=builder,
97 gs_bucket='skia-infra-gm-alt',
98 revision='abc123',
99 path_config='kitchen')
100 )
101
102 yield (
103 api.test('failed_once') +
104 api.properties(buildername=builder,
105 gs_bucket='skia-infra-gm',
106 revision='abc123',
107 path_config='kitchen') +
108 api.step_data('upload .png images', retcode=1)
109 )
110
111 yield (
112 api.test('failed_all') +
113 api.properties(buildername=builder,
114 gs_bucket='skia-infra-gm',
115 revision='abc123',
116 path_config='kitchen') +
117 api.step_data('upload .png images', retcode=1) +
118 api.step_data('upload .png images (attempt 2)', retcode=1) +
119 api.step_data('upload .png images (attempt 3)', retcode=1) +
120 api.step_data('upload .png images (attempt 4)', retcode=1) +
121 api.step_data('upload .png images (attempt 5)', retcode=1)
122 )
123
124 yield (
125 api.test('trybot') +
126 api.properties.tryserver(
127 gerrit_project='skia',
128 gerrit_url='https://skia-review.googlesource.com/',
129 ) +
130 api.properties(
131 buildername=builder,
132 gs_bucket='skia-infra-gm',
133 revision='abc123',
134 path_config='kitchen')
135 )

◆ main()

def upload_dm_results.main (   dm_dir,
  build_number,
  builder_name 
)
Upload DM output PNG files and JSON summary to Google Storage.

  dm_dir:        path to PNG files and JSON summary    (str)
  build_number:  nth build on this builder             (str or int)
  builder_name:  name of this builder                  (str)

Definition at line 15 of file upload_dm_results.py.

15def main(dm_dir, build_number, builder_name):
16 """Upload DM output PNG files and JSON summary to Google Storage.
17
18 dm_dir: path to PNG files and JSON summary (str)
19 build_number: nth build on this builder (str or int)
20 builder_name: name of this builder (str)
21 """
22 # import gs_utils
23 current_dir = os.path.dirname(os.path.abspath(__file__))
24 sys.path.insert(0, os.path.join(current_dir, "../../../common/py/utils"))
25 import gs_utils
26
27 # Private, but Google-readable.
28 ACL = gs_utils.GSUtils.PredefinedACL.PRIVATE
29 FINE_ACLS = [(
30 gs_utils.GSUtils.IdType.GROUP_BY_DOMAIN,
31 'google.com',
32 gs_utils.GSUtils.Permission.READ
33 )]
34
35 if not os.path.isfile(os.path.join(dm_dir, 'dm.json')):
36 sys.exit("no dm.json file found in output directory.")
37
38 # Move dm.json to its own directory to make uploading it easier.
39 tmp = tempfile.mkdtemp()
40 shutil.move(os.path.join(dm_dir, 'dm.json'),
41 os.path.join(tmp, 'dm.json'))
42
43 # Only images are left in dm_dir. Upload any new ones.
44 gs = gs_utils.GSUtils()
45 gs.upload_dir_contents(dm_dir,
46 'skia-android-dm',
47 'dm-images-v1',
48 upload_if = gs.UploadIf.IF_NEW,
49 predefined_acl = ACL,
50 fine_grained_acl_list = FINE_ACLS)
51
52
53 # /dm-json-v1/year/month/day/hour/build-number/builder/dm.json
54 now = datetime.datetime.utcnow()
55 summary_dest_dir = '/'.join(['dm-json-v1',
56 str(now.year ).zfill(4),
57 str(now.month).zfill(2),
58 str(now.day ).zfill(2),
59 str(now.hour ).zfill(2),
60 str(build_number),
61 builder_name])
62
63 # Upload the JSON summary.
64 gs.upload_dir_contents(tmp,
65 'skia-android-dm',
66 summary_dest_dir,
67 predefined_acl = ACL,
68 fine_grained_acl_list = FINE_ACLS)
69
70
71 # Just for hygiene, put dm.json back.
72 shutil.move(os.path.join(tmp, 'dm.json'),
73 os.path.join(dm_dir, 'dm.json'))
74 os.rmdir(tmp)
75
def main(dm_dir, build_number, builder_name)
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ RunSteps()

def upload_dm_results.RunSteps (   api)

Definition at line 29 of file upload_dm_results.py.

29def RunSteps(api):
30 api.vars.setup()
31 revision = api.properties['revision']
32
33 results_dir = api.path.start_dir.join('test')
34
35 # Upload the images. It is *vital* that the images are uploaded first
36 # so they exist whenever the json is processed.
37 image_dest_path = 'gs://%s/dm-images-v1' % api.properties['gs_bucket']
38 for ext in ['.png', '.pdf']:
39 files_to_upload = api.file.glob_paths(
40 'find %s images' % ext,
41 results_dir,
42 '*%s' % ext,
43 test_data=['someimage.png'])
44 # For some reason, glob returns results_dir when it should return nothing.
45 files_to_upload = [f for f in files_to_upload if str(f).endswith(ext)]
46 if len(files_to_upload) > 0:
47 api.gsutil.cp('%s images' % ext, results_dir.join('*%s' % ext),
48 image_dest_path, multithread=True)
49
50 # Compute the directory to upload results to
51 now = api.time.utcnow()
52 summary_dest_path = '/'.join([
53 'dm-json-v1',
54 str(now.year ).zfill(4),
55 str(now.month).zfill(2),
56 str(now.day ).zfill(2),
57 str(now.hour ).zfill(2),
58 revision,
59 api.vars.builder_name,
60 str(int(calendar.timegm(now.utctimetuple())))])
61
62 # Trybot results are further siloed by issue/patchset.
63 if api.vars.is_trybot:
64 summary_dest_path = '/'.join(('trybot', summary_dest_path,
65 str(api.vars.issue), str(api.vars.patchset)))
66
67 summary_dest_path = 'gs://%s/%s' % (api.properties['gs_bucket'],
68 summary_dest_path)
69
70 # Directly upload dm.json and verbose.log if it exists
71 json_file = results_dir.join(DM_JSON)
72 log_file = results_dir.join(VERBOSE_LOG)
73
74 api.gsutil.cp('dm.json', json_file,
75 summary_dest_path + '/' + DM_JSON, extra_args=['-Z'])
76
77 files = api.file.listdir('check for optional verbose.log file',
78 results_dir, test_data=['dm.json', 'verbose.log'])
79 if log_file in files:
80 api.gsutil.cp('verbose.log', log_file,
81 summary_dest_path + '/' + VERBOSE_LOG, extra_args=['-Z'])
82
83

Variable Documentation

◆ DEPS

list upload_dm_results.DEPS
Initial value:
1= [
2 'recipe_engine/file',
3 'recipe_engine/json',
4 'recipe_engine/path',
5 'recipe_engine/properties',
6 'recipe_engine/step',
7 'recipe_engine/time',
8 'gsutil',
9 'vars',
10]

Definition at line 13 of file upload_dm_results.py.

◆ DM_JSON

string upload_dm_results.DM_JSON = 'dm.json'

Definition at line 25 of file upload_dm_results.py.

◆ PYTHON_VERSION_COMPATIBILITY

string upload_dm_results.PYTHON_VERSION_COMPATIBILITY = "PY3"

Definition at line 11 of file upload_dm_results.py.

◆ VERBOSE_LOG

string upload_dm_results.VERBOSE_LOG = 'verbose.log'

Definition at line 26 of file upload_dm_results.py.