Skip to content

Commit 9f71986

Browse files
committed
Update to use https for http file system test also registers https file system (#1357)
* Update to use https for http file system test also registers https file system The http test is failing as apache switched to use https for license page. This PR makes adjustment to fix the issue. Signed-off-by: Yong Tang <[email protected]> * Update README.md to use https Signed-off-by: Yong Tang <[email protected]>
1 parent c713e50 commit 9f71986

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ import tensorflow as tf
2424
import tensorflow_io as tfio
2525

2626
# Read the MNIST data into the IODataset.
27+
dataset_url = "https://storage.googleapis.com/cvdf-datasets/mnist/"
2728
d_train = tfio.IODataset.from_mnist(
28-
'http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz',
29-
'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz')
29+
dataset_url + "train-images-idx3-ubyte.gz",
30+
dataset_url + "train-labels-idx1-ubyte.gz",
31+
)
3032

3133
# Shuffle the elements of the dataset.
3234
d_train = d_train.shuffle(buffer_size=1024)
@@ -56,7 +58,7 @@ model.fit(d_train, epochs=5, steps_per_epoch=200)
5658

5759
In the above [MNIST](http://yann.lecun.com/exdb/mnist/) example, the URL's
5860
to access the dataset files are passed directly to the `tfio.IODataset.from_mnist` API call.
59-
This is due to the inherent support that `tensorflow-io` provides for the `HTTP` file system,
61+
This is due to the inherent support that `tensorflow-io` provides for `HTTP`/`HTTPS` file system,
6062
thus eliminating the need for downloading and saving datasets on a local directory.
6163

6264
NOTE: Since `tensorflow-io` is able to detect and uncompress the MNIST dataset automatically if needed,

tensorflow_io/core/plugins/file_system_plugins.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ limitations under the License.
1818
void TF_InitPlugin(TF_FilesystemPluginInfo* info) {
1919
info->plugin_memory_allocate = tensorflow::io::plugin_memory_allocate;
2020
info->plugin_memory_free = tensorflow::io::plugin_memory_free;
21-
info->num_schemes = 7;
21+
info->num_schemes = 8;
2222
info->ops = static_cast<TF_FilesystemPluginOps*>(
2323
tensorflow::io::plugin_memory_allocate(info->num_schemes *
2424
sizeof(info->ops[0])));
2525
tensorflow::io::az::ProvideFilesystemSupportFor(&info->ops[0], "az");
2626
tensorflow::io::http::ProvideFilesystemSupportFor(&info->ops[1], "http");
27-
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[2], "s3e");
28-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[3], "hdfse");
29-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "viewfse");
30-
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "hare");
31-
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[6], "gse");
27+
tensorflow::io::http::ProvideFilesystemSupportFor(&info->ops[2], "https");
28+
tensorflow::io::s3::ProvideFilesystemSupportFor(&info->ops[3], "s3e");
29+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[4], "hdfse");
30+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[5], "viewfse");
31+
tensorflow::io::hdfs::ProvideFilesystemSupportFor(&info->ops[6], "hare");
32+
tensorflow::io::gs::ProvideFilesystemSupportFor(&info->ops[7], "gse");
3233
}

tests/test_http_eager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, methodName="runTest"): # pylint: disable=invalid-name
2828
self.local_path = os.path.join(
2929
os.path.dirname(os.path.abspath(__file__)), "test_http", "LICENSE-2.0.txt"
3030
)
31-
self.remote_filename = "http://www.apache.org/licenses/LICENSE-2.0.txt"
31+
self.remote_filename = "https://www.apache.org/licenses/LICENSE-2.0.txt"
3232
super().__init__(methodName)
3333

3434
def setUp(self): # pylint: disable=invalid-name

0 commit comments

Comments
 (0)