Commit f04750e9 authored by Aivan_2008's avatar Aivan_2008
Browse files

Several deployment/error handling fixes

--HG--
branch : DeploymentQt
parent 90169ce4e27f
......@@ -536,15 +536,21 @@ int Rpc_GetDeploymentState(int server_index, int &dp_state, int& dp_progress, i
dp_cap = -1;
last_error = "Wrong dep state data received";
static std::string le_string;
// qDebug()<<"rs_str = "<<rs_str;
if(rs_str.size()>0)
{
QStringList rs_split = rs_str.split("|");
QStringList rs_split = rs_str.split("|-|");
if(rs_split.size()>=4)
{
dp_state = rs_split[0].toInt();
dp_progress = rs_split[1].toInt();
dp_cap = rs_split[2].toInt();
last_error = rs_split[3].toUtf8().constData();
qDebug()<<"rs_split[3] = "<<rs_split[3];
qDebug()<<"rs_split[3].toUtf8().constData() = "<<rs_split[3].toUtf8().constData();
le_string = rs_split[3].toUtf8().constData();
last_error = le_string.c_str();
}
}
......@@ -627,10 +633,13 @@ int Rpc_GetPreparationResult(int server_index, const char* &verbose_response, in
res_string=response.ReadString("Data", "").c_str();
static std::string msg="";
QString qs = res_string.c_str();
QStringList spl = qs.split("|");
QStringList spl = qs.split("|-|");
int rs = spl[0].trimmed().toInt();
verbose_response = spl[1].toUtf8().constData();
msg = spl[1].toUtf8().constData();
verbose_response = msg.c_str();
if(res)
return res;
......@@ -658,6 +667,7 @@ int Rpc_GetCalculationState(int server_index,
{
RDK::USerStorageXML request,response;
int res = ProcessSimpleCommand("GetCalculationState", server_index, -1, timeout, request, response);
static std::string s="";
if(res==0)
{
......@@ -666,7 +676,7 @@ int Rpc_GetCalculationState(int server_index,
qDebug()<<qsl;
if(qsl.length()>0)
{
QStringList spl = qsl.split("|");
QStringList spl = qsl.split("|-|");
if(spl.size()==5)
{
calculation_state = spl[0].toInt();
......@@ -674,11 +684,12 @@ int Rpc_GetCalculationState(int server_index,
capture_frid = spl[2].toInt();
capture_maxfrid = spl[3].toInt();
QString msg = spl[4];
message = msg.toUtf8().constData();
s = msg.toUtf8().constData();
message = s.c_str();
}
else
{
std::string s = "Wrong result: '" + res_string + "'";
s = "Wrong result: '" + res_string + "'";
message = s.c_str();
}
}
......@@ -695,14 +706,17 @@ int Rpc_FinishCalculation(int server_index, bool& result, const char* &last_erro
res_string=response.ReadString("Data", "").c_str();
static std::string le="";
if(res_string!="")
{
QString qs = res_string.c_str();
QStringList spl = qs.split("|");
QStringList spl = qs.split("|-|");
if(spl.size()>=2)
{
result = spl[0].trimmed().toInt();
last_error = spl[1].toUtf8().constData();
le = spl[1].toUtf8().constData();
last_error = le.c_str();
}
}
return res;
......@@ -720,7 +734,7 @@ int Rpc_UploadCalculationResults(int server_index, bool& result, const char* &la
if(res_string!="")
{
QString qs = res_string.c_str();
QStringList spl = qs.split("|");
QStringList spl = qs.split("|-|");
if(spl.size()>=2)
{
result = spl[0].trimmed().toInt();
......@@ -743,7 +757,7 @@ int Rpc_GetUploadState(int server_index, int& upload_state, const char* &last_er
if(res_string!="")
{
QString qs = res_string.c_str();
QStringList spl = qs.split("|");
QStringList spl = qs.split("|-|");
if(spl.size()>=2)
{
upload_state = spl[0].trimmed().toInt();
......@@ -767,7 +781,7 @@ int Rpc_CloseSolver(int server_index, bool& result, const char* &last_error, int
if(res_string!="")
{
QString qs = res_string.c_str();
QStringList spl = qs.split("|");
QStringList spl = qs.split("|-|");
if(spl.size()>=2)
{
result = spl[0].trimmed().toInt();
......
......@@ -1416,7 +1416,7 @@ int UProjectDeployerQt::StartProjectDeployment(int deploy_task_id)
this->deploymentState = DS_DeployFinished;
}
lastError = "";
//lastError = "";
return 0;
}
......@@ -1468,7 +1468,7 @@ enum DeploymentState
std::string UProjectDeployerQt::GetLastError()
{
std::string le = "";
std::string le = "zero le test";
if(lastError!="")
{
le = std::string("UProjectDeployerQt lastError=")+lastError+std::string(" ");
......@@ -1550,7 +1550,7 @@ int UProjectDeployerQt::GetStageProgress()
/// 3.
int UProjectDeployerQt::PrepareProject(std::string &response)
{
lastError="";
//lastError="";
if(this->deploymentState!=DS_DeployFinished)
{
response = "Project deployment is not opened, can't start preparations";
......@@ -1676,6 +1676,7 @@ int UProjectDeployerQt::OpenPreparedProject(std::string &response)
QString project_path = pdpath+"/"+task_template_file_name;
if(!Application->OpenProject(project_path.toUtf8().constData()))
{
deploymentState = DS_Error;
lastError="UApplication OpenProject normally error";
response = lastError;
return 1;
......@@ -1684,6 +1685,7 @@ int UProjectDeployerQt::OpenPreparedProject(std::string &response)
if(AnalyzeLogForErrors(response)>=0)
{
lastError=response;
deploymentState = DS_Error;
return 1;
}
////
......@@ -1909,6 +1911,14 @@ int UProjectDeployerQt::SetupProjectMockParameters()
if(file_tags[class_name].LibClassCountTagName!="")
nn_ClassCount = neural_cont->AccessPropertyData<int>(file_tags[class_name].LibClassCountTagName.c_str());
bool *nn_UseFullPath=NULL;
if(file_tags[class_name].LibClassCountTagName!="")
nn_UseFullPath = neural_cont->AccessPropertyData<bool>(file_tags[class_name].LibUseFullPathTagName.c_str());
if(nn_UseFullPath!=NULL)
*nn_UseFullPath = true;
*nn_Activity = true;
if(file_tags[class_name].LibScriptFileTagName!="")
*nn_ScriptFile = absolute_script_file.toUtf8().constData();
......
......@@ -27,12 +27,14 @@ struct MLlibDescr
std::string LibWeightFileTagName; //
std::string LibConfigFileTagName; //
std::string LibClassCountTagName; //
std::string LibUseFullPathTagName; //
MLlibDescr(){
LibName="";
LibScriptFileTagName="";
LibWeightFileTagName="";
LibConfigFileTagName="";
LibClassCountTagName="";
LibUseFullPathTagName = "UseFullPath";// ,
}
};
......
......@@ -416,7 +416,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
std::string le = GetApplication()->GetProjectDeployer()->GetLastError();
std::stringstream ss;
ss<<d_state<<"|"<<stage_pos<<"|"<<stage_max<<"|"<<le;
ss<<d_state<<"|-|"<<stage_pos<<"|-|"<<stage_max<<"|-|"<<le;
response=ss.str();
return_value=0;//UServerControlForm->SaveProject();
}
......@@ -441,7 +441,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
std::string resp="";
int rs = GetApplication()->GetProjectDeployer()->GetPreparationResult(resp);
std::stringstream ss;
ss<<rs<<"|"<<resp.c_str();
ss<<rs<<"|-|"<<resp.c_str();
response=ss.str();
return_value=0;
}
......@@ -468,7 +468,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
/*std::string resp="";
int rs = GetApplication()->GetProjectDeployer()->GetPreparationResult(resp);
std::stringstream ss;
ss<<rs<<"|"<<resp.c_str();
ss<<rs<<"|-|"<<resp.c_str();
response=ss.str();*/
// :
//"<calculation_state>|<capture_state>|<capture_frid>|<capture_maxfrid>|<capture_finished>|<message>"
......@@ -481,9 +481,11 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
// -
///
/// -1 -
/// 0 -
/// 1 -
/// 2 - ,
/// 3 -
int calc_state = GetApplication()->GetProjectDeployer()->GetCalculationState();
if(calc_state>=0)
{
......@@ -494,6 +496,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
if(!process_log_res)
{
message = "Log error: "+log_err;
calculation_state = 3;
}
else
{
......@@ -536,7 +539,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
}
std::stringstream res_ss;
res_ss<<calculation_state<<"|"<<capture_state<<"|"<<capture_frid<<"|"<<capture_maxfrid<<"|"<<message.c_str();
res_ss<<calculation_state<<"|-|"<<capture_state<<"|-|"<<capture_frid<<"|-|"<<capture_maxfrid<<"|-|"<<message.c_str();
response = res_ss.str();
return_value=0;
}
......@@ -546,7 +549,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
bool rs = GetApplication()->GetProjectDeployer()->FinishCalculation();
std::string le = GetApplication()->GetProjectDeployer()->GetLastError();
std::stringstream ss;
ss<<rs<<"|"<<le;
ss<<rs<<"|-|"<<le;
response = ss.str();
return_value=0;
}
......@@ -556,7 +559,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
bool rs = GetApplication()->GetProjectDeployer()->UploadCalculationResults();
std::string le = GetApplication()->GetProjectDeployer()->GetLastError();
std::stringstream ss;
ss<<rs<<"|"<<le;
ss<<rs<<"|-|"<<le;
response = ss.str();
return_value=0;
}
......@@ -566,7 +569,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
int us = GetApplication()->GetProjectDeployer()->GetUploadState();
std::string le = GetApplication()->GetProjectDeployer()->GetLastError();
std::stringstream ss;
ss<<us<<"|"<<le;
ss<<us<<"|-|"<<le;
response = ss.str();
return_value=0;
}
......@@ -576,7 +579,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
bool rs = GetApplication()->GetProjectDeployer()->CloseSolver();
std::string le = GetApplication()->GetProjectDeployer()->GetLastError();
std::stringstream ss;
ss<<rs<<"|"<<le;
ss<<rs<<"|-|"<<le;
response = ss.str();
exit(0);
return_value=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment