Example #1
0
    def save_job_zip(cls, job_id: str, job: File) -> NoReturn:
        """
        Save the zip file of the job.

        :param job_id: job ID
        :param job: zip file
        """
        job_path = JobPath(job_id)
        if job.ipfs_hash is not None and job.ipfs_hash != "":
            file_obj = Ipfs.get(job.ipfs_hash)
        else:
            file_obj = File.file
        ZipUtils.extract(file_obj, job_path.root_dir)
Example #2
0
    def save_dataset_zip(cls, dataset_id: str, dataset: File) -> NoReturn:
        """
        Save the zip file of the dataset.

        :param dataset_id: dataset ID
        :param dataset: zip file
        """
        dataset_path = DatasetPath(dataset_id)
        if dataset.ipfs_hash is not None and dataset.ipfs_hash != "":
            file_obj = Ipfs.get(dataset.ipfs_hash)
        else:
            file_obj = dataset.file
        ZipUtils.extract(file_obj, dataset_path.root_dir)