def main(self): """Perform the differencing.""" self.args.files = [ self.args.old_file, self.args.new_file ] # for defining self.observatory self.old_file = self.locate_file(self.args.old_file) self.new_file = self.locate_file(self.args.new_file) if self.args.brief: self.args.lowest_mapping_only = True self.args.remove_paths = True self.args.hide_boring_diffs = True self.args.include_header_diffs = True if self.args.sync_files: assert not (self.args.cache1 or self.args.cache2), \ "--sync-files is not compatible with cache-to-cache differences." if self.args.print_all_new_files: serial_old = naming.newstyle_serial(self.old_file) serial_new = naming.newstyle_serial(self.new_file) + 1 if None not in [serial_old, serial_new]: errs = sync.SyncScript("crds.sync --range {0}:{1}".format(serial_old, serial_new))() assert not errs, "Errors occurred while syncing all rules to CRDS cache." else: log.warning("Cannot sync non-standard mapping names, results may be incomplete.") else: self.sync_files([self.old_file, self.new_file]) elif self.args.print_all_new_files: log.warning("--print-all-new-files requires a complete set of rules. suggest --sync-files.") # self.args.files = [ self.old_file, self.new_file ] # for defining self.observatory assert (self.args.cache1 and self.args.cache2) or (not self.args.cache1 and not self.args.cache2), \ "Cache-to-cache comparison requires both --cache1 and --cache2; otherwise neither for single cache comparison." if self.args.print_new_files: status = self.print_new_files() elif self.args.print_all_new_files: status = self.print_all_new_files() elif self.args.print_affected_instruments: status = self.print_affected_instruments() elif self.args.print_affected_types: status = self.print_affected_types() elif self.args.print_affected_modes: status = self.print_affected_modes() else: status = difference(self.observatory, self.old_file, self.new_file, primitive_diffs=self.args.primitive_diffs, check_diffs=self.args.check_diffs, check_references=self.args.check_references, mapping_text_diffs=self.args.mapping_text_diffs, include_header_diffs=self.args.include_header_diffs, hide_boring_diffs=self.args.hide_boring_diffs, recurse_added_deleted=self.args.recurse_added_deleted, lowest_mapping_only=self.args.lowest_mapping_only, remove_paths=self.args.remove_paths, squash_tuples=self.args.squash_tuples, cache1=self.args.cache1, cache2=self.args.cache2) if log.errors() or log.warnings(): return 2 else: return status
def main(self): """Main control flow of submission directory and request manifest creation.""" log.divider("setting up", char="=") self.require_server_connection() self.finish_parameters() if self.args.certify_files: self.certify_local_files() if self.args.logout: return self.logout() self.login() if self.args.wipe_existing_files: self.wipe_files() self.jpoll_key = self.jpoll_open_channel() if self.args.submission_kind == "batch": submit_future = self.batch_submit_references() elif self.args.submission_kind == "certify": submit_future = self.certify_files() elif self.args.submission_kind == "references": submit_future = self.submit_references() elif self.args.submission_kind == "mappings": submit_future = self.submit_mappings() if self.args.monitor_processing: monitor_future = self.monitor() if self.args.wait_for_completion: self.submission_complete(submit_future) if self.args.monitor_processing: monitor = self.monitor_complete(monitor_future) if monitor.exit_status == 0: self._ready_url = monitor.result log.standard_status() self._error_count = log.errors() self._warning_count = log.warnings() return log.errors()