Skip to content

Commit 5cf7335

Browse files
author
Omar Marzouk
committed
Pool Connection Error Handling
1 parent c6dab2a commit 5cf7335

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

tensorflow_io/core/filesystems/dfs/dfs_filesystem.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ void PathExists(const TF_Filesystem* filesystem, const char* path,
217217
return;
218218
}
219219
std::string pool, cont, file;
220-
daos->Setup(path, pool, cont, file, status);
220+
rc = daos->Setup(path, pool, cont, file, status);
221+
if(rc) return;
221222
dfs_obj_t* obj;
222223
rc = daos->dfsPathExists(file, &obj);
223224
if (rc) {
@@ -665,4 +666,4 @@ void ProvideFilesystemSupportFor(TF_FilesystemPluginOps* ops, const char* uri) {
665666

666667
} // namespace dfs
667668
} // namespace io
668-
} // namespace tensorflow
669+
} // namespace tensorflow

tensorflow_io/core/filesystems/dfs/dfs_utils.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int DFS::Setup(const std::string& path, std::string& pool_string,
9696
Connect(pool_string, cont_string, allow_cont_creation, status);
9797
if (TF_GetCode(status) != TF_OK) {
9898
TF_SetStatus(status, TF_NOT_FOUND, "");
99-
return rc;
99+
return -1;
100100
}
101101
return Mount();
102102
}
@@ -351,13 +351,13 @@ int DFS::ConnectPool(std::string pool_string, TF_Status* status) {
351351
}
352352

353353
pool_info_t* po_inf = (pool_info_t*)malloc(sizeof(po_inf));
354-
po_inf->containers = new std::map<std::string, daos_handle_t>();
355-
pools[pool_string] = po_inf;
356354
rc = daos_pool_connect(pool_string.c_str(), NULL, DAOS_PC_RW, &(po_inf->poh),
357355
NULL, NULL);
358356
if (rc == 0) {
359357
pool.first = pool_string;
360358
pool.second = po_inf->poh;
359+
po_inf->containers = new std::map<std::string, daos_handle_t>();
360+
pools[pool_string] = po_inf;
361361
}
362362
return rc;
363363
}
@@ -411,4 +411,4 @@ int DFS::DisconnectContainer(std::string pool_string, std::string cont_string) {
411411
pools[pool_string]->containers->erase(cont_string);
412412
}
413413
return rc;
414-
}
414+
}

0 commit comments

Comments
 (0)