コード例 #1
0
ファイル: ProcessMonitor.C プロジェクト: bjnano/IQmol
// At this point we have submitted the job, but we need to check if it is still running
// the job should be submitted, we check that this is indeed the
// case and add the Process to our monitor.
void ProcessMonitor::jobSubmitted()
{
   if (!m_pendingProcess) {
      qDebug() << "ProcessMonitor::submitJob3() called with no pending process";
      return;
   }

   ServerTask::Base* task = qobject_cast<ServerTask::Base*>(sender());
   if (!task) {
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   QString errorMessage(task->errorMessage());
   qDebug() << "ProcessMonitor::jobSubmitted() error message" << errorMessage;
   task->deleteLater();
// if message = Process not found then we try a clean up

   if (!errorMessage.isEmpty()) {
      QString msg("Problem submitting Job:\n");
      msg += errorMessage;
      QMsgBox::warning(this, "IQmol", msg);
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   jobAccepted(); // tells the QUI window to close
   Server* server = ServerRegistry::instance().get(m_pendingProcess->serverName());
   if (server) server->startTimer();
   addToTable(m_pendingProcess);
   saveProcessList();
   m_pendingProcess = 0;
}
コード例 #2
0
ファイル: ProcessMonitor.C プロジェクト: bjnano/IQmol
// At this point we may or may not have a valid working directory in that the
// selected directory may exist and we haven't confirmed if the user wants to
// overwrite it. 
void ProcessMonitor::submitJob2()
{
   if (!m_pendingProcess) {
      qDebug() << "ProcessMonitor::submitJob2() called with no pending process";
      return;
   }

   ServerTask::Base* task = qobject_cast<ServerTask::Base*>(sender());
   if (!task) {
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   QString errorMessage(task->errorMessage());
   task->deleteLater();

   Server* server = ServerRegistry::instance().get(m_pendingProcess->serverName());

   if (errorMessage.contains("Working directory exists")) {
      if (QMsgBox::question(0, "IQmol", "Directory exists, overwrite?") == QMessageBox::Ok) {
         m_pendingProcess->jobInfo()->promptOnOverwrite(false);
      }else if (!server->getWorkingDirectoryFromUser(m_pendingProcess)) {
         delete m_pendingProcess;
         m_pendingProcess = 0;
         return;
      }
 
      task = server->setup(m_pendingProcess);
      connect(task, SIGNAL(finished()), this, SLOT(submitJob2()));
      task->start();
      return;
   }

   if (!errorMessage.isEmpty()) {
      QString msg("Problem setting up Job:\n");
      msg += errorMessage;
      QMsgBox::warning(this, "IQmol", msg);
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   // We now have a valid working directory
   postStatusMessage("Configuring options...");
   if (server->configureJob(m_pendingProcess)) {
      postStatusMessage("Submitting job...");
      task = server->submit(m_pendingProcess);
      connect(task, SIGNAL(finished()), this, SLOT(jobSubmitted()));
      task->start();
   }else {
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }
}
コード例 #3
0
ファイル: ProcessMonitor.C プロジェクト: bjnano/IQmol
void ProcessMonitor::queryFinished()
{
   ServerTask::Base* task = qobject_cast<ServerTask::Base*>(sender());
   if (!task) return;

   QString msg(task->errorMessage());
   if (msg.isEmpty()) {
      msg = task->outputMessage();
      if (msg.isEmpty()) msg = "No information available";
      QMsgBox::information(this, "IQmol", msg);
   }else {
      QMsgBox::warning(this, "IQmol", msg);
   }
   task->deleteLater();
}
コード例 #4
0
ファイル: ProcessMonitor.C プロジェクト: bjnano/IQmol
// At this point the server is connected and tested, but we still need to check
// if the test was successful.  If it is, then we can go ahead with the setup
// which starts with obtaining the working directory.
void ProcessMonitor::submitJob1()
{
   if (!m_pendingProcess) {
      qDebug() << "ProcessMonitor::submitJob1() called with no pending process";
      return;
   }

   ServerTask::Base* task = qobject_cast<ServerTask::Base*>(sender());
   if (!task) {
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   QString errorMessage(task->errorMessage());
   task->deleteLater();

   if (!errorMessage.isEmpty()) {
      QString msg("Problem submitting job:\n");
      msg += errorMessage;
      QMsgBox::warning(this, "IQmol", msg);
      delete m_pendingProcess;
      m_pendingProcess = 0;
      return;
   }

   postStatusMessage("Determining working directory...");
   Server* server = ServerRegistry::instance().get(m_pendingProcess->serverName());
   if (server->getWorkingDirectoryFromUser(m_pendingProcess)) {
      task = server->setup(m_pendingProcess);
      connect(task, SIGNAL(finished()), this, SLOT(submitJob2()));
      task->start();
   }else {
      delete m_pendingProcess;
      m_pendingProcess = 0;
   }
}