Skip to content

Commit

Permalink
Raise an exception if remote open fails (#4069)
Browse files Browse the repository at this point in the history
Raise an exception if remote open fails
  • Loading branch information
eisenhauer authored Mar 7, 2024
1 parent d447870 commit 269f1f7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
45 changes: 34 additions & 11 deletions source/adios2/engine/bp5/BP5Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,36 @@ std::pair<double, double> BP5Reader::ReadData(adios2::transportman::TransportMan

void BP5Reader::PerformGets()
{
// if dataIsRemote is true and m_Remote is not true, this is our first time through
// PerformGets() Either we don't need a remote open (m_dataIsRemote=false), or we need to Open
// remote file (or die trying)
if (m_dataIsRemote && !m_Remote)
{
bool RowMajorOrdering = (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor);

// If nothing is pending, don't open
if (m_BP5Deserializer->PendingGetRequests.size() == 0)
return;

if (!m_Parameters.RemoteDataPath.empty())
{
m_Remote.Open("localhost", RemoteCommon::ServerPort, m_Parameters.RemoteDataPath,
m_OpenMode, RowMajorOrdering);
}
else if (getenv("DoRemote"))
{
m_Remote.Open("localhost", RemoteCommon::ServerPort, m_Name, m_OpenMode,
RowMajorOrdering);
}
if (!m_Remote)
{
helper::Throw<std::ios_base::failure>(
"Engine", "BP5Reader", "OpenFiles",
"Remote file " + m_Name +
" cannot be opened. Possible server or file specification error.");
}
}

if (m_Remote)
{
PerformRemoteGets();
Expand Down Expand Up @@ -477,18 +507,11 @@ void BP5Reader::Init()
OpenFiles(timeoutInstant, pollSeconds, timeoutSeconds);
UpdateBuffer(timeoutInstant, pollSeconds / 10, timeoutSeconds);

// This isn't how we'll trigger remote ops in the end, but a temporary
// solution
bool RowMajorOrdering = (m_IO.m_ArrayOrder == ArrayOrdering::RowMajor);
// Don't try to open the remote file when we open local metadata. Do that on demand.
if (!m_Parameters.RemoteDataPath.empty())
{
m_Remote.Open("localhost", RemoteCommon::ServerPort, m_Parameters.RemoteDataPath,
m_OpenMode, RowMajorOrdering);
}
else if (getenv("DoRemote"))
{
m_Remote.Open("localhost", RemoteCommon::ServerPort, m_Name, m_OpenMode, RowMajorOrdering);
}
m_dataIsRemote = true;
if (getenv("DoRemote"))
m_dataIsRemote = true;
}

void BP5Reader::InitParameters()
Expand Down
1 change: 1 addition & 0 deletions source/adios2/engine/bp5/BP5Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class BP5Reader : public BP5Engine, public Engine

/* transport manager for managing the active flag file */
transportman::TransportMan m_ActiveFlagFileManager;
bool m_dataIsRemote = false;
Remote m_Remote;
bool m_WriterIsActive = true;
adios2::profiling::JSONProfiler m_JSONProfiler;
Expand Down
1 change: 0 additions & 1 deletion thirdparty/EVPath/EVPath/cmsockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ initiate_conn(CManager cm, CMtrans_services svc, transport_entry trans, attr_lis
int err = WSAGetLastError();
if (err != WSAEWOULDBLOCK || err != WSAEINPROGRESS) {
#endif
printf("Errno was %d\n", errno);
svc->trace_out(cm, "CMSocket connect FAILURE --> Connect() to IP %s failed", ip_str);
close(sock);
#ifdef WSAEWOULDBLOCK
Expand Down

0 comments on commit 269f1f7

Please sign in to comment.