[MOAB-dev] commit/MOAB: danwu: Applied new error handling code to a few places in Core.cpp and ReadParallel.cpp, to test serial or parallel read of climate .nc files (with errors returned) later.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jul 11 15:42:28 CDT 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/796093d0ea75/
Changeset: 796093d0ea75
Branch: danwu/error_handling_enhancement
User: danwu
Date: 2014-07-11 22:20:01
Summary: Applied new error handling code to a few places in Core.cpp and ReadParallel.cpp, to test serial or parallel read of climate .nc files (with errors returned) later.
Affected #: 4 files
diff --git a/src/Core.cpp b/src/Core.cpp
index 0bd882f..01b5b9b 100644
--- a/src/Core.cpp
+++ b/src/Core.cpp
@@ -483,6 +483,7 @@ ErrorCode Core::load_file( const char* file_name,
rval = ReadParallel(this,pcomm).load_file( file_name, file_set, opts, &sl );
else
rval = ReadParallel(this,pcomm).load_file( file_name, file_set, opts );
+ CHK_ERR(rval);
#else
mError->set_last_error( "PARALLEL option not valid, this instance"
" compiled for serial execution.\n" );
@@ -494,6 +495,7 @@ ErrorCode Core::load_file( const char* file_name,
rval = serial_load_file( file_name, file_set, opts, &sl );
else
rval = serial_load_file( file_name, file_set, opts );
+ CHK_ERR(rval);
}
if (MB_SUCCESS == rval && !opts.all_seen()) {
@@ -544,8 +546,9 @@ ErrorCode Core::serial_load_file( const char* file_name,
status = stat(file_name, &stat_data);
#endif
if (status) {
- mError->set_last_error( "%s: %s", file_name, strerror(errno) );
- return MB_FILE_DOES_NOT_EXIST;
+ //mError->set_last_error( "%s: %s", file_name, strerror(errno) );
+ //return MB_FILE_DOES_NOT_EXIST;
+ SET_GLB_ERR_STR(MB_FILE_DOES_NOT_EXIST, file_name << ": " << strerror(errno));
}
#if defined(WIN32) || defined(WIN64) || defined(MSC_VER)
else if (_S_IFDIR(stat_data.st_mode)) {
@@ -608,6 +611,7 @@ ErrorCode Core::serial_load_file( const char* file_name,
if (MB_SUCCESS != rval) {
clean_up_failed_read( initial_ents, initial_tags );
+ SET_ERR(rval, "Failed to load file after trying all possible readers");
}
else if (file_set) {
Range new_ents;
diff --git a/src/Makefile.am b/src/Makefile.am
index f55d82c..bc3a8de 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,7 @@ BUILT_SOURCES = MBCN_protos.h
# Some variables
AM_CPPFLAGS += -DIS_BUILDING_MB \
+ -DLOCDIR=src/ \
-I. \
-I$(srcdir)/io \
-I$(srcdir)/io/mhdf/include \
diff --git a/src/parallel/Makefile.am b/src/parallel/Makefile.am
index b80b85e..5a39552 100644
--- a/src/parallel/Makefile.am
+++ b/src/parallel/Makefile.am
@@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = foreign
noinst_LTLIBRARIES = libMOABpar.la
# Some variables
-AM_CPPFLAGS += -DIS_BUILDING_MB -DSRCDIR=$(srcdir) \
+AM_CPPFLAGS += -DIS_BUILDING_MB -DSRCDIR=$(srcdir) -DLOCDIR=src/parallel/ \
-I$(srcdir)/.. -I.. -I$(srcdir)/../io \
-I$(srcdir)/../io/mhdf/include
diff --git a/src/parallel/ReadParallel.cpp b/src/parallel/ReadParallel.cpp
index fe4ed55..06faf6d 100644
--- a/src/parallel/ReadParallel.cpp
+++ b/src/parallel/ReadParallel.cpp
@@ -235,6 +235,7 @@ ErrorCode ReadParallel::load_file(const char **file_names,
reader_rank, cputime,
resolve_dim, shared_dim,
ghost_dim, bridge_dim, num_layers, addl_ents);
+ CHK_ERR(result);
if (parallel_mode == POPT_BCAST_DELETE && !is_reader)
opts.mark_all_seen();
@@ -519,11 +520,12 @@ ErrorCode ReadParallel::load_file(const char **file_names,
if (MB_SUCCESS != tmp_result) {
result = tmp_result;
if (myPcomm->proc_config().proc_size() != 1) {
- std::ostringstream ostr;
- ostr << "Failed in step " << ParallelActionsNames[*vit] << std::endl;
- std::string tmp_str;
- if (MB_SUCCESS == mbImpl->get_last_error(tmp_str)) ostr << tmp_str << std::endl;
- RR(ostr.str());
+ //std::ostringstream ostr;
+ //ostr << "Failed in step " << ParallelActionsNames[*vit] << std::endl;
+ //std::string tmp_str;
+ //if (MB_SUCCESS == mbImpl->get_last_error(tmp_str)) ostr << tmp_str << std::endl;
+ //RR(ostr.str());
+ SET_ERR_STR(result, "Failed in step " << ParallelActionsNames[*vit]);
}
break;
}
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list