X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fgenericgui%2FBL_JobsManager_QT.cxx;h=6561025bc4e38c192ad71ff9ba38526ca898e286;hb=fafdcee64180ce59122b48b01f869eb35f681b34;hp=9b53f94031aabd2f226882d4e5998782b10ab6b1;hpb=70c432982839980de6c1f8efe3a8ee0130e09c73;p=modules%2Fjobmanager.git diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 9b53f94..6561025 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D +// Copyright (C) 2009-2014 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +19,12 @@ #include "BL_JobsManager_QT.hxx" #include "BL_GenericGui.hxx" +#include + +using namespace std; + +// To tokenize a string +static void Tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters = " "); BL::JobManagerEvent::JobManagerEvent(const std::string & action_i, const std::string & event_name_i, @@ -88,6 +94,7 @@ BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::GenericGui * main_gui, scroll_widget->setWidgetResizable(true); setWidget(scroll_widget); setWindowTitle("Job Manager"); + setObjectName("JobManagerDockWidget"); } BL::JobsManager_QT::~JobsManager_QT() @@ -288,10 +295,27 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) // For all jobs new_job->setEnvFile(wizard.env_file); BL::Job::BatchParam param; - param.batch_directory = wizard.batch_directory; + + // For COORM + if (wizard.coorm_batch_directory != "") + { + param.batch_directory = wizard.coorm_batch_directory; + } + else if (wizard.batch_directory != "") + { + param.batch_directory = wizard.batch_directory; + } + param.maximum_duration = wizard.maximum_duration; - param.expected_memory = wizard.expected_memory; + param.mem_limit = wizard.mem_limit; + param.mem_req_type = wizard.mem_req_type; param.nb_proc = wizard.nb_proc; + param.exclusive = wizard.exclusive; + + // Parameters for COORM + param.launcher_file = wizard.launcher_file; + param.launcher_args = wizard.launcher_args; + new_job->setBatchParameters(param); BL::Job::FilesParam files_params; files_params.result_directory = wizard.result_directory; @@ -447,6 +471,33 @@ BL::JobsManager_QT::event(QEvent * e) write_error_text(" ***\n"); } } + else if (event->action == "get_assigned_hostnames") + { + if (event->event_name == "Ok") + { + QString str((event->job_name).c_str()); + + vector hostnames; + + Tokenize(event->data, hostnames, "+"); + + vector::iterator it; + + write_normal_text("Job " + str + " assigned hostnames are :\n"); + + for (it = hostnames.begin(); it < hostnames.end(); it++) + { + vector hostname; + Tokenize(*it, hostname, "."); + QString assigned_hostname(hostname[0].c_str()); + write_normal_text("+ " + assigned_hostname + "\n"); + } + } + else + { + // Do nothing in case the batch manager does not support this + } + } else if (event->action == "save_jobs") { if (event->event_name == "Error") @@ -522,3 +573,22 @@ BL::JobsManager_QT::write_error_text(const QString & text) _log->setTextCursor(cursor); _log->setReadOnly(true); } + +// To tokenize a string +void Tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters) +{ + // Skip delimiters at beginning. + string::size_type lastPos = str.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (string::npos != pos || string::npos != lastPos) + { + // Found a token, add it to the vector. + tokens.push_back(str.substr(lastPos, pos - lastPos)); + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = str.find_first_of(delimiters, lastPos); + } +}