def begin(self): if self._credentials: self._credentials_placeholder = array_ops.placeholder(dtypes.string) self._credentials_ops = gen_gcs_config_ops.gcs_configure_credentials( self._credentials_placeholder) if self._block_cache: self._block_cache_op = gen_gcs_config_ops.gcs_configure_block_cache( max_cache_size=self._block_cache.max_bytes, block_size=self._block_cache.block_size, max_staleness=self._block_cache.max_staleness)
def begin(self): if self._credentials: self._credentials_placeholder = array_ops.placeholder( dtypes.string) self._credentials_ops = gen_gcs_config_ops.gcs_configure_credentials( self._credentials_placeholder) if self._block_cache: self._block_cache_op = gen_gcs_config_ops.gcs_configure_block_cache( max_cache_size=self._block_cache.max_bytes, block_size=self._block_cache.block_size, max_staleness=self._block_cache.max_staleness)
def configure(credentials, block_cache): """Helper function to actually configure GCS.""" if credentials: if isinstance(credentials, dict): credentials = json.dumps(credentials) placeholder = array_ops.placeholder(dtypes.string) op = gen_gcs_config_ops.gcs_configure_credentials(placeholder) session.run(op, feed_dict={placeholder: credentials}) if block_cache: op = gen_gcs_config_ops.gcs_configure_block_cache( max_cache_size=block_cache.max_bytes, block_size=block_cache.block_size, max_staleness=block_cache.max_staleness) session.run(op)