Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gold_upload.api.GoldUploadApi Class Reference
Inheritance diagram for gold_upload.api.GoldUploadApi:

Public Member Functions

 upload (self)
 

Detailed Description

Definition at line 11 of file api.py.

Member Function Documentation

◆ upload()

gold_upload.api.GoldUploadApi.upload (   self)
Attempt to upload files to Gold.
This module assumes setup has occurred for the vars and flavor modules.

Definition at line 12 of file api.py.

12 def upload(self):
13 """Attempt to upload files to Gold.
14 This module assumes setup has occurred for the vars and flavor modules.
15 """
16 revision = self.m.properties['revision']
17 results_dir = self.m.flavor.host_dirs.dm_dir
18
19 # Upload the images. It is preferred that the images are uploaded first
20 # so they exist whenever the json is processed.
21 image_dest_path = 'gs://%s/dm-images-v1' % self.m.properties['gs_bucket']
22 for ext in ['.png']:
23 files_to_upload = self.m.file.glob_paths(
24 'find %s images' % ext,
25 results_dir,
26 '*%s' % ext,
27 test_data=['someimage.png'])
28 # For some reason, glob returns results_dir when it should return nothing.
29 files_to_upload = [f for f in files_to_upload if str(f).endswith(ext)]
30 if len(files_to_upload) > 0:
31 extra_gsutil_args = None
32 if self.m.platform.is_mac:
33 extra_gsutil_args = ['-o', 'GSUtil:parallel_process_count=1']
34 self.m.gsutil.cp('%s images' % ext, results_dir.join('*%s' % ext),
35 image_dest_path, extra_gsutil_args=extra_gsutil_args,
36 multithread=True)
37
38 summary_dest_path = 'gs://%s' % self.m.properties['gs_bucket']
39 ref = revision
40 # Trybot results are siloed by issue/patchset.
41 if self.m.vars.is_trybot:
42 summary_dest_path = '/'.join([summary_dest_path, 'trybot'])
43 ref = '%s_%s' % (str(self.m.vars.issue), str(self.m.vars.patchset))
44
45 # Compute the directory to upload results to
46 now = self.m.time.utcnow()
47 summary_dest_path = '/'.join([
48 summary_dest_path,
49 'dm-json-v1',
50 str(now.year ).zfill(4),
51 str(now.month).zfill(2),
52 str(now.day ).zfill(2),
53 str(now.hour ).zfill(2),
54 ref,
55 self.m.vars.builder_name,
56 str(int(calendar.timegm(now.utctimetuple())))])
57
58 # Directly upload dm.json if it exists.
59 json_file = results_dir.join(DM_JSON)
60 # -Z compresses the json file at rest with gzip.
61 self.m.gsutil.cp('dm.json', json_file,
62 summary_dest_path + '/' + DM_JSON, extra_args=['-Z'])
63
Type::kYUV Type::kRGBA() int(0.7 *637)

The documentation for this class was generated from the following file: