Merge pull request #39124 from vnvo2409:s3_filesystem_windows

PiperOrigin-RevId: 310176310
Change-Id: Ie3650cbb3edbfd5ade0fce213f8469cef4941c6f
This commit is contained in:
TensorFlower Gardener 2020-05-06 10:23:04 -07:00
commit 4823ee3dc1
7 changed files with 53 additions and 6 deletions

View File

@ -658,7 +658,9 @@ def tf_additional_core_deps():
clean_dep("//tensorflow:android"): [],
clean_dep("//tensorflow:ios"): [],
clean_dep("//tensorflow:linux_s390x"): [],
clean_dep("//tensorflow:windows"): [],
clean_dep("//tensorflow:windows"): [
clean_dep("//tensorflow/core/platform/s3:s3_file_system"),
],
clean_dep("//tensorflow:no_aws_support"): [],
"//conditions:default": [
clean_dep("//tensorflow/core/platform/s3:s3_file_system"),

View File

@ -81,7 +81,12 @@ cc_library(
hdrs = [
"s3_file_system.h",
],
deps = [
deps = select({
"@org_tensorflow//tensorflow:windows": [
"//tensorflow/core/platform:retrying_file_system",
],
"//conditions:default": [],
}) + [
":aws_crypto",
":aws_logging",
"//tensorflow/core:lib",

View File

@ -48,6 +48,13 @@ limitations under the License.
namespace tensorflow {
namespace {
#ifdef PLATFORM_WINDOWS
// On Windows, `Aws::FileSystem::CreateTempFilePath()` return
// `C:\Users\username\AppData\Local\Temp\`. Adding template will cause an error.
static const char* kS3TempFileTemplate = nullptr;
#else
static const char* kS3TempFileTemplate = "/tmp/s3_filesystem_XXXXXX";
#endif
static const char* kS3FileSystemAllocationTag = "S3FileSystemAllocation";
static const size_t kS3ReadAppendableFileBufferSize = 1024 * 1024;
static const int64 kS3TimeoutMsec = 300000; // 5 min
@ -271,7 +278,7 @@ class S3WritableFile : public WritableFile {
transfer_manager_(transfer_manager),
sync_needed_(true),
outfile_(Aws::MakeShared<Aws::Utils::TempFile>(
kS3FileSystemAllocationTag, "/tmp/s3_filesystem_XXXXXX",
kS3FileSystemAllocationTag, kS3TempFileTemplate,
std::ios_base::binary | std::ios_base::trunc | std::ios_base::in |
std::ios_base::out)) {}

View File

@ -232,7 +232,7 @@ TEST_F(S3FileSystemTest, HasAtomicMove) {
const string fname = TmpDir("HasAtomicMove");
TF_ASSERT_OK(WriteString(fname, "test"));
bool has_atomic_move = true;
TF_EXPECT_OK(s3fs.NeedsTempLocation(fname, &has_atomic_move).code());
TF_EXPECT_OK(s3fs.HasAtomicMove(fname, &has_atomic_move));
EXPECT_EQ(has_atomic_move, false);
}

View File

@ -31,6 +31,14 @@ cc_library(
"aws-cpp-sdk-core/source/platform/linux-shared/*.cpp",
]),
"//conditions:default": [],
}) + select({
"//conditions:default": glob([
"aws-cpp-sdk-core/source/net/linux-shared/*.cpp",
]),
"@org_tensorflow//tensorflow:windows": glob([
"aws-cpp-sdk-core/source/platform/windows/*.cpp",
"aws-cpp-sdk-core/source/net/windows/*.cpp",
]),
}) + glob([
"aws-cpp-sdk-core/include/**/*.h",
"aws-cpp-sdk-core/source/*.cpp",
@ -59,7 +67,6 @@ cc_library(
"aws-cpp-sdk-transfer/include/**/*.h",
"aws-cpp-sdk-transfer/source/**/*.cpp",
"aws-cpp-sdk-core/source/monitoring/*.cpp",
"aws-cpp-sdk-core/source/net/linux-shared/*.cpp",
"aws-cpp-sdk-core/source/utils/memory/*.cpp",
"aws-cpp-sdk-core/source/utils/crypto/openssl/*.cpp",
]),
@ -94,6 +101,11 @@ cc_library(
"ENABLE_CURL_CLIENT",
"OPENSSL_IS_BORINGSSL",
],
"@org_tensorflow//tensorflow:windows": [
"PLATFORM_WINDOWS",
"ENABLE_CURL_CLIENT",
"OPENSSL_IS_BORINGSSL",
],
"//conditions:default": [],
}),
includes = [
@ -101,6 +113,13 @@ cc_library(
"aws-cpp-sdk-s3/include/",
"aws-cpp-sdk-transfer/include/",
],
linkopts = select({
"@org_tensorflow//tensorflow:windows": [
"-DEFAULTLIB:Userenv.lib",
"-DEFAULTLIB:Version.lib",
],
"//conditions:default": [],
}),
deps = [
"@aws-c-common",
"@aws-c-event-stream",

View File

@ -28,6 +28,9 @@ cc_library(
"@org_tensorflow//tensorflow:raspberry_pi_armeabi": glob([
"source/posix/*.c",
]),
"@org_tensorflow//tensorflow:windows": glob([
"source/windows/*.c",
]),
"//conditions:default": [],
}) + glob([
"source/*.c",
@ -38,6 +41,12 @@ cc_library(
"include/**/*.h",
"include/aws/common/**/*.inl"
]),
linkopts = select({
"@org_tensorflow//tensorflow:windows": [
"-DEFAULTLIB:BCrypt.lib",
],
"//conditions:default": [],
}),
includes = [
"include/",
],

View File

@ -9,7 +9,12 @@ exports_files(["LICENSE"])
cc_library(
name = "aws-checksums",
srcs = glob([
srcs = select({
"@org_tensorflow//tensorflow:windows": glob([
"source/visualc/*.c",
]),
"//conditions:default": [],
}) + glob([
"source/intel/*.c",
"source/*.c",
]),