def update(cls, builder, test_type, incremental): """Update datastore json file data by merging it with incremental json file. Args: builder: builder name. test_type: type of test results. incremental: incremental json file data to merge. Returns: TestFile object if update succeeds or None on failure. """ files = TestFile.get_files(builder, test_type, JSON_RESULTS_FILE) if files: file = files[0] new_results = cls.merge(builder, file.data, incremental) else: # Use the incremental data if there is no aggregated file to merge. file = TestFile() file.builder = builder file.test_type = test_type file.name = JSON_RESULTS_FILE new_results = incremental logging.info( "No existing json results, incremental json is saved.") if not new_results: return None if not file.save(new_results): return None return file
def update(cls, builder, test_type, incremental): """Update datastore json file data by merging it with incremental json file. Args: builder: builder name. test_type: type of test results. incremental: incremental json file data to merge. Returns: TestFile object if update succeeds or None on failure. """ files = TestFile.get_files(builder, test_type, JSON_RESULTS_FILE) if files: file = files[0] new_results = cls.merge(builder, file.data, incremental) else: # Use the incremental data if there is no aggregated file to merge. file = TestFile() file.builder = builder file.test_type = test_type file.name = JSON_RESULTS_FILE new_results = incremental logging.info("No existing json results, incremental json is saved.") if not new_results: return None if not file.save(new_results): return None return file
def _get_file(cls, master, builder, test_type, filename): files = TestFile.get_files(master, builder, test_type, filename) if files: return files[0] file = TestFile() file.master = master file.builder = builder file.test_type = test_type file.name = filename file.data = "" return file
def update_file(cls, master, builder, test_type, incremental, is_full_results_format, filename, num_runs): files = TestFile.get_files(master, builder, test_type, filename) if files: file = files[0] else: file = TestFile() file.master = master file.builder = builder file.test_type = test_type file.name = filename file.data = "" new_results = cls.merge(builder, file.data, incremental, is_full_results_format, num_runs) if not new_results or not file.save(new_results): logging.info("Update failed, master: %s, builder: %s, test_type: %s, name: %s." % (master, builder, test_type, filename)) return False return True
def update_file(cls, master, builder, test_type, incremental, filename, num_runs): files = TestFile.get_files(master, builder, test_type, filename) if files: file = files[0] new_results = cls.merge(builder, file.data, incremental, num_runs) else: # Use the incremental data if there is no aggregated file to merge. file = TestFile() file.master = master file.builder = builder file.test_type = test_type file.name = filename new_results = incremental logging.info("No existing json results, incremental json is saved.") if not new_results or not file.save(new_results): logging.info("Update failed, master: %s, builder: %s, test_type: %s, name: %s." % (master, builder, test_type, filename)) return False return True
def update_file(cls, master, builder, test_type, incremental, filename, num_runs): files = TestFile.get_files(master, builder, test_type, filename) if files: file = files[0] new_results = cls.merge(builder, file.data, incremental, num_runs) else: # Use the incremental data if there is no aggregated file to merge. file = TestFile() file.master = master file.builder = builder file.test_type = test_type file.name = filename new_results = incremental logging.info( "No existing json results, incremental json is saved.") if not new_results or not file.save(new_results): logging.info( "Update failed, master: %s, builder: %s, test_type: %s, name: %s." % (master, builder, test_type, filename)) return False return True