MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetChildren

Method GetChildren

tensorflow/core/platform/hadoop/hadoop_file_system.cc:388–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388Status HadoopFileSystem::GetChildren(const string& dir,
389 std::vector<string>* result) {
390 result->clear();
391 hdfsFS fs = nullptr;
392 TF_RETURN_IF_ERROR(Connect(dir, &fs));
393
394 // hdfsListDirectory returns nullptr if the directory is empty. Do a separate
395 // check to verify the directory exists first.
396 FileStatistics stat;
397 TF_RETURN_IF_ERROR(Stat(dir, &stat));
398
399 int entries = 0;
400 hdfsFileInfo* info =
401 hdfs_->hdfsListDirectory(fs, TranslateName(dir).c_str(), &entries);
402 if (info == nullptr) {
403 if (stat.is_directory) {
404 // Assume it's an empty directory.
405 return Status::OK();
406 }
407 return IOError(dir, errno);
408 }
409 for (int i = 0; i < entries; i++) {
410 result->push_back(string(io::Basename(info[i].mName)));
411 }
412 hdfs_->hdfsFreeFileInfo(info, entries);
413 return Status::OK();
414}
415
416Status HadoopFileSystem::GetMatchingPaths(const string& pattern,
417 std::vector<string>* results) {

Callers 1

TEST_FFunction · 0.45

Calls 6

StatClass · 0.85
IOErrorFunction · 0.85
BasenameFunction · 0.85
c_strMethod · 0.80
clearMethod · 0.45
push_backMethod · 0.45

Tested by 1

TEST_FFunction · 0.36