def test_determine_contexts_direct(self): s = ContextsScript("cmdline.ContextsScript --contexts hst.pmap") s.contexts = contexts = s.determine_contexts() assert len(contexts) == 1, log.format(len(contexts), contexts) assert contexts[0] == "hst.pmap", log.format(len(contexts), contexts) mappings = sorted(list(set(s.get_context_mappings()))) assert len(mappings) == 116, log.format(len(mappings), mappings)
def test_determine_contexts_after(self): s = ContextsScript( "cmdline.ContextsScript --after-context hst-2016-01-01") contexts = s.determine_contexts() assert len(contexts) >= 108, log.format(len(contexts), contexts) assert contexts[0] == "hst_0379.pmap", log.format( len(contexts), contexts)
def ignore_errors(self, i, affected): """Check each context switch for errors during bestrefs run. Fail or return False on errors.""" ignore = False if affected.bestrefs_status != 0: message = log.format("CRDS server-side errors for", i, affected.computation_dir) if self.args.ignore_errant_history: ignore = True if self.args.fail_on_errant_history: self.fatal_error(message) else: log.error(message) return ignore
def scan_for_nonsubmitted_ingests(self, ingest_info): """Check for junk in the submitter's ingest directory, left over files not in the current submission and fail if found. """ submitted_basenames = [ os.path.basename(filepath) for filepath in self.files ] msg = None for ingested in ingest_info.keys(): if ingested not in submitted_basenames: msg = log.format("Non-submitted file", log.srepr(ingested), "is already in the CRDS server's ingest directory. Delete it (--wipe-existing-files or web page Upload Files panel) or submit it.") log.error(msg) if msg is not None: raise exceptions.CrdsExtraneousFileError( "Unexpected files already delivered to CRDS server. See ERROR messages.")
def test_determine_contexts_upto(self): s = ContextsScript("cmdline.ContextsScript --up-to-context hst-2016-01-01") contexts = s.determine_contexts() assert len(contexts) == 195, log.format(len(contexts), contexts) assert contexts[0] == "hst.pmap", log.format(len(contexts), contexts)
def format_remote(self, *params): """Format tuple of message `params` in a standardized way for messages coming from the remote process being monitored. """ text = html.unescape(" ".join(params)) return log.format(">>", text).strip()