Patchwork D6928: ci: fetch explicit attributes

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2019, 3:58 a.m.
Message ID <differential-rev-PHID-DREV-nm3owbdtxpf33ws6xife-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41872/
State New
Headers show

Comments

phabricator - Oct. 1, 2019, 3:58 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that we store the launch configuration in the job record
  and this launch configuration can be several KB large, we need
  to be careful about the data that we retrieve during queries, as
  the overhead for fetching data we don't care about can be large.
  
  Let's fetch an explicit list of fields when rendering the main
  web UI.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6928

AFFECTED FILES
  contrib/ci/lambda_functions/web.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/ci/lambda_functions/web.py b/contrib/ci/lambda_functions/web.py
--- a/contrib/ci/lambda_functions/web.py
+++ b/contrib/ci/lambda_functions/web.py
@@ -95,7 +95,7 @@ 
 
             cset_results = {}
 
-            for entry in get_jobs_metdata(job_table, repo_name, push['node']):
+            for entry in get_jobs_metadata(job_table, repo_name, push['node']):
                 job_name = entry['job_name']
                 build_number = entry['build_number']
 
@@ -374,7 +374,7 @@ 
     }
 
 
-def get_jobs_metdata(job_table, repo, node):
+def get_jobs_metadata(job_table, repo, node):
     """Obtain jobs records for a revision."""
     exclusive_start_key = None
 
@@ -385,12 +385,27 @@ 
             extra['ExclusiveStartKey'] = exclusive_start_key
 
         res = job_table.scan(
-            Select='ALL_ATTRIBUTES',
             FilterExpression='repo = :repo AND node = :node',
             ExpressionAttributeValues={
                 ':repo': repo,
                 ':node': node,
             },
+            ProjectionExpression=', '.join((
+                'build_number',
+                'end_time',
+                'execution_state',
+                'exit_clean',
+                'fail_count',
+                'instance_hourly_cost',
+                'job_id',
+                'job_name',
+                'output_log_url',
+                'pass_count',
+                'schedule_time',
+                'skip_count',
+                'start_time',
+                'test_count',
+            )),
             **extra
         )
         for entry in res['Items']: