Ejemplo n.º 1
0
int MoleQueueWidget::submitJobRequest()
{
  m_submissionError.clear();
  m_jobState = "Unknown";
  m_requestId = -1;
  m_moleQueueId = InvalidMoleQueueId;

  MoleQueueManager &mqManager = MoleQueueManager::instance();
  if (!mqManager.connectIfNeeded())
    return -1;

  MoleQueue::JobObject job(configuredJob());
  if (job.queue().isEmpty()) // if the queue is not set, the job config failed.
    return -1;

  m_requestId = mqManager.client().submitJob(job);
  if (m_requestId >= 0) {
    listenForJobSubmitReply();
    listenForJobStateChange();
  }
  else {
    m_submissionError = tr("Client failed to submit job to MoleQueue.");
    // Single shot ensures that this signal is emitted after control returns
    // to the event loop
    QTimer::singleShot(0, this, SIGNAL(jobSubmitted(false)));
  }
  return m_requestId;
}
Ejemplo n.º 2
0
void MoleQueueWidget::onSubmissionSuccess(int localId, unsigned int mqId)
{
  if (localId != m_requestId)
    return;

  listenForJobSubmitReply(false);
  m_moleQueueId = mqId;
  emit jobSubmitted(true);
}
Ejemplo n.º 3
0
// 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;
   }
}
Ejemplo n.º 4
0
void MoleQueueWidget::onSubmissionFailure(int localId, unsigned int,
                                          const QString &error)
{
  if (localId != m_requestId)
    return;

  listenForJobSubmitReply(false);
  m_submissionError = error;
  emit jobSubmitted(false);
}