From bd7b2070934093bdc7883da52b1e512296e8026e Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 9 Aug 2011 15:24:04 +0200
Subject: [PATCH] rlib2: Exclude oplog/opresult from bulk job list

These fields can get rather large. Excluding them from the big bulk list
reduces the amount of data. They are still available via per-job
requests.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/rapi/rlib2.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index f6d8fd6ee..db004f141 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -81,12 +81,17 @@ G_FIELDS = [
   "node_list",
   ] + _COMMON_FIELDS
 
-J_FIELDS = [
+J_FIELDS_BULK = [
   "id", "ops", "status", "summary",
-  "opstatus", "opresult", "oplog",
+  "opstatus",
   "received_ts", "start_ts", "end_ts",
   ]
 
+J_FIELDS = J_FIELDS_BULK + [
+  "oplog",
+  "opresult",
+  ]
+
 _NR_DRAINED = "drained"
 _NR_MASTER_CANDIATE = "master-candidate"
 _NR_MASTER = "master"
@@ -240,8 +245,8 @@ class R_2_jobs(baserlib.R_Generic):
     client = baserlib.GetClient()
 
     if self.useBulk():
-      bulkdata = client.QueryJobs(None, J_FIELDS)
-      return baserlib.MapBulkFields(bulkdata, J_FIELDS)
+      bulkdata = client.QueryJobs(None, J_FIELDS_BULK)
+      return baserlib.MapBulkFields(bulkdata, J_FIELDS_BULK)
     else:
       jobdata = map(compat.fst, client.QueryJobs(None, ["id"]))
       return baserlib.BuildUriList(jobdata, "/2/jobs/%s",
-- 
GitLab