예제 #1
0
def archive_outputs_file(persistence_outputs, outputs_path, namepath,
                         filepath):
    check_archive_path(settings.OUTPUTS_DOWNLOAD_ROOT)
    namepath = namepath.replace('.', '/')
    download_filepath = os.path.join(settings.OUTPUTS_DOWNLOAD_ROOT, namepath,
                                     filepath)
    download_dir = '/'.join(download_filepath.split('/')[:-1])
    check_archive_path(download_dir)
    store_manager = get_outputs_store(persistence_outputs=persistence_outputs)
    outputs_filepath = os.path.join(outputs_path, filepath)
    store_manager.download_file(outputs_filepath, download_filepath)
    if store_manager.store.is_local_store:
        return outputs_filepath
    return download_filepath
예제 #2
0
파일: views.py 프로젝트: posix4e/polyaxon
    def get(self, request, *args, **kwargs):
        store_manager = get_outputs_store(persistence_outputs=self.job.persistence_outputs)
        job_outputs_path = get_job_outputs_path(
            persistence_outputs=self.job.persistence_outputs,
            job_name=self.job.unique_name)
        if request.query_params.get('path'):
            job_outputs_path = os.path.join(job_outputs_path,
                                            request.query_params.get('path'))

        try:
            data = store_manager.ls(job_outputs_path)
        except VolumeNotFoundError:
            raise ValidationError('Store manager could not load the volume requested,'
                                  ' to get the outputs data.')
        except Exception:
            raise ValidationError('Experiment outputs path does not exists or bad configuration.')
        return Response(data=data, status=200)
예제 #3
0
 def get(self, request, *args, **kwargs):
     experiment = self.get_experiment()
     store_manager = get_outputs_store(
         persistence_outputs=experiment.persistence_outputs)
     experiment_outputs_path = get_experiment_outputs_path(
         persistence_outputs=experiment.persistence_outputs,
         experiment_name=experiment.unique_name,
         original_name=experiment.original_unique_name,
         cloning_strategy=experiment.cloning_strategy)
     if request.query_params.get('path'):
         experiment_outputs_path = os.path.join(
             experiment_outputs_path, request.query_params.get('path'))
     try:
         data = store_manager.ls(experiment_outputs_path)
     except VolumeNotFoundError:
         raise ValidationError(
             'Store manager could not load the volume requested,'
             ' to get the outputs data.')
     except Exception:
         raise ValidationError(
             'Experiment outputs path does not exists or bad configuration.'
         )
     return Response(data=data, status=200)