Commit 03e041ce authored by vlad_burin's avatar vlad_burin
Browse files

Merge with NeuralInterfacesDebug

--HG--
branch : StandaloneRun
......@@ -463,6 +463,12 @@ int Rpc_StopChannel(int server_index, int channel_index, int timeout)
return ProcessSimpleCommand("StopChannel", server_index, channel_index, timeout, request, response);
}
int Rpc_StartTraining(int server_index, int channel_index, int timeout)
{
RDK::USerStorageXML request, response;
return ProcessSimpleCommand("StartTraining", server_index, channel_index, timeout, request, response);
}
int Rpc_GetNumChannels(int server_index, int &results, int timeout)
{
RDK::USerStorageXML request,response;
......
......@@ -85,6 +85,8 @@ int Rpc_StartChannel(int server_index, int channel_index, int timeout);
int Rpc_StopChannel(int server_index, int channel_index, int timeout);
int Rpc_StartTraining(int server_index, int channel_index, int timeout);
int Rpc_ResetChannel(int server_index, int channel_index, int timeout);
int Rpc_GetNumChannels(int server_index, int &results, int timeout);
......
......@@ -213,3 +213,15 @@ void RdkQTcpClientWidget::onPushButtonPingClick()
std::cerr<<"onPushButtonTestClick sum: "<<sum;
}
*/
void RdkQTcpClientWidget::on_pushButtonStartTraining_clicked()
{
const char* serverAnswer=NULL;
int res=Rpc_StartTraining(0, ui->lineEditChannelIndex->text().toInt(), 60000);
if(WriteLogError(res))
{
serverAnswer=Rpc_GetServerAnswerDebug(0);
if(serverAnswer != NULL && ui->checkBoxWriteServerResponse->isChecked())
ui->plainTextEditLog->appendPlainText(QString(serverAnswer));
}
}
......@@ -40,6 +40,8 @@ private slots:
void onPushButtonLoadConfigClick();
void on_pushButtonStartTraining_clicked();
private:
Ui::RdkQTcpClientWidget *ui;
std::map<int, QString> Errors;
......
......@@ -183,6 +183,13 @@
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButtonStartTraining">
<property name="text">
<string>Start Training</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxWriteServerResponse">
<property name="cursor">
......
This diff is collapsed.
......@@ -111,6 +111,12 @@ enum DatabaseTaskStatus
TS_Error=1000
};
enum TemplateType
{
TT_VideoAnalytics=1,
TT_NeuralInterface=2
};
class RDK_LIB_TYPE UProjectDeployProcessingThread: public QThread
{
Q_OBJECT
......@@ -124,6 +130,7 @@ public:
void SetDatabasePath(const QString& path);
void SetDownloadTempPath(const QString& path);
void SetFtpRemoteBasePath(const QString& path);
void SetStorageMountPath(const QString& path);
void SetDeploymentState(const DeploymentState& state);
void SetDeploymentProgress(const int &progress);
void SetDeploymentProgressCap(const int &value);
......@@ -154,12 +161,19 @@ private:
bool UnpackZipFolder(const QString &local_zip_folder, const QString& local_dst_folder);
bool UnpackZipFile(const QString &local_zip_folder, const QString& local_dst_folder);
bool RecursiveCopyFiles(const QString& src_dir_path, const QString& dst_dir_path);
void DeployTemplate();
void DeployTemplate2();
void DeployDirectory(const QString& file_with_template);
bool VerifyTemplate();
void DeployScript2();
void DeployScript();
bool VerifyScript();
void DeployWeights2();
void DeployWeights();
bool VerifyWeights();
void DeployData2();
void DeployData();
bool VerifyData();
......@@ -171,6 +185,7 @@ private:
QString databasePath;
QString ftpRemoteBasePath;
QString downloadTempPath;
QString storageMountPath;
bool template_dr, weights_dr, script_dr, videosource_dr;
int videosource_type;
......@@ -182,7 +197,7 @@ private:
QProcess zip_process;
std::string lastError;
QString lastError;
CURL *curl;
CURLcode res;
......@@ -210,15 +225,21 @@ public:
void SetRemoteFtpPath(const QString& ftp_path);
QString GetRemoteFtpPath();
void SetRemoteStoragePath(const QString& strg_path);
QString GetRemoteStoragePath();
QString GetLastError();
DeploymentState GetUploadState();
private:
bool CopyResultsToDestinationDir();
bool ZipResults();
bool UploadResultsViaFtp();
bool RecursiveCopyFiles(const QString& src_dir_path, const QString& dts_dir_path);
bool CopyResultsToDestinationDir();
bool CopyResultsToRemoteStorageDir();
bool RecursiveCopyFiles(const QString& src_dir_path, const QString& dst_dir_path);
private slots:
void processReadyReadStandardError();
......@@ -229,6 +250,7 @@ private:
QString storageResultsDir;
QString databasePath;
QString remoteFtpPath;
QString remoteStoragePath;
QString lastError;
DeploymentState uploadState;
......@@ -238,47 +260,6 @@ private:
};
class RDK_LIB_TYPE UProjectRunThread: public QThread
{
Q_OBJECT
public:
UProjectRunThread(UProjectDeployer* deployer);
~UProjectRunThread();
void run() override;
std::string GetLastError();
int GetCalcState();
private:
UProjectDeployer* Deployer;
std::string error_string;
int calc_state;
private:
/// :
/// 1.
/// 2. ?
/// 3.
int PrepProject(std::string &response);
///
int OpenProject(std::string &response);
///
int RunProject();
///
int FinishProject();
};
class RDK_LIB_TYPE UProjectDeployerQt: public UProjectDeployer
{
friend class UApplication;
......@@ -380,14 +361,16 @@ std::map<std::string, CaptureLibDescr> capture_tags;
std::string capture_class_name;
std::string capture_component_name;
std::string predictor_class_name;
std::string predictor_component_name;
//
QDateTime processing_start_datetime;
QDateTime processing_end_datetime;
UProjectResultsUploadingThread *projectResultsUploadingThread;
// standalone ( )
int serverStandaloneTask;
TemplateType template_type;
protected://
......@@ -399,9 +382,6 @@ public: //
/// , ( )
virtual int StartProjectDeployment(int deploy_task_id);
/// , ( ) ( )
virtual int StartProjectRun(int task_id);
/// :
/// 1.
/// 2. ?
......@@ -437,6 +417,11 @@ virtual int GetCalculationState();
/// @state -
/// @frame_id -
virtual bool GetCaptureState(int &state, unsigned long long& frame_id, unsigned long long& max_frame_id);
bool GetCaptureStateVideoAnalysis(int &state, unsigned long long& frame_id, unsigned long long& max_frame_id);
bool GetCaptureStateNeuralInterface(int &state, unsigned long long& frame_id, unsigned long long& max_frame_id);
///
/// false , true
/// @error -
......@@ -454,11 +439,6 @@ virtual int GetUploadState();
///
virtual void UpdateTaskStateInDb(int task_id, const DatabaseTaskStatus &status, float progress=-1.0f, const QString &start_time="", const QString& end_time="");
///
virtual void SetStandaloneTask(int task);
virtual int GetStandaloneTask();
public: //
///
......@@ -481,6 +461,12 @@ int CopyProjectToTempFolder();
int OpenProjectMockMode();
///
int SetupProjectMockParameters();
/// (, , )
int SetupProjectMockParametersVideoAnalysis();
/// , .. -.
int SetupProjectMockParametersNeuralInterface();
///
int CloseMockProject();
///
......
......@@ -153,6 +153,7 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
databaseMainPath=projectIniFile("General","DatabaseMainPath","");
remoteFtpDatabasePath=projectIniFile("General","RemoteFtpDatabasePath","");
if(startupDelay>0)
{
RDK::Sleep(startupDelay);
......@@ -173,6 +174,7 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
std::string database_login = projectIniFile("PostgreSQL","DatabaseLogin","");
std::string database_password = projectIniFile("PostgreSQL","DatabasePassword","");
std::string storageMountPoint = projectIniFile("Storage","StorageMountPoint","");
application.SetApplicationFileName(application_file_name);
application.SetLogCreationMode(logCreationMode);
......@@ -216,6 +218,9 @@ int UAppCore<ApplicationT, EngineControlT, ProjectT, ServerControlT, TestManager
return returnCode;
}
if(storageMountPoint!="")
application.SetStorageMountPoint(storageMountPoint);
if(databaseMainPath!="")
{
application.SetDatabaseMainPath(databaseMainPath);
......
......@@ -135,6 +135,21 @@ bool UApplication::SetDatabaseMainPath(const std::string &value)
return true;
}
/// ( /Bin/Configs)
const std::string& UApplication::GetStorageMountPoint(void) const
{
return StorageMountPoint;
}
bool UApplication::SetStorageMountPoint(const std::string &value)
{
if(StorageMountPoint == value)
return true;
StorageMountPoint=value;
return true;
}
/// ( /Bin/Models)
const std::string& UApplication::GetModelsMainPath(void) const
{
......@@ -1350,7 +1365,7 @@ bool UApplication::OpenProject(const std::string &filename)
bool is_loaded(false);
if(!ProjectXml.LoadFromFile(filename,""))
{
MLog_LogMessage(RDK_SYS_MESSAGE,RDK_EX_ERROR, (std::string("Can't read project file ")+filename).c_str());
MLog_LogMessage(RDK_SYS_MESSAGE,RDK_EX_WARNING, (std::string("Can't read project file ")+filename).c_str());
return false;
}
......
......@@ -56,6 +56,9 @@ std::string LibrariesPath;
/// ( /Database)
std::string DatabaseMainPath;
///
std::string StorageMountPoint;
/// ( /Bin/Models)
std::string ModelsMainPath;
......@@ -173,6 +176,9 @@ bool SetConfigsMainPath(const std::string &value);
const std::string& GetDatabaseMainPath(void) const;
bool SetDatabaseMainPath(const std::string &value);
const std::string& GetStorageMountPoint(void) const;
bool SetStorageMountPoint(const std::string &value);
/// ( - MockLibs, RTLibs)
const std::string& GetLibrariesPath(void) const;
bool SetLibrariesPath(const std::string &value);
......
......@@ -116,6 +116,11 @@ bool URpcDecoderCommon::IsCmdSupported(const UEPtr<URpcCommand> &command) const
return true;
}
else
if(cmd == "StartTraining")
{
return true;
}
else
if(cmd == "RegisterMetadataReceiver")
{
return true;
......@@ -365,6 +370,13 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
return_value=0;
}
else
if(cmd == "StartTraining")
{
std::stringstream ss;
Model_SetComponentPropertyValue("TPyClassifierTrainer", "StartTraining", "1");
return_value=0;
}
else
if(cmd == "RegisterMetadataReceiver")
{
string address=xml.ReadString("Address","");
......@@ -449,7 +461,9 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
if(cmd=="OpenPreparedProject")
{
std::string resp="";
std::cerr<<"Open prepared project!\n";
int rs = GetApplication()->GetProjectDeployer()->OpenPreparedProject(resp);
std::cerr<<"Project opened successful!\n";
response=resp;
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