void RenderAf::wolWake( MonitorContainer * i_monitoring, const std::string & i_msg) { if( i_msg.size()) appendLog( i_msg); if( isOnline()) { appendLog("Can't wake up online render."); return; } if( isWOLFalling()) { appendLog("Can't wake up render which is just falling a sleep."); return; } if( m_netIFs.size() < 1) { appendLog("Can't perform Wake-On-Line operations. No network interfaces information."); return; } appendLog("Sending WOL wake request."); setWOLWaking( true); m_wol_operation_time = time( NULL); store(); if( i_monitoring ) i_monitoring->addEvent( af::Monitor::EVT_renders_change, m_id); std::ostringstream str; v_jsonWrite( str, af::Msg::TRendersList); SysJob::AddWOLCommand( str.str(), "", m_name, m_name); }
void RenderAf::setRegistered() { getFarmHost(); if( isFromStore()) { appendLog("Initialized from store."); } else { m_time_register = time( NULL); setStoreDir( AFCommon::getStoreDirRender( *this)); store(); appendLog("Registered."); } af::Client::setRegisterTime(); m_task_start_finish_time = 0; m_wol_operation_time = 0; m_idle_time = time(NULL); m_busy_time = m_idle_time; if( isOnline()) appendLog("Registered online."); else appendLog("Registered offline."); }
void qfit::startFitClicked() { if(filePath->text().isEmpty()) { appendLog("Select a file to open!"); return; } double error = -1; // retrive error from the QLineEdit if(customError->isChecked()) { error = errorValue->text().toDouble(); if(error <= 0.0) { appendLog("Custom error is not valid, a default one of 1.0 will be used"); error = 1; } } if(Data::ReadFile(filePath->text().toLatin1().data(), xdata, ydata, yerrors, error)) { appendLog("Error opening file"); return; } // start fittools delete fit; if(error <= 0) fit = new FitTools(xdata, ydata, yerrors, fit_type); else fit = new FitTools(xdata, ydata, error, fit_type); fit->Fit(); printResult(); #ifdef Qwt6_FOUND plotData(); #endif }
void MultiShot::updateLog( bool start ) { QString prefix; QString suffix; if( start ) { prefix = "start "; suffix = " (" + QString::number( shotSeq->frames ); if( shotSeq->frames == 1 ) suffix += " image)"; else suffix += " images)"; } else { prefix = "end "; suffix = ""; } switch( shotSeq->type ) { case ShotSeq::ExposureBracketingManual: case ShotSeq::ExposureBracketingAv: appendLog( prefix + "exposure bracketing" + suffix ); break; case ShotSeq::FocusBracketing: appendLog( prefix + "focus bracketing" + suffix ); break; case ShotSeq::Interval: appendLog( prefix + "interval shooting" + suffix ); break; case ShotSeq::Stitch: appendLog( prefix + "panorama shooting" + suffix ); break; } }
void RenderAf::offline( JobContainer * jobs, uint32_t updateTaskState, MonitorContainer * monitoring, bool toZombie ) { setOffline(); setBusy( false); if( isWOLFalling()) { setWOLFalling( false); setWOLSleeping( true); } if( jobs && updateTaskState) ejectTasks( jobs, monitoring, updateTaskState); // There is need to send pending tasks to offline render. m_re.clearTaskExecs(); appendLog( m_hres.v_generateInfoString()); if( toZombie ) { AFCommon::QueueLog("Render Deleting: " + v_generateInfoString( false)); appendLog("Waiting for deletion."); setZombie(); // AFCommon::saveLog( getLog(), af::Environment::getRendersDir(), m_name); if( monitoring ) monitoring->addEvent( af::Monitor::EVT_renders_del, m_id); } else { AFCommon::QueueLog("Render Offline: " + v_generateInfoString( false)); appendLog("Offline."); m_time_launch = 0; if( monitoring ) monitoring->addEvent( af::Monitor::EVT_renders_change, m_id); store(); } }
void qfit::changeFitType(int state) { switch(state) { case FitTools::LINEAR_FIT: fit_type = FitTools::LINEAR_FIT; appendLog("Fit Linear set"); break; case FitTools::SLOPE_FIT: fit_type = FitTools::SLOPE_FIT; appendLog("Fit Slope set"); break; case FitTools::HORIZONTAL_FIT: fit_type = FitTools::HORIZONTAL_FIT; appendLog("Fit Horizontal set"); break; case FitTools::EXPONENTIAL_FIT: fit_type = FitTools::EXPONENTIAL_FIT; appendLog("Fit Exponential set"); break; case FitTools::LOGARITHMIC_FIT: fit_type = FitTools::LOGARITHMIC_FIT; appendLog("Fit Logarithmic set"); break; } }
void LuaCore::setUi(Lua4RSWidget *ui) { _ui = ui; QObject::connect(this, SIGNAL(appendLog(QString)), _ui, SLOT(appendLog(QString))); QObject::connect(this, SIGNAL(appendOutput(QString)), _ui, SLOT(appendOutput(QString))); QObject::connect(this, SIGNAL(clearOutput()), _ui, SLOT(clearOutput())); }
void JobAf::deleteNode( RenderContainer * renders, MonitorContainer * monitoring) { if( m_id == AFJOB::SYSJOB_ID ) { AFCommon::QueueLogError("System job can't be zombie"); return; } if( m_deletion == false ) { m_state = AFJOB::STATE_OFFLINE_MASK; lock(); m_deletion = true; if( m_custom_data.size() || m_user->getCustomData().size()) { std::vector<std::string> events; events.push_back("JOB_DELETED"); emitEvents(events); } if( getRunningTasksNumber() && (renders != NULL) && (monitoring != NULL)) { restartAllTasks("Job deletion.", renders, monitoring, AFJOB::STATE_RUNNING_MASK); if( monitoring ) monitoring->addJobEvent( af::Monitor::EVT_jobs_change, getId(), getUid()); return; } } if( getRunningTasksNumber() ) { AF_ERR << "runningtaskscounter = " << getRunningTasksNumber(); return; } if( false == m_command_post.empty()) { SysJob::AddPostCommand( m_command_post, m_blocks_num > 0 ? m_blocks_data[0]->getWDir(): "", m_user_name, m_name); appendLog( std::string("Executing job post command:\n") + m_command_post); } for( int b = 0; b < m_blocks_num; b++) { if( m_blocks_data[b]->hasCmdPost()) { SysJob::AddPostCommand( m_blocks_data[b]->getCmdPost(), m_blocks_data[b]->getWDir(), m_user_name, m_name); appendLog( std::string("Executing block[") + m_blocks_data[b]->getName() + "] post command:\n" + m_blocks_data[b]->getCmdPost()); } } setZombie(); AFCommon::DBAddJob( this); if( monitoring ) monitoring->addJobEvent( af::Monitor::EVT_jobs_del, getId(), getUid()); AFCommon::QueueLog("Deleting a job: " + v_generateInfoString()); unLock(); }
void RenderAf::deregister( JobContainer * jobs, MonitorContainer * monitoring ) { if( isOffline()) { appendLog("Render deregister request - offline already."); return; } appendLog("Render deregister request."); offline( jobs, af::TaskExec::UPRenderDeregister, monitoring); }
void Task::refresh( time_t currentTime, RenderContainer * renders, MonitorContainer * monitoring, int & errorHostId) { //printf("Task::refresh:\n"); bool changed = false; // forgive error hosts if(( false == errorHosts.empty() ) && ( block->getErrorsForgiveTime() > 0 )) { std::list<std::string>::iterator hIt = errorHosts.begin(); std::list<int>::iterator cIt = errorHostsCounts.begin(); std::list<time_t>::iterator tIt = errorHostsTime.begin(); while( hIt != errorHosts.end() ) if( currentTime - *tIt > block->getErrorsForgiveTime()) { appendLog( std::string("Forgived error host \"") + *hIt + "\" since " + af::time2str(*tIt) + "."); hIt = errorHosts.erase( hIt); cIt = errorHostsCounts.erase( cIt); tIt = errorHostsTime.erase( tIt); } else { hIt++; cIt++; tIt++; } } if( renders != NULL ) { if( run ) changed = run->refresh( currentTime, renders, monitoring, errorHostId); else { // Retry errors: if((progress->state & AFJOB::STATE_ERROR_MASK) && (progress->errors_count <= block->getErrorsRetries())) { progress->state = progress->state | AFJOB::STATE_READY_MASK; progress->state = progress->state & (~AFJOB::STATE_ERROR_MASK); appendLog( std::string("Automatically retrying error task") + af::itos( progress->errors_count) + " of " + af::itos( block->getErrorsRetries()) + "."); if( changed == false) changed = true; } } } if( changed) { monitor( monitoring); updateDatabase(); } deleteRunningZombie(); }
void BranchSrv::logAction(const Action & i_action, const std::string & i_node_name) { if (i_action.log.empty()) return; appendLog(std::string("Action[") + i_action.type + "][" + i_node_name + "]: " + i_action.log); }
void MultiShot::stopButtonClicked() { appendLog( "sequence cancelled" ); emit cancelSequence(); //finishSeq(); }
void Client::countSend(qint64 written) { const qint64 now=QDateTime::currentMSecsSinceEpoch(); if(mLastSendTime<=0) { mLastSendTime=now-1; } const qint64 delta=now-mLastSendTime; mLastSendTime=now; mDeltaTime=delta/1000.0f; mTimeoutAccumulator += mDeltaTime; if (mConnected && ( mTimeoutAccumulator > TIMEOUT_TRESHOLD )) { qDebug()<<"CLIENT "<< mSignature.toString() <<" timed out"; mConnected=false; } if(mConnected) { mReliabilitySystem.update(mDeltaTime); mRlowControl.update( mDeltaTime, mReliabilitySystem.roundTripTime() * 1000.0f ); } if(mConnected!=mLastConnected) { mLastConnected=mConnected; mRlowControl.reset(); appendLog("CLIENT: New flow state: " +QString(mConnected?"CONNECTED":"DISCONNECTED")+ " for "+mSignature.toString()); } mReliabilitySystem.packetSent(written); }
void KeyFile::readHead(KeyFileHeader &header, bool log) { read(0, &header, sizeof(KeyFileHeader)); if(log && isBackLogged()) { appendLog(0, &header, sizeof(KeyFileHeader)); } }
int qfit::printResult() { stringstream sout; fit->printResult(sout); appendLog(sout.str().c_str()); return 0; }
void Simulator::init(Project &prj, BodyFactory &factory){ initWorld(prj, factory, *this, pairs); initRTS(prj, receivers); std::cout << "number of receivers:" << receivers.size() << std::endl; m_totalTime = prj.totalTime(); m_logTimeStep = prj.logTimeStep(); m_kinematicsOnly = prj.kinematicsOnly(); OpenHRP::CollisionSequence& collisions = state.collisions; collisions.length(pairs.size()); for(size_t colIndex=0; colIndex < pairs.size(); ++colIndex){ hrp::ColdetLinkPairPtr linkPair = pairs[colIndex]; hrp::Link *link0 = linkPair->link(0); hrp::Link *link1 = linkPair->link(1); OpenHRP::LinkPair& pair = collisions[colIndex].pair; pair.charName1 = CORBA::string_dup(link0->body->name().c_str()); pair.charName2 = CORBA::string_dup(link1->body->name().c_str()); pair.linkName1 = CORBA::string_dup(link0->name.c_str()); pair.linkName2 = CORBA::string_dup(link1->name.c_str()); } m_nextLogTime = 0; appendLog(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), // m_parseHtml(new ParseHtml), m_httpDownload(new HttpDownload()) { ui->setupUi(this); ui->progressBar->setValue(0); // QThread* thread = new QThread; // m_httpDownload->moveToThread(thread); // thread->start(); connect(ui->downloadBtn, SIGNAL(clicked()), this, SLOT(startDownload())); connect(m_httpDownload, SIGNAL(updateDownloadProgressbar(qint64, qint64)), this, SLOT(updateProgressbar(qint64, qint64))); connect(m_httpDownload, SIGNAL(outputLog(QString)), this, SLOT(appendLog(QString))); connect(m_httpDownload, SIGNAL(htmlCount(int)), this, SLOT(updateHtmlCount(int))); connect(m_httpDownload, SIGNAL(imgCount(int)), this, SLOT(updateImgCount(int))); // connect(m_parseHtml, SIGNAL(updateLog(QStringList)), // this, SLOT(appendLog(QStringList))); // connect(m_parseHtml, SIGNAL(downloadImg(QString)), // this, SLOT(downloadImg(QString))); // connect(m_parseHtml, SIGNAL(updateCount(int)), // this, SLOT(updateCount(int))); }
UserAf::UserAf( const std::string & username, const std::string & host): afsql::DBUser( username, host), AfNodeSrv( this) { construct(); appendLog("Registered from job."); }
BranchSrv::BranchSrv(BranchSrv * i_parent, const std::string & i_path): af::Branch(i_path), m_parent(i_parent), AfNodeSolve(this) { appendLog("Created from job."); }
UserAf::UserAf( int uid): afsql::DBUser( uid), AfNodeSrv( this) { construct(); appendLog("Registered from database."); }
void BranchSrv::addBranch(BranchSrv * i_branch) { appendLog(std::string("Adding a branch: ") + i_branch->getName()); m_branches_list.add(i_branch); m_branches_num++; }
void BranchSrv::removeBranch(BranchSrv * i_branch) { appendLog(std::string("Removing a branch: ") + i_branch->getName()); m_branches_list.remove(i_branch); m_branches_num--; }
void UserAf::v_setZombie( MonitorContainer * i_monitoring) { AFCommon::QueueLog("Deleting user: "******"Became a zombie."); AFCommon::saveLog( getLog(), af::Environment::getUsersLogsDir(), m_name, af::Environment::getAfNodeLogsRotate()); }
void UserAf::removeJob( JobAf * i_job) { appendLog( std::string("Removing a job: ") + i_job->getName()); m_jobslist.remove( i_job ); m_jobs_num--; }
void MainWindow::processDriverRawData(const QByteArray& data) { QSettings settings; if(settings.value("comm/debug/showRawComData").toBool()) { QString msg = SIMessageData::dumpData(data); appendLog(qf::core::Log::LOG_DEB, trUtf8("DriverRawData: %1").arg(msg)); } }
void UserAf::logAction( const Action & i_action, const std::string & i_node_name) { if( i_action.log.empty()) return; appendLog( std::string("Action[") + i_action.type + "][" + i_node_name + "]: " + i_action.log); updateTimeActivity(); }
UserAf::UserAf( JSON & i_object): afsql::DBUser(), AfNodeSrv( this) { jsonRead( i_object); construct(); appendLog("Registered."); }
void UserAf::deleteNode( MonitorContainer * i_monitoring) { AFCommon::QueueLog("Deleting user: "******"Became a zombie."); setZombie(); if( i_monitoring ) i_monitoring->addEvent( af::Monitor::EVT_users_del, m_id); }
void MainWindow::processSIMessage(const SIMessageData& msg_data) { qfLogFuncFrame(); //appendLog(qf::core::Log::LOG_INFO, trUtf8("processSIMessage command: %1 , type: %2").arg(SIMessageData::commandName(msg_data.command())).arg(msg_data.type())); if(msg_data.type() == SIMessageData::MsgCardReadOut) { SIMessageCardReadOut msg(msg_data); appendLogPre(qf::core::Log::LOG_DEB, msg.dump()); appendLog(qf::core::Log::LOG_INFO, trUtf8("card: %1").arg(msg.cardNumber())); /* SICliScriptDriver *drv = theApp()->scriptDriver(); try { QVariantList args; args << msg.toVariant(); QScriptValue sv = drv->callExtensionFunction("onCardReadOut", args); QString ret_type = sv.property("retType").toString(); if(ret_type == "error") { QString err = sv.property("error").toString(); /// tady by to melo zacit vriskat appendLog(qf::core::Log::LOG_ERR, sv.property("message").toString()); } else if(ret_type == "info") { //QString info = sv.property("info").toString(); appendLog(qf::core::Log::LOG_INFO, sv.property("message").toString()); } } catch(std::exception &e) { appendLog(qf::core::Log::LOG_ERR, e.what()); } catch(...) { appendLog(qf::core::Log::LOG_ERR, tr("Unknown exception")); } */ } else if(msg_data.type() == SIMessageData::MsgCardEvent) { appendLogPre(qf::core::Log::LOG_DEB, msg_data.dump()); if(msg_data.command() == SIMessageData::CmdSICard5DetectedExt) { QByteArray data(1, 0); data[0] = 0; emit sendSICommand(SIMessageData::CmdGetSICard5Ext, data); } else if(msg_data.command() == SIMessageData::CmdSICard6DetectedExt) { QByteArray data(2, 0); data[0] = 1; data[1] = 8; emit sendSICommand(SIMessageData::CmdGetSICard6Ext, data); } else if(msg_data.command() == SIMessageData::CmdSICard8AndHigherDetectedExt) { QByteArray data(2, 0); data[0] = 1; data[1] = 8; emit sendSICommand(SIMessageData::CmdGetSICard8Ext, data); } } else { appendLogPre(qf::core::Log::LOG_DEB, msg_data.dump()); } }
void UIYabause::errorReceived( const QString& error, bool internal ) { if ( internal ) { appendLog( error.toLocal8Bit().constData() ); } else { CommonDialogs::information( error ); } }