def use_local_file(self): filename = filename_for_ref(self.ref) if os.path.exists(filename): self.set_filename(filename, True) self.result(True, None) else: raise PlanFailedError("Plan use-local-file failed for %s: no such file %s" % (self.ref, filename), "BLOCKSTORE", logging.INFO)
def resolve_dataval(self): if self.string_callback is not None: decoded_dataval = decode_datavalue(self.ref) self.string_callback(decoded_dataval) else: create_datavalue_file(self.ref) self.set_filename(filename_for_ref(self.ref), True) self.result(True, None)
def write_fixed_ref_string(string, fixed_ref): output_ctx = make_local_output(fixed_ref.id) with open(filename_for_ref(fixed_ref), "w") as fp: fp.write(string) output_ctx.close()