Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Aug 3, 2020
2 parents 04bac2b + f17f20f commit 08f7d67
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 17 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/libs/common/config_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CONFIG_OS_H_


#define PESTPP_VERSION "4.3.19";
#define PESTPP_VERSION "4.3.20";

#if defined(_WIN32) || defined(_WIN64)
#define OS_WIN
Expand Down
14 changes: 14 additions & 0 deletions src/libs/pestpp_common/OutputFileWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@ void OutputFileWriter::scenario_report(std::ostream &os, bool report_mode)
{
mode = "regularization (with a \"z\")";
}*/

os << endl << " This software has been approved for release by the" << endl;
os << " U.S.Geological Survey(USGS).Although the software has " << endl;
os << " been subjected to rigorous review, the USGS reserves the" << endl;
os << " right to update the software as needed pursuant to further" << endl;
os << " analysisand review.No warranty, expressed or implied, is " << endl;
os << " made by the USGS or the U.S.Government as to the" << endl;
os << " functionality of the softwareand related material nor shall" << endl;
os << " the fact of release constitute any such warranty." << endl;
os << " Furthermore, the software is released on condition that" << endl;
os << " neither the USGS nor the U.S.Government shall be held" << endl;
os << " liable for any damages resulting from its authorized " << endl;
os << " or unauthorized use." << endl << endl;

