Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverchang committed Jan 15, 2020
1 parent 9b168f0 commit aa7bd06
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/appengine/handlers/cron/oss_fuzz_apply_ccs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@

def get_open_testcases_with_bugs():
"""Return iterator to open testcases with bugs."""
return ndb_utils.get_all_from_query(
data_types.Testcase.query(
return data_types.Testcase.query(
ndb_utils.is_true(data_types.Testcase.open),
data_types.Testcase.status == 'Processed',
data_types.Testcase.bug_information != '').order( # pylint: disable=g-explicit-bool-comparison
data_types.Testcase.bug_information, data_types.Testcase.key))
data_types.Testcase.bug_information, data_types.Testcase.key)


class Handler(base_handler.Handler):
Expand Down
1 change: 1 addition & 0 deletions src/appengine/handlers/cron/sync_admins.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from base import utils
from datastore import data_types
from datastore import ndb_utils
from handlers import base_handler
from libs import handler
from metrics import logs
Expand Down
13 changes: 7 additions & 6 deletions src/appengine/libs/query/datastore_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,17 @@ def _get_total_count(self, runs, offset, limit, items, more_limit):
more_limit += 1
more_runs = []
for run in runs:
try:
cursor = run.result.cursor_after()
except exceptions.BadArgumentError:
# iterator had no results.
cursor = None
# try:
# cursor = run.result.cursor_after()
# except exceptions.BadArgumentError as e:
# # iterator had no results.
# cursor = None

more_runs.append(
_Run(
run.query,
start_cursor=cursor,
# TODO(ochang): Use cursor once bug is fixed. It's more efficient.
offset=offset + limit,
keys_only=True,
projection=None,
limit=more_limit))
Expand Down
11 changes: 8 additions & 3 deletions src/python/tests/appengine/libs/query/datastore_query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,17 @@ def test_third_page(self):
], [f.__getnewargs__() for f in self.queries[1][-1].filters])

self.assertIsInstance(self.queries[2][-1].filters, ndb.OR)

expected = []
for item in [f.__getnewargs__() for f in self.queries[2][-1].filters]:
expected.append((item[0], item[1], repr(item[2])))

self.assertItemsEqual([
('__key__', '=',
ndb.Key(u'TestDatastoreModel', 0, project=u'test-clusterfuzz')),
'<Key(\'TestDatastoreModel\', 0), project=test-clusterfuzz>'),
('__key__', '=',
ndb.Key(u'TestDatastoreModel', 1, project=u'test-clusterfuzz')),
], [f.__getnewargs__() for f in self.queries[2][-1].filters])
'<Key(\'TestDatastoreModel\', 1), project=test-clusterfuzz>'),
], expected)


class ComputeProjectionTest(unittest.TestCase):
Expand Down

0 comments on commit aa7bd06

Please # to comment.