diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/test/ispy/common/ispy_utils.py | 11 | ||||
-rw-r--r-- | chrome/test/ispy/server/gs_bucket.py | 5 | ||||
-rw-r--r-- | chrome/test/ispy/server/main_view_handler.py | 9 | ||||
-rw-r--r-- | chrome/test/ispy/server/views/list_view.html | 6 |
4 files changed, 24 insertions, 7 deletions
diff --git a/chrome/test/ispy/common/ispy_utils.py b/chrome/test/ispy/common/ispy_utils.py index a138f07..3d6ed15 100644 --- a/chrome/test/ispy/common/ispy_utils.py +++ b/chrome/test/ispy/common/ispy_utils.py @@ -290,15 +290,20 @@ class ISpyUtils(object): 'Failure', ['expected', 'diff', 'actual', 'info']) return Failure(expected, diff, actual, info) - def GetAllPaths(self, prefix): + def GetAllPaths(self, prefix, max_keys=None, marker=None, delimiter=None): """Gets urls to all files in GS whose path starts with a given prefix. Args: prefix: the prefix to filter files in GS by. + max_keys: Integer. Specifies the maximum number of objects returned + marker: String. Only objects whose fullpath starts lexicographically + after marker (exclusively) will be returned + delimiter: String. Turns on directory mode, specifies characters + to be used as directory separators Returns: a list containing urls to all objects that started with the prefix. """ - return self.cloud_bucket.GetAllPaths(prefix) - + return self.cloud_bucket.GetAllPaths( + prefix, max_keys=max_keys, marker=marker, delimiter=delimiter) diff --git a/chrome/test/ispy/server/gs_bucket.py b/chrome/test/ispy/server/gs_bucket.py index a132f05..263db00 100644 --- a/chrome/test/ispy/server/gs_bucket.py +++ b/chrome/test/ispy/server/gs_bucket.py @@ -67,6 +67,7 @@ class GoogleCloudStorageBucket(cloud_bucket.BaseCloudBucket): return '/image?file_path=%s' % path # override - def GetAllPaths(self, prefix): + def GetAllPaths(self, prefix, max_keys=None, marker=None, delimiter=None): return (f.filename[len(self.bucket) + 1:] for f in - cloudstorage.listbucket(self.bucket, prefix=prefix)) + cloudstorage.listbucket(self.bucket, prefix=prefix, + max_keys=max_keys, marker=marker, delimiter=delimiter)) diff --git a/chrome/test/ispy/server/main_view_handler.py b/chrome/test/ispy/server/main_view_handler.py index 0738a0c..f82dc78 100644 --- a/chrome/test/ispy/server/main_view_handler.py +++ b/chrome/test/ispy/server/main_view_handler.py @@ -50,9 +50,14 @@ class MainViewHandler(webapp2.RequestHandler): """ template = JINJA.get_template('list_view.html') data = {} - test_runs = set([path.lstrip('/').split('/')[1] for path in - ispy.GetAllPaths('failures/')]) + max_keys = 1000 + marker = 'failures/%s' % self.request.get('marker') + test_runs = list([path.split('/')[1] for path in + ispy.GetAllPaths('failures/', max_keys=max_keys, + marker=marker, delimiter='/')]) base_url = '/?test_run=%s' + next_url = '/?marker=%s' % test_runs[-1] + data['next_url'] = next_url data['links'] = [(test_run, base_url % test_run) for test_run in test_runs] self.response.write(template.render(data)) diff --git a/chrome/test/ispy/server/views/list_view.html b/chrome/test/ispy/server/views/list_view.html index f6b5dc6..9889a74 100644 --- a/chrome/test/ispy/server/views/list_view.html +++ b/chrome/test/ispy/server/views/list_view.html @@ -16,6 +16,12 @@ </head> <body> <h3>Test Runs</h3> + <form method="get"> + <label for "prefix">Search Failures by Prefix:</label> + <input type="text" name="marker" id="prefix"> + <input type="submit" value="submit"> + </form> + <a href="{{ next_url }}">Next</a> <div id="container"> {% for link in links %} <div> |