Example #1
0
 def fetch_layout_test_results(self, results_url):
     # FIXME: This should cache that the result was a 404 and stop hitting the network.
     results_file = NetworkTransaction(convert_404_to_None=True).run(
         lambda: self._fetch_file_from_results(results_url,
                                               "full_results.json"))
     return LayoutTestResults.results_from_string(results_file)
Example #2
0
 def update_svn_revision(self, svn_revision_number, broken_bot):
     _log.info("SVN revision: %s broke %s" % (svn_revision_number, broken_bot))
     return NetworkTransaction().run(lambda: self._post_svn_revision_to_server(svn_revision_number, broken_bot))
 def _retrieve_zip_file(self, zip_url):
     temp_file = NetworkTransaction().run(
         lambda: urllib.urlretrieve(zip_url)[0])
     return (temp_file, zipfile.ZipFile(temp_file))
Example #4
0
 def update_work_items(self, queue_name, work_items):
     _log.debug("Recording work items: %s for %s" % (work_items, queue_name))
     return NetworkTransaction().run(lambda: self._post_work_items_to_server(queue_name, work_items))
Example #5
0
 def update_status(self, queue_name, status, patch=None, results_file=None):
     _log.info(status)
     return NetworkTransaction().run(lambda: self._post_status_to_server(queue_name, status, patch, results_file))
Example #6
0
 def update_work_items(self, queue_name, high_priority_work_items, work_items):
     _log.info("Recording work items: %s for %s" % (high_priority_work_items + work_items, queue_name))
     return NetworkTransaction().run(lambda: self._post_work_items_to_server(queue_name, high_priority_work_items, work_items))
Example #7
0
 def release_work_item(self, queue_name, patch):
     _log.info("Releasing work item %s from %s" % (patch.id(), queue_name))
     return NetworkTransaction(convert_404_to_None=True).run(lambda: self._post_release_work_item(queue_name, patch))
Example #8
0
 def test_success(self):
     transaction = NetworkTransaction()
     self.assertEqual(transaction.run(lambda: 42), 42)
Example #9
0
 def test_convert_404_to_None(self):
     transaction = NetworkTransaction(convert_404_to_None=True)
     self.assertEqual(transaction.run(lambda: self._raise_404_error()), None)
Example #10
0
 def submit_to_ews(self, attachment_id):
     _log.info(
         'Submitting attachment {} to EWS queues'.format(attachment_id))
     return NetworkTransaction().run(
         lambda: self._post_patch_to_ews(attachment_id))
Example #11
0
 def get_binary(self, url, convert_404_to_None=False):
     return NetworkTransaction(convert_404_to_None=convert_404_to_None).run(
         lambda: urllib2.urlopen(url).read())
Example #12
0
 def bug_id_for_attachment_id(self,
                              attachment_id,
                              throw_on_access_error=False):
     return NetworkTransaction().run(
         lambda: self.get_bug_id_for_attachment_id(attachment_id,
                                                   throw_on_access_error))
Example #13
0
 def _get_json(self):
     return NetworkTransaction().run(
         lambda: urllib2.urlopen(self._json_url()).read())
Example #14
0
 def test_convert_404_to_None(self):
     transaction = NetworkTransaction(convert_404_to_None=True)
     self.assertIsNone(transaction.run(self._raise_404_error))
Example #15
0
 def bug_id_for_attachment_id(self, attachment_id):
     return NetworkTransaction().run(lambda: self.get_bug_id_for_attachment_id(attachment_id))
Example #16
0
 def submit_to_ews(self, attachment_id):
     _log.info("Submitting attachment %s to EWS queues" % attachment_id)
     return NetworkTransaction().run(lambda: self._post_work_item_to_ews(attachment_id))
Example #17
0
 def open_url(self, url):
     return NetworkTransaction().run(lambda: self.browser.open(url), url)
Example #18
0
 def upload_attachment(self, attachment):
     _log.info('Uploading attachment {} to status server'.format(attachment.id()))
     # FIXME: Remove argument convert_404_to_None once we update AppEngine to support uploading attachments.
     return NetworkTransaction(convert_404_to_None=True).run(lambda: self._upload_attachment_to_server(attachment.id(), attachment.to_json(), attachment.contents()))