예제 #1
0
 def upload_context(self, context_filename):
     gcs_uploader = gcp.GCSUploader()
     context_hash = utils.crc(context_filename)
     return gcs_uploader.upload_to_bucket(bucket_name=self.gcp_project,
                                          blob_name='fairing_builds/' +
                                          context_hash,
                                          file_to_upload=context_filename)
예제 #2
0
파일: s3_context.py 프로젝트: zoyun/fairing
 def upload_context(self, context_filename):
     s3_uploader = aws.S3Uploader(self.region)
     context_hash = utils.crc(context_filename)
     bucket_name = self.bucket_name or 'kubeflow-' + \
         self.aws_account + '-' + self.region
     return s3_uploader.upload_to_bucket(bucket_name=bucket_name,
                                         blob_name='fairing_builds/' + context_hash,
                                         file_to_upload=context_filename)
예제 #3
0
 def upload_context(self, context_filename):
     minio_uploader = k8s.MinioUploader(self.endpoint_url,
                                        self.minio_secret,
                                        self.minio_secret_key,
                                        self.region_name)
     context_hash = utils.crc(context_filename)
     bucket_name = 'kubeflow-' + self.region_name
     return minio_uploader.upload_to_bucket(blob_name='fairing-builds/' +
                                            context_hash,
                                            bucket_name=bucket_name,
                                            file_to_upload=context_filename)
예제 #4
0
    def upload_context(self, context_filename):
        """
        :param context_filename: context filename
        """
        cos_uploader = ibm_cloud.COSUploader(self.namespace,
                                             self.cos_endpoint_url)

        context_hash = utils.crc(context_filename)
        bucket_name = 'kubeflow-' + context_hash.lower()
        return cos_uploader.upload_to_bucket(blob_name='fairing-builds/' +
                                             context_hash,
                                             bucket_name=bucket_name,
                                             file_to_upload=context_filename)
예제 #5
0
    def context_tar_gz(self, output_file=None):
        """Creating docker context file and compute a running cyclic redundancy check checksum.

        :param output_file: output file (Default value = None)
        :returns: output_file,checksum: docker context file and checksum

        """
        if not output_file:
            _, output_file = tempfile.mkstemp(prefix="/tmp/fairing_context_")
        logging.info("Creating docker context: %s", output_file)
        self.input_files = self.preprocess()
        with tarfile.open(output_file, "w:gz", dereference=True) as tar:
            for dst, src in self.context_map().items():
                logging.debug("Context: %s, Adding %s at %s", output_file,
                              src, dst)
                tar.add(src, filter=reset_tar_mtime, arcname=dst, recursive=False)
        self._context_tar_path = output_file
        return output_file, utils.crc(self._context_tar_path)
예제 #6
0
 def prepare(self, context_filename):  # pylint:disable=arguments-differ
     self.context_hash = utils.crc(context_filename)
     self.context_path = self.upload_context(context_filename)