Reputation: 3624
If I want to access Google bucket files using python during training job on Google Machine Learning engine (not locally). What is the correct approach from the following choices (if any)?
use the built in open(filePath) python function where filePath is valid google bucket path e.i. 'gs://bucket/folder/file.ext'
use the Python Client for Google Cloud Storage
https://pypi.python.org/pypi/google-cloud-storage
the first choice is clearly much easier, if it is valid, does it requires special set up such as: setting specific bucket permissions or default storage class.
best regards.
Upvotes: 0
Views: 561
Reputation: 3624
Neither this or this. One should use the tensorflow Gfile module as follow:
import tensorflow as tf
with tf.gfile.GFile("gs://bucket/file", "r") as f:
content = f.read()
Upvotes: 2