def load_dataset_zip(cls, dataset_id: str) -> File: """ Load dataset from a ZIP file. :param dataset_id: dataset ID """ dataset_path = DatasetPath(dataset_id) file_obj = BytesIO() ZipUtils.compress(dataset_path.metadata_file, file_obj) if GflConf.get_property("ipfs.enabled"): file_obj.seek(0) ipfs_hash = Ipfs.put(file_obj.read()) return File(ipfs_hash=ipfs_hash, file=None) else: return File(ipfs_hash=None, file=file_obj)
def load_job_zip(job_id: str) -> File: """ Load job from a ZIP file. :param job_id: dataset ID """ job_path = JobPath(job_id) file_obj = BytesIO() ZipUtils.compress([job_path.metadata_file, job_path.config_dir], file_obj) if GflConf.get_property("ipfs.enabled"): file_obj.seek(0) ipfs_hash = Ipfs.put(file_obj.read()) return File(ipfs_hash == ipfs_hash) else: return File(file=file_obj)