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)
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)
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)
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)
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)
def prepare(self, context_filename): # pylint:disable=arguments-differ self.context_hash = utils.crc(context_filename) self.context_path = self.upload_context(context_filename)