def get(self):
   # Must be a GET handler because this runs in a cron job.
   max_tasks = int(self.request.get('max_tasks', 0))
   if max_tasks:
     self.write_json_response(microversions.process_data(max_tasks=max_tasks))
   else:
     self.write_json_response(microversions.process_data_with_backoff())
Пример #2
0
 def get(self):
     # Must be a GET handler because this runs in a cron job.
     max_tasks = int(self.request.get('max_tasks', 0))
     if max_tasks:
         self.write_json_response(
             microversions.process_data(max_tasks=max_tasks))
     else:
         self.write_json_response(microversions.process_data_with_backoff())
Пример #3
0
  def testStronglyConsistentCommits(self):
    # Microversions uses finalize_associated_files so the commit() path should
    # use the always strongly-consistent get_files(), rather than a query.
    # Verify this behavior by simulating a never-consistent HR datastore.
    policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=0)
    self.testbed.init_datastore_v3_stub(consistency_policy=policy)

    files.File('/foo').write('foo')

    # Also, test process_data_with_backoff while we're here.
    results = microversions.process_data_with_backoff(timeout_seconds=5)
    final_changeset = results[0][0]['changeset'].linked_changeset
    self.assertEqual(2, final_changeset.num)
    titan_file = files.File('/foo', changeset=final_changeset)
    self.assertEqual('foo', titan_file.content)