# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(idefix)
+PROJECT(ydefx)
SET (CMAKE_CXX_STANDARD 11)
ENABLE_TESTING()
SET(BUILD_SHARED_LIBS TRUE)
+OPTION(YDEFX_BUILD_GUI "Generate widgets" ON)
+
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
IF(EXISTS ${CONFIGURATION_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
ENDIF()
FIND_PACKAGE(Py2cpp REQUIRED)
+IF(YDEFX_BUILD_GUI)
+ FIND_PACKAGE(Qt5Widgets CONFIG REQUIRED)
+ENDIF(YDEFX_BUILD_GUI)
+
SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install Python files")
ADD_SUBDIRECTORY(src)
#
ADD_SUBDIRECTORY(cpp)
ADD_SUBDIRECTORY(pydefx)
+IF(YDEFX_BUILD_GUI)
+ ADD_SUBDIRECTORY(gui)
+ENDIF(YDEFX_BUILD_GUI)
ADD_LIBRARY(ydefx ${ydefx_SOURCES})
TARGET_LINK_LIBRARIES(ydefx ${ydefx_LINK})
TARGET_INCLUDE_DIRECTORIES(ydefx PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cpp>
$<INSTALL_INTERFACE:include>)
INSTALL(TARGETS ydefx DESTINATION lib)
in_files(newList);
}
+void JobParametersProxy::remove_in_file(const std::string& path)
+{
+ std::list<std::string> newList = in_files();
+ newList.remove(path);
+ in_files(newList);
+}
+
void JobParametersProxy::in_files(const std::list<std::string>& pathList)
{
_pyParameters.getAttr("salome_parameters")
pyFn(basePath);
}
+std::list<std::string> JobParametersProxy::AvailableResources()
+{
+ std::list<std::string> result;
+ py2cpp::PyFunction pyFn;
+ pyFn.loadExp("pydefx.configuration", "availableResources");
+ py2cpp::pyResult(result) = pyFn();
+
+ return result;
+}
+
}
std::string job_name()const;
void job_name(const std::string& v);
-
+
std::string job_type()const;
void job_type(const std::string& v);
-
+
std::string job_file()const;
void job_file(const std::string& v);
-
+
std::string pre_command()const;
void pre_command(const std::string& v);
-
+
std::string env_file()const;
void env_file(const std::string& v);
-
+
std::list<std::string> in_files()const;
void add_in_files(const std::list<std::string>& pathList);
+ void remove_in_file(const std::string& path);
void in_files(const std::list<std::string>& pathList);
std::string work_directory()const;
void work_directory(const std::string& v);
-
+
std::string local_directory()const;
void local_directory(const std::string& v);
-
+
std::string result_directory()const;
void result_directory(const std::string& v);
-
+
std::string maximum_duration()const;
void maximum_duration(const std::string& v);
-
+
// ResourceParameters
std::string resource_name()const;
void resource_name(const std::string& name);
int nb_proc()const;
void nb_proc(int v);
-
+
int mem_mb()const;
void mem_mb(int v);
-
+
int nb_node()const;
void nb_node(int v);
-
+
int nb_proc_per_node()const;
void nb_proc_per_node(int v);
-
+
std::string queue()const;
void queue(const std::string& v);
-
+
std::string partition()const;
void partition(const std::string& v);
-
+
bool exclusive()const;
void exclusive(bool v);
-
+
unsigned int mem_per_cpu()const;
void mem_per_cpu(unsigned int v);
-
+
std::string wckey()const;
void wckey(const std::string& v);
-
+
std::string extra_params()const;
void extra_params(const std::string& v);
-
+
unsigned int nb_branches()const;
void nb_branches(unsigned int v);
-
+
/*!
* Set the resource and the default values associated with that resource:
* work_directory, nb_branches, nb_proc and wckey.
void configureResource(const std::string& resourceName);
//! create a new result directory as a subdirectory of the given path.
void createResultDirectory(const std::string& basePath);
+
friend PyObject * py2cpp::toPy(const JobParametersProxy& jp);
+ static std::list<std::string> AvailableResources();
private:
py2cpp::PyPtr _pyParameters;
{
Py_Initialize();
{
+ std::list<std::string> resources = ydefx::JobParametersProxy::AvailableResources();
+ CPPUNIT_ASSERT(resources.size() > 0);
+
ydefx::JobParametersProxy jobParams;
jobParams.configureResource("localhost");
jobParams.createResultDirectory("/tmp");
--- /dev/null
+# Copyright (C) 2019 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, 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#INCLUDE(UseQtExt)
+#INCLUDE_DIRECTORIES(
+# ${QT_INCLUDES}
+# ${PROJECT_SOURCE_DIR}/src/cpp
+#)
+
+#ADD_DEFINITIONS(
+# ${QT_DEFINITIONS}
+# ${GUI_DEFINITIONS}
+# ${PYTHON_DEFINITIONS}
+#)
+SET(CMAKE_AUTOMOC ON)
+
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/cpp)
+
+SET(YDEFX_SOURCES
+ ResourceWidget.cxx
+ ParamsConfig.cxx
+ PathsConfig.cxx
+ QuickConfig.cxx
+)
+
+SET(YDEFX_HEADERS
+ ResourceWidget.hxx
+)
+
+SET(YDEFX_link_LIBRARIES
+ Qt5::Widgets
+ ydefx
+)
+
+ADD_LIBRARY(ydefxgui ${YDEFX_SOURCES})
+TARGET_LINK_LIBRARIES(ydefxgui ${YDEFX_link_LIBRARIES})
+TARGET_INCLUDE_DIRECTORIES(ydefxgui PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/gui>
+ $<INSTALL_INTERFACE:include>)
+
+ADD_EXECUTABLE(ydefxgui.exe ydefxgui.cxx)
+TARGET_LINK_LIBRARIES(ydefxgui.exe ydefxgui)
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "ParamsConfig.hxx"
+
+ParamsConfigWidget::ParamsConfigWidget(ydefx::JobParametersProxy& model,
+ QWidget* parent)
+: QScrollArea(parent)
+, _model(model)
+{
+ QWidget* mainWidget = new QWidget();
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainWidget->setLayout(mainLayout);
+
+ QLabel *label;
+ QSpinBox *editSpin;
+ QHBoxLayout *hLayout;
+ QLineEdit *editLine;
+ mainLayout->addWidget(new QLabel(tr(
+ "Use 0 or empty fields for default or unspecified values."
+ )));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Number of cores:"));
+ editSpin = new QSpinBox();
+ editSpin->setRange(1, 10000);
+ editSpin->setValue(_model.nb_proc());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editSpin);
+ mainLayout->addLayout(hLayout);
+ connect(this, SIGNAL(defaultNbBranches(int)),
+ editSpin, SLOT(setValue(int)));
+ connect(editSpin, SIGNAL(valueChanged(int)),
+ this, SLOT(updateNbCores(int)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Number of nodes:"));
+ editSpin = new QSpinBox();
+ editSpin->setRange(0, 10000);
+ editSpin->setValue(_model.nb_node());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editSpin);
+ mainLayout->addLayout(hLayout);
+ connect(editSpin, SIGNAL(valueChanged(int)),
+ this, SLOT(updateNbNodes(int)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Maximum memory (MB):"));
+ editSpin = new QSpinBox();
+ editSpin->setRange(0, 1000000);
+ editSpin->setValue(_model.mem_mb());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editSpin);
+ mainLayout->addLayout(hLayout);
+ connect(editSpin, SIGNAL(valueChanged(int)),
+ this, SLOT(updateMemory(int)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Memory per CPU (MB):"));
+ editSpin = new QSpinBox();
+ editSpin->setRange(0, 10000);
+ editSpin->setValue(_model.mem_per_cpu());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editSpin);
+ mainLayout->addLayout(hLayout);
+ connect(editSpin, SIGNAL(valueChanged(int)),
+ this, SLOT(updateMemoryPerCPU(int)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Maximum duration (\"hh:mm\"):"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.maximum_duration().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateDuration(const QString&)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Queue:"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.queue().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateQueue(const QString&)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Partition:"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.partition().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updatePartition(const QString&)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("WcKey:"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.wckey().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(this, SIGNAL(defaultWcKey(const QString&)),
+ editLine, SLOT(setText(const QString&)));
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateWckey(const QString&)));
+
+ QCheckBox * exclusiveCheckBox = new QCheckBox(tr("Exclusive"));
+ exclusiveCheckBox->setChecked(_model.exclusive());
+ mainLayout->addWidget(exclusiveCheckBox);
+ connect(exclusiveCheckBox, SIGNAL(stateChanged(int)),
+ this, SLOT(updateExclusive(int)));
+
+ label = new QLabel(tr("Extra parameters:"));
+ mainLayout->addWidget(label);
+ _extraEdit = new QTextEdit;
+ mainLayout->addWidget(_extraEdit);
+ connect(_extraEdit, SIGNAL(textChanged()),
+ this, SLOT(updateExtraParams()));
+
+// mainLayout->addStretch();
+ setWidget(mainWidget);
+ setWidgetResizable (true);
+}
+
+ParamsConfigWidget::~ParamsConfigWidget()
+{
+}
+
+void ParamsConfigWidget::updateNbCores(int value)
+{
+ _model.nb_proc(value);
+}
+
+void ParamsConfigWidget::updateNbNodes(int value)
+{
+ _model.nb_node(value);
+}
+
+void ParamsConfigWidget::updateMemory(int value)
+{
+ _model.mem_mb(value);
+}
+
+void ParamsConfigWidget::updateMemoryPerCPU(int value)
+{
+ _model.mem_per_cpu(value);
+}
+
+void ParamsConfigWidget::updateDuration(const QString& value)
+{
+ _model.maximum_duration(value.toStdString());
+}
+
+void ParamsConfigWidget::updateQueue(const QString& value)
+{
+ _model.queue(value.toStdString());
+}
+
+void ParamsConfigWidget::updatePartition(const QString& value)
+{
+ _model.partition(value.toStdString());
+}
+
+void ParamsConfigWidget::updateWckey(const QString& value)
+{
+ _model.wckey(value.toStdString());
+}
+
+void ParamsConfigWidget::updateExclusive(int value)
+{
+ _model.exclusive(Qt::Checked == value);
+}
+
+void ParamsConfigWidget::updateExtraParams()
+{
+ _model.extra_params(_extraEdit->toPlainText().toStdString());
+}
+
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef IDEFX_ParamsConfigWidget_HXX
+#define IDEFX_ParamsConfigWidget_HXX
+#include "JobParametersProxy.hxx"
+#include <QtWidgets>
+
+class ParamsConfigWidget: public QScrollArea
+{
+ Q_OBJECT
+public:
+ ParamsConfigWidget(ydefx::JobParametersProxy& model, QWidget* parent=0);
+ virtual ~ParamsConfigWidget();
+
+public slots:
+ void updateNbCores(int value);
+ void updateNbNodes(int value);
+ void updateMemory(int value);
+ void updateMemoryPerCPU(int value);
+ void updateDuration(const QString& value);
+ void updateQueue(const QString& value);
+ void updatePartition(const QString& value);
+ void updateWckey(const QString& value);
+ void updateExclusive(int value);
+ void updateExtraParams();
+
+signals:
+ void defaultNbBranches(int value);
+ void defaultWcKey(const QString& value);
+
+private:
+ ydefx::JobParametersProxy& _model;
+ QTextEdit * _extraEdit;
+};
+
+#endif //IDEFX_ParamsConfigWidget_HXX
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "PathsConfig.hxx"
+
+PathsConfigWidget::PathsConfigWidget(ydefx::JobParametersProxy& model,
+ QWidget* parent)
+: QScrollArea(parent)
+, _model(model)
+{
+ QWidget* mainWidget = new QWidget();
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainWidget->setLayout(mainLayout);
+
+ QLabel *label;
+ QHBoxLayout *hLayout;
+ QLineEdit *editLine;
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Job name:"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.job_name().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateJobName(const QString&)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Remote work directory:"));
+ editLine = new QLineEdit();
+ editLine->setText(_model.work_directory().c_str());
+ hLayout->addWidget(label);
+ hLayout->addWidget(editLine);
+ mainLayout->addLayout(hLayout);
+ connect(this, SIGNAL(defaultWorkingDir(const QString&)),
+ editLine, SLOT(setText(const QString&)));
+ connect(editLine, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateWorkingDirectory(const QString&)));
+
+ hLayout = new QHBoxLayout();
+ label = new QLabel(tr("Temporary local directory:"));
+ _localdirEdit = new QLineEdit();
+ _localdirEdit->setText(_model.result_directory().c_str());
+ QPushButton* localdirButton = new QPushButton("...");
+ hLayout->addWidget(label);
+ hLayout->addWidget(_localdirEdit);
+ hLayout->addWidget(localdirButton);
+ mainLayout->addLayout(hLayout);
+ connect(_localdirEdit, SIGNAL(textChanged(const QString &)),
+ this, SLOT(updateLocalDirectory(const QString&)));
+ connect(localdirButton,SIGNAL(clicked()),this, SLOT(onChoseLocaldir()));
+
+
+ QGroupBox * inputFilesBox = new QGroupBox;
+ inputFilesBox->setTitle(tr("Additional input files:"));
+ hLayout = new QHBoxLayout();
+ inputFilesBox->setLayout(hLayout);
+ _inputFilesList = new QListWidget;
+ _inputFilesList->setSelectionMode(QAbstractItemView::MultiSelection);
+ for(const std::string& it : _model.in_files())
+ _inputFilesList->addItem(it.c_str());
+ QVBoxLayout *inputButtonsLayout = new QVBoxLayout;
+ QPushButton *addInputFilesButton = new QPushButton(tr("+"));
+ _removeInputFilesButton = new QPushButton(tr("-"));
+ inputButtonsLayout->addWidget(addInputFilesButton);
+ inputButtonsLayout->addWidget(_removeInputFilesButton);
+ hLayout->addWidget(_inputFilesList);
+ hLayout->addLayout(inputButtonsLayout);
+ mainLayout->addWidget(inputFilesBox);
+ _removeInputFilesButton->setEnabled(false);
+ connect(addInputFilesButton, SIGNAL(clicked()), this, SLOT(addInputFiles()));
+ connect(_removeInputFilesButton, SIGNAL(clicked()),
+ this, SLOT(removeInputFiles()));
+ connect(_inputFilesList, SIGNAL(itemSelectionChanged()),
+ this, SLOT(inputSelectionChanged()));
+
+ setWidget(mainWidget);
+ setWidgetResizable (true);
+}
+
+PathsConfigWidget::~PathsConfigWidget()
+{
+}
+
+void PathsConfigWidget::updateJobName(const QString& value)
+{
+ _model.job_name(value.toStdString());
+}
+
+void PathsConfigWidget::updateWorkingDirectory(const QString& value)
+{
+ _model.work_directory(value.toStdString());
+}
+
+void PathsConfigWidget::updateLocalDirectory(const QString& value)
+{
+ _model.result_directory(value.toStdString());
+}
+
+void PathsConfigWidget::onChoseLocaldir()
+{
+ QString dir;
+ dir = QFileDialog::getExistingDirectory(this,
+ tr("Choose temporary local directory"),
+ "",
+ QFileDialog::ShowDirsOnly
+ | QFileDialog::DontResolveSymlinks);
+
+ if (dir != "")
+ {
+ _model.result_directory(dir.toStdString());
+ _localdirEdit->setText(dir);
+ }
+}
+
+void PathsConfigWidget::inputSelectionChanged()
+{
+ bool canRemove = (_inputFilesList->selectedItems().size() > 0);
+ _removeInputFilesButton->setEnabled(canRemove);
+}
+
+void PathsConfigWidget::addInputFiles()
+{
+ // We need to be able to select both files and folders.
+ // Standard QFileDialog cannot do it.
+ QFileDialog w(this, tr("Select input files"),
+ "", tr("All files and folders(*)")) ;
+ w.setOption(QFileDialog::DontUseNativeDialog,true);
+ QListView *l = w.findChild<QListView*>("listView");
+ if (l)
+ {
+ l->setSelectionMode(QAbstractItemView::MultiSelection);
+ }
+ QTreeView *t = w.findChild<QTreeView*>();
+ if (t)
+ {
+ t->setSelectionMode(QAbstractItemView::MultiSelection);
+ }
+ if(w.exec())
+ {
+ QStringList fileNames = w.selectedFiles();
+ for (int i = 0; i < fileNames.size(); ++i)
+ {
+ QString fileName = fileNames.at(i);
+ std::list<std::string> additionalFiles;
+ if (_inputFilesList->findItems(fileName,Qt::MatchFixedString).size() == 0)
+ {
+ additionalFiles.push_back(fileName.toStdString());
+ _inputFilesList->addItem(fileName);
+ }
+ _model.add_in_files(additionalFiles);
+ }
+ }
+}
+
+void PathsConfigWidget::removeInputFiles()
+{
+ QList<QListWidgetItem *> list = _inputFilesList->selectedItems();
+ for (int i = 0; i < list.size(); ++i)
+ {
+ int row = _inputFilesList->row( list.at(i) );
+ QListWidgetItem * item = _inputFilesList->takeItem(row);
+ std::string itemName = item->text().toStdString();
+ _model.remove_in_file(itemName);
+ delete item;
+ }
+}
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef IDEFX_PathsConfigWidget_HXX
+#define IDEFX_PathsConfigWidget_HXX
+#include "JobParametersProxy.hxx"
+#include <QtWidgets>
+
+class PathsConfigWidget: public QScrollArea
+{
+ Q_OBJECT
+public:
+ PathsConfigWidget(ydefx::JobParametersProxy& model, QWidget* parent=0);
+ virtual ~PathsConfigWidget();
+
+public slots:
+ void updateJobName(const QString& value);
+ void updateWorkingDirectory(const QString& value);
+ void updateLocalDirectory(const QString& value);
+ void onChoseLocaldir();
+ void inputSelectionChanged();
+ void addInputFiles();
+ void removeInputFiles();
+
+signals:
+ void defaultWorkingDir(const QString& value);
+
+private:
+ ydefx::JobParametersProxy& _model;
+ QLineEdit * _localdirEdit;
+ QListWidget * _inputFilesList;
+ QPushButton *_removeInputFilesButton;
+};
+
+#endif //IDEFX_PathsConfigWidget_HXX
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "QuickConfig.hxx"
+
+QuickConfigWidget::QuickConfigWidget(ydefx::JobParametersProxy& model,
+ QWidget* parent)
+: QScrollArea(parent)
+, _model(model)
+{
+ QWidget* mainWidget = new QWidget();
+ QVBoxLayout *mainLayout = new QVBoxLayout();
+ mainWidget->setLayout(mainLayout);
+
+ QHBoxLayout *hLayout = new QHBoxLayout();
+ QComboBox* resourcesComboBox = new QComboBox;
+ std::list<std::string> resources = _model.AvailableResources();
+ for(const std::string& it : resources)
+ resourcesComboBox->addItem(QString(it.c_str()));
+ resourcesComboBox->setCurrentIndex(
+ resourcesComboBox->findText(model.resource_name().c_str()));
+ connect(resourcesComboBox, SIGNAL(currentIndexChanged( const QString &)),
+ this, SLOT(updateResource( const QString &)));
+
+ QLabel * resourcesLabel = new QLabel(tr("Computing resource:"));
+ hLayout->addWidget(resourcesLabel);
+ hLayout->addWidget(resourcesComboBox);
+ mainLayout->addLayout(hLayout);
+
+ QLabel *nb_branchesLabel = new QLabel(tr("Number of parallel evaluations:"));
+ QSpinBox *nb_branchesEdit = new QSpinBox();
+ nb_branchesEdit->setRange(1, 10000);
+ nb_branchesEdit->setValue(_model.nb_branches());
+ hLayout = new QHBoxLayout();
+ hLayout->addWidget(nb_branchesLabel);
+ hLayout->addWidget(nb_branchesEdit);
+ mainLayout->addLayout(hLayout);
+ connect(this, SIGNAL(defaultNbBranches(int)),
+ nb_branchesEdit, SLOT(setValue(int)));
+ connect(nb_branchesEdit, SIGNAL(valueChanged(int)),
+ this, SLOT(updateNbBranches(int)));
+
+ mainLayout->addStretch();
+ setWidget(mainWidget);
+ setWidgetResizable (true);
+}
+
+QuickConfigWidget::~QuickConfigWidget()
+{
+}
+
+void QuickConfigWidget::updateResource(const QString& value)
+{
+ _model.configureResource(value.toStdString());
+ emit defaultNbBranches(_model.nb_branches());
+ emit defaultWorkingDir(_model.work_directory().c_str());
+ emit defaultWcKey(_model.wckey().c_str());
+}
+
+void QuickConfigWidget::updateNbBranches(int value)
+{
+ _model.nb_branches(value);
+ emit defaultNbBranches(value);
+}
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef IDEFX_QuickConfigWidget_HXX
+#define IDEFX_QuickConfigWidget_HXX
+#include "JobParametersProxy.hxx"
+#include <QtWidgets>
+
+class QuickConfigWidget: public QScrollArea
+{
+ Q_OBJECT
+public:
+ QuickConfigWidget(ydefx::JobParametersProxy& model, QWidget* parent=0);
+ virtual ~QuickConfigWidget();
+
+public slots:
+ void updateResource(const QString& value);
+ void updateNbBranches(int value);
+
+signals:
+ void defaultNbBranches(int value);
+ void defaultWorkingDir(const QString& value);
+ void defaultWcKey(const QString& value);
+private:
+ ydefx::JobParametersProxy& _model;
+};
+
+#endif //IDEFX_QuickConfigWidget_HXX
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "ResourceWidget.hxx"
+#include "QuickConfig.hxx"
+#include "PathsConfig.hxx"
+#include "ParamsConfig.hxx"
+
+ResourceWidget::ResourceWidget(ydefx::JobParametersProxy& model,
+ QWidget* parent)
+: QTabWidget(parent)
+, _model(model)
+{
+ QuickConfigWidget* quickWidget = new QuickConfigWidget(_model, parent);
+ PathsConfigWidget* pathsWidget = new PathsConfigWidget(_model, parent);
+ ParamsConfigWidget* paramsWidget = new ParamsConfigWidget(_model, parent);
+ addTab(quickWidget, tr("&Quick configuration"));
+ addTab(paramsWidget, tr("Advanced ¶meters"));
+ addTab(pathsWidget, tr("&Files and directories"));
+ connect(quickWidget, SIGNAL(defaultNbBranches(int)),
+ paramsWidget, SIGNAL(defaultNbBranches(int)));
+ connect(quickWidget, SIGNAL(defaultWcKey(const QString&)),
+ paramsWidget, SIGNAL(defaultWcKey(const QString&)));
+ connect(quickWidget, SIGNAL(defaultWorkingDir(const QString&)),
+ pathsWidget, SIGNAL(defaultWorkingDir(const QString&)));
+}
+
+ResourceWidget::~ResourceWidget()
+{
+}
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef IDEFX_RESOURCEWIDGET_HXX
+#define IDEFX_RESOURCEWIDGET_HXX
+#include "JobParametersProxy.hxx"
+#include <QtWidgets>
+
+class ResourceWidget: public QTabWidget
+{
+ Q_OBJECT
+public:
+ ResourceWidget(ydefx::JobParametersProxy& model, QWidget* parent=0);
+ virtual ~ResourceWidget();
+private:
+ ydefx::JobParametersProxy& _model;
+};
+
+#endif //IDEFX_RESOURCEWIDGET_HXX
--- /dev/null
+// Copyright (C) 2019 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include <Python.h>
+#include "ResourceWidget.hxx"
+#include <QApplication>
+#include <iostream>
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ QApplication app(argc,argv);
+ Py_Initialize();
+ {
+ ydefx::JobParametersProxy jpp;
+ jpp.createResultDirectory("/tmp");
+ ResourceWidget mygui(jpp);
+ mygui.show();
+ ret = app.exec();
+ std::cout << "job_name:" << jpp.job_name() << std::endl;
+ std::cout << "job_type:" << jpp.job_type() << std::endl;
+ std::cout << "job_file:" << jpp.job_file() << std::endl;
+ std::cout << "pre_command:" << jpp.pre_command() << std::endl;
+ std::cout << "env_file:" << jpp.env_file() << std::endl;
+ std::cout << "work_directory:" << jpp.work_directory() << std::endl;
+ std::cout << "local_directory:" << jpp.local_directory() << std::endl;
+ std::cout << "result_directory:" << jpp.result_directory() << std::endl;
+ std::cout << "maximum_duration:" << jpp.maximum_duration() << std::endl;
+ std::cout << "resource_name:" << jpp.resource_name() << std::endl;
+ std::cout << "nb_proc:" << jpp.nb_proc() << std::endl;
+ std::cout << "mem_mb:" << jpp.mem_mb() << std::endl;
+ std::cout << "nb_node:" << jpp.nb_node() << std::endl;
+ std::cout << "nb_proc_per_node:" << jpp.nb_proc_per_node() << std::endl;
+ std::cout << "queue:" << jpp.queue() << std::endl;
+ std::cout << "partition:" << jpp.partition() << std::endl;
+ std::cout << "exclusive:" << jpp.exclusive() << std::endl;
+ std::cout << "mem_per_cpu:" << jpp.mem_per_cpu() << std::endl;
+ std::cout << "wckey:" << jpp.wckey() << std::endl;
+ std::cout << "extra_params:" << jpp.extra_params() << std::endl;
+ std::cout << "nb_branches:" << jpp.nb_branches() << std::endl;
+ std::cout << "in_files: ";
+ for(const std::string& it : jpp.in_files())
+ std::cout << it << ", ";
+ std::cout << std::endl;
+ }
+ Py_Finalize();
+ return ret;
+}
result = "P11U5:CARBONES"
return result
+def availableResources():
+ resManager = salome.lcc.getResourcesManager()
+ params = salome.ResourceParameters()
+ params.can_launch_batch_jobs = True
+ return resManager.GetFittingResources(params)