Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to dynamic loader even if HADOOP_HDFS_HOME is not defined #19336

Merged
merged 2 commits into from
Jun 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions tensorflow/core/platform/hadoop/hadoop_file_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,17 @@ class LibHDFS {
const char* kLibHdfsDso = "libhdfs.so";
#endif
char* hdfs_home = getenv("HADOOP_HDFS_HOME");
if (hdfs_home == nullptr) {
status_ = errors::FailedPrecondition(
"Environment variable HADOOP_HDFS_HOME not set");
return;
}
string path = io::JoinPath(hdfs_home, "lib", "native", kLibHdfsDso);
status_ = TryLoadAndBind(path.c_str(), &handle_);
if (!status_.ok()) {
// try load libhdfs.so using dynamic loader's search path in case
// libhdfs.so is installed in non-standard location
status_ = TryLoadAndBind(kLibHdfsDso, &handle_);
if (hdfs_home != nullptr) {
string path = io::JoinPath(hdfs_home, "lib", "native", kLibHdfsDso);
status_ = TryLoadAndBind(path.c_str(), &handle_);
if (status_.ok()) {
return;
}
}

// Try to load the library dynamically in case it has been installed
// to a in non-standard location.
status_ = TryLoadAndBind(kLibHdfsDso, &handle_);
}

Status status_;
Expand Down