switch (pest_scenario.get_control_info().pestmode)
{
case ControlInfo::PestMode::ESTIMATION:
Expand Down
39 changes: 27 additions & 12 deletions src/libs/run_managers/abstract_base/model_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,13 @@ void InstructionFile::throw_ins_error(const string& message, int ins_lnum, int o
{
stringstream ss;
if (warn)
ss << "InstructionFile warning in " << ins_filename;
ss << "InstructionFile warning in '" << ins_filename << "'";
else
ss << "InstructionFile error in file " << ins_filename;
ss << "InstructionFile error in file '" << ins_filename << "'";
if (ins_lnum != 0)
ss << " on line: " << ins_lnum;
ss << " on instruction file line: " << ins_lnum;
if (out_lnum != 0)
ss << " on output file line: " << out_lnum;
ss << ", on output file line: " << out_lnum;
ss << " : " << message;
if (warn)
cout << endl << ss.str() << endl;
Expand Down Expand Up @@ -1069,7 +1069,7 @@ pair<string, pair<int, int>> InstructionFile::parse_obs_instruction(const string
}
catch (...)
{
throw_ins_error("error casting first index '" + temp.substr(0, pos) + "' from (semi-)fixed observation instruction '" + token + "'");
throw_ins_error("error casting first index '" + temp.substr(0, pos) + "' from (semi-)fixed observation instruction '" + token + "'", ins_line_num);
}
try
{
Expand All @@ -1078,7 +1078,7 @@ pair<string, pair<int, int>> InstructionFile::parse_obs_instruction(const string
}
catch (...)
{
throw_ins_error("error casting second index '" + temp.substr(pos) + "' from observation instruction '" + token + "'");
throw_ins_error("error casting second index '" + temp.substr(pos) + "' from (semi)-fixed observation instruction '" + token + "'");
}
pair<int, int> se(s-1, e-1);
return pair<string, pair<int, int>>(name,se);
Expand All @@ -1104,12 +1104,17 @@ pair<string, double> InstructionFile::execute_fixed(const string& token, string&
}
catch (...)
{
throw_ins_error("error casting fixed observation '" + token + "' from output string '" + temp + "'");
throw_ins_error("error casting fixed observation instruction '" + token + "' from output string '" + temp + "' on line '" + line + "'",ins_line_num, out_line_num);
}
int pos = line.find(temp);
if (pos == string::npos)
throw_ins_error("internal error: string t: '"+temp+"' not found in line: '"+line+"'",ins_line_num,out_line_num);
if ((value != 0.0) && (!isnormal(value)))
{
throw_ins_error("casting '" + temp + "' to double yielded denormal value on line '" + line + "' for fixed observation instruction '" + token + "'", ins_line_num, out_line_num);
}
line = line.substr(pos + temp.size());

return pair<string, double>(info.first,value);
}

Expand All @@ -1129,9 +1134,9 @@ pair<string, double> InstructionFile::execute_semi(const string& token, string&
int len = (info.second.second - info.second.first) + 1;
int pos = last_out_line.find_first_not_of(", \t\n\r"+additional_delimiters, info.second.first); //include the comma here for csv files
if (pos == string::npos)
throw_ins_error("EOL encountered when looking for non-whitespace char in semi-fixed instruction '" + token + "'",ins_line_num,out_line_num);
throw_ins_error("EOL encountered when looking for non-whitespace char in semi-fixed instruction '" + token + "' on line: '" + line + "'",ins_line_num,out_line_num);
if (pos > info.second.second)
throw_ins_error("no non-whitespace char found before end index in semi-fixed instruction '" + token + "'", ins_line_num,out_line_num);
throw_ins_error("no non-whitespace char found before end index in semi-fixed instruction '" + token + "' on line: '" + line + "'", ins_line_num,out_line_num);
pest_utils::tokenize(last_out_line.substr(pos), tokens);
temp = tokens[0];
try
Expand All @@ -1141,11 +1146,15 @@ pair<string, double> InstructionFile::execute_semi(const string& token, string&
}
catch (...)
{
throw_ins_error("error casting string '" + temp + "' to double for semi-fixed instruction", ins_line_num, out_line_num);
throw_ins_error("error casting string '" + temp + "' to double for semi-fixed instruction '" + token + "' on line: '" + line + "'", ins_line_num, out_line_num);
}
pos = line.find(temp);
if (pos == string::npos)
throw_ins_error("internal error: temp '" + temp + "' not found in line: '" + line + "'", ins_line_num, out_line_num);
if ((value != 0.0) && (!isnormal(value)))
{
throw_ins_error("casting '" + temp + "' to double yielded denormal value for semi-fixed instruction '" + token + "' on line: '" + line + "'", ins_line_num, out_line_num);
}
line = line.substr(pos + temp.size());
return pair<string, double>(info.first,value);
}
Expand All @@ -1155,7 +1164,7 @@ pair<string, double> InstructionFile::execute_free(const string& token, string&
vector<string> tokens;
pest_utils::tokenize(line, tokens,", \t\n\r" + additional_delimiters) ; //include the comma in the delimiters here
if (tokens.size() == 0)
throw_ins_error("error tokenizing output line ('"+last_out_line+"') for instruction '"+token+"' on line: " +last_ins_line, ins_line_num, out_line_num);
throw_ins_error("error tokenizing output line ('"+last_out_line+"') for free instruction '"+token+"' on line: " +last_ins_line, ins_line_num, out_line_num);
double value;
try
{
Expand All @@ -1164,14 +1173,18 @@ pair<string, double> InstructionFile::execute_free(const string& token, string&
}
catch (...)
{
throw_ins_error("error converting '" + tokens[0] + "' to double on output line '" + last_out_line + "' for instruciton '"+token+"'", ins_line_num, out_line_num);
throw_ins_error("error converting '" + tokens[0] + "' to double on output line '" + last_out_line + "' for free instruciton: '"+token+"'", ins_line_num, out_line_num);
}
string name = token.substr(1, token.size() - 2);
int pos = line.find(tokens[0]);
if (pos == string::npos)
{
throw_ins_error("internal error: could not find free obs token '"+tokens[0]+"'", ins_line_num, out_line_num);
}
if ((value != 0.0) && (!isnormal(value)))
{
throw_ins_error("casting '" + tokens[0] + "' to double yielded denormal value for free instruction: '" + token + "' on line: '" + line + "'", ins_line_num, out_line_num);
}
line = line.substr(pos + tokens[0].size());

return pair<string, double>(name,value);
Expand Down Expand Up @@ -1260,6 +1273,8 @@ void InstructionFile::execute_line_advance(const string& token, string& line, if
int num;
//pest_utils::convert_ip(token.substr(1), num);
num = stoi(token.substr(1));
if (num < 1)
throw_ins_error("line advance instruction error: number of lines must be greater or equal to 1, not '" + token.substr(1) + "'",ins_line_num,out_line_num);
for (int i = 0; i < num; i++)
{
if (f_out.bad())
Expand Down
17 changes: 13 additions & 4 deletions src/libs/run_managers/yamr/PantherAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "Pest.h"
#include "config_os.h"
#include "pest_data_structs.h"

using namespace pest_utils;

Expand Down Expand Up @@ -504,8 +505,7 @@ void PANTHERAgent::start_impl(const string &host, const string &port)
if (err.first == -999)
{
ss.str("");
ss << "error receiving message from master: " << err.second << " , terminating, header follows:";
net_pack.print_header(ss);
ss << "error receiving message from master: " << err.second << " , terminating";
report(ss.str(), true);
//terminate = true;
net_pack.reset(NetPackage::PackType::CORRUPT_MESG, 0, 0, "recv security message error");
Expand Down Expand Up @@ -872,8 +872,17 @@ void PANTHERAgent::start_impl(const string &host, const string &port)
report(ss.str(), true);
serialized_data = Serialization::serialize(pars, par_name_vec, obs, obs_name_vec, run_time);
ss.str("");
ss << "debug loop returning ctl obs for run_id, group_id: " << run_id << "," << group_id;
net_pack.reset(NetPackage::PackType::RUN_FINISHED, group_id, run_id, ss.str());
double rd = ((double)rand() / (double)RAND_MAX);
if (rd < 0.1)
{
ss << "debug loop returning failed run for: " << run_id << "," << group_id;
net_pack.reset(NetPackage::PackType::RUN_FAILED, group_id, run_id, ss.str());
}
else
{
ss << "debug loop returning ctl obs for run_id, group_id: " << run_id << "," << group_id;
net_pack.reset(NetPackage::PackType::RUN_FINISHED, group_id, run_id, ss.str());
}
err = send_message(net_pack, serialized_data.data(), serialized_data.size());
if (err.first != 1)
{
Expand Down

0 comments on commit 08f7d67

Please sign in to comment.