Skip to content

Commit

Permalink
Code review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Joaquin Anton <[email protected]>
  • Loading branch information
jantonguirao committed Apr 22, 2024
1 parent 1996a01 commit 684aaee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dali/operators/reader/loader/discover_files_s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ std::vector<FileLabelEntry> s3_discover_files(const std::string &file_root,
assert(path_elems >= 2);
if (path_elems > 2)
return; // we only look at one subdir level
auto subdir = *(p.begin());
auto fname = *(++p.begin());
const auto& subdir = p.begin()->native();
const auto& fname = (++p.begin())->native();
bool subdir_ok = opts.dir_filters.empty();
bool fname_ok = opts.file_filters.empty();
for (auto &filter : opts.dir_filters) {
Expand Down
4 changes: 4 additions & 0 deletions dali/util/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ std::unique_ptr<FileStream> FileStream::Open(const std::string& uri, FileStream:
bool is_s3 = uri.rfind("s3://", 0) == 0;
if (is_s3) {
#if AWSSDK_ENABLED
if (opts.use_mmap)
throw std::invalid_argument("use_mmap not supported");
if (opts.use_odirect)
throw std::invalid_argument("use_odirect not supported");
return std::make_unique<S3FileStream>(S3ClientManager::Instance().client(), uri, size);
#else
throw std::runtime_error("This version of DALI was not built with AWS S3 storage support.");
Expand Down
7 changes: 3 additions & 4 deletions dali/util/s3_client_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ struct S3ClientManager {

private:
// Documentation says:
// 1) Please call this from the same thread from which InitAPI() has been called (use a dedicated
// thread
// if necessary). This avoids problems in initializing the dependent Common RunTime C
// libraries.
// Please call this from the same thread from which InitAPI() has been called (use a dedicated
// thread if necessary). This avoids problems in initializing the dependent Common RunTime C
// libraries.
static void RunInitOrShutdown(std::function<void(int)> work) {
static ThreadPool s_thread_pool_(1, 0, false, "S3ClientManager");
s_thread_pool_.AddWork(std::move(work));
Expand Down

0 comments on commit 684aaee

Please sign in to comment.