def upload_files(op, path_list): """Uploads a list of files. Args: op: The CamliOp to use. path_list: The list of file paths to upload. Returns: Exit code. """ real_path_set = set([os.path.abspath(path) for path in path_list]) all_blob_files = [open(path, 'rb') for path in real_path_set] logging.debug('Uploading blob paths: %r', real_path_set) op.put_blobs(all_blob_files) return 0
def store_zip(self, zip_loc, name, job_id): conf = util.conf()['camli'] op = camli.op.CamliOp(conf['url'], auth=conf['auth'], basepath=conf['basepath']) blobref = op.put_blobs([open(zip_loc)]) #list does matter if len(blobref) == 1: blobref_clean = blobref.pop() else: raise ValueError("Multiple blobrefs!") self.tell_queen(blobref_clean, name, job_id)