Commit 3122103c authored by Huff, Israel's avatar Huff, Israel
Browse files

- changed parameters of some queue commands

- implemented/tweaked several SGE commands
- added several controls to test GUI for handling new commands and switching schedulers
parent f24be64a
Pipeline #96841 passed with stages
in 5 minutes and 22 seconds
......@@ -2,6 +2,7 @@
#define RSMCORE_QUEUEBASE_HH_
#include <QString>
#include <QStringList>
namespace rsm
{
......@@ -9,13 +10,13 @@ class QueueBase
{
public:
virtual ~QueueBase();
virtual QString listAllNodeInfo() = 0;
virtual QString listAllQueues() = 0;
virtual QString checkJob(QString params) = 0;
virtual QString deleteJob(QString params) = 0;
virtual QString submitJob(QString params) = 0;
virtual QString showQueueInfo(QString params) = 0;
virtual QString showFreeProcs(QString params) = 0;
virtual QString listAllNodeInfo() = 0;
virtual QString listAllQueues() = 0;
virtual QString checkJobs(QStringList jobIDs) = 0;
virtual QString deleteJobs(QStringList jobIDs) = 0;
virtual QString submitJob(QString params) = 0;
virtual QString showQueueInfo(QString queueName) = 0;
virtual QString showFreeProcs(QString params) = 0;
}; // class QueueBase
} // namespace rsm
......
......@@ -5,13 +5,19 @@ namespace rsm
// QueuePBS::~QueuePBS() {}
QString QueuePBS::listAllNodeInfo() { return "pbsnodes -a"; }
QString QueuePBS::listAllQueues() { return "qstat -q"; }
QString QueuePBS::checkJob(QString params)
QString QueuePBS::checkJobs(QStringList jobIDs)
{
// TODO: optional -f job_id
return "qstat " + params;
// TODO: optional -f job_id job_id ...
return "qstat ";
}
QString QueuePBS::deleteJobs(QStringList jobIDs)
{ // TODO: qdel job_id job_id ...
return "qdel ";
}
QString QueuePBS::deleteJob(QString params) { return "qdel " + params; }
QString QueuePBS::submitJob(QString params) { return "qsub " + params; }
QString QueuePBS::showQueueInfo(QString params) { return "showq " + params; }
QString QueuePBS::showQueueInfo(QString queueName)
{
return "showq " + queueName;
}
QString QueuePBS::showFreeProcs(QString params) { return "showbf " + params; }
} // namespace rsm
......@@ -11,10 +11,10 @@ class QueuePBS : public QueueBase
// ~QueuePBS() override;
QString listAllNodeInfo() override;
QString listAllQueues() override;
QString checkJob(QString params) override;
QString deleteJob(QString params) override;
QString checkJobs(QStringList jobIDs) override;
QString deleteJobs(QStringList jobIDs) override;
QString submitJob(QString params) override;
QString showQueueInfo(QString params) override;
QString showQueueInfo(QString queueName) override;
QString showFreeProcs(QString params) override;
}; // class QueuePBS
} // namespace rsm
......
#include "queuesge.hh"
// TODO: input validation
namespace rsm
{
// QueueSGE::~QueueSGE() {}
QString QueueSGE::listAllNodeInfo() { return "qstat -F"; }
QString QueueSGE::listAllQueues() { return "qstat -g c"; }
QString QueueSGE::checkJob(QString params)
{ // TODO: optional -j job_id
return "qstat " + params;
QString QueueSGE::listAllQueues() { return "qconf -sql"; }
QString QueueSGE::checkJobs(QStringList jobIDs)
{
QString command = "qstat";
if (jobIDs.length() > 0) command += " -j " + jobIDs.join(",");
return command;
}
QString QueueSGE::deleteJobs(QStringList jobIDs)
{
if (jobIDs.length() == 0) return "";
return "qdel " + jobIDs.join(" ");
}
QString QueueSGE::deleteJob(QString params) { return "qdel " + params; }
QString QueueSGE::submitJob(QString params) { return "qsub " + params; }
QString QueueSGE::showQueueInfo(QString params)
{ // TODO: optional -q queue_name
return "qstat " + params;
QString QueueSGE::showQueueInfo(QString queueName)
{
return "qconf -sq " + queueName;
}
// TODO: how best to handle unsupported features?
QString QueueSGE::showFreeProcs(QString params)
{
(void)sizeof(params);
return "";
return "qstat -g c";
}
} // namespace rsm
......@@ -11,10 +11,10 @@ class QueueSGE : public QueueBase
// ~QueueSGE() override;
QString listAllNodeInfo() override;
QString listAllQueues() override;
QString checkJob(QString params) override;
QString deleteJob(QString params) override;
QString checkJobs(QStringList jobIDs) override;
QString deleteJobs(QStringList jobIDs) override;
QString submitJob(QString params) override;
QString showQueueInfo(QString params) override;
QString showQueueInfo(QString queueName) override;
QString showFreeProcs(QString params) override;
}; // class QueueSGE
} // namespace rsm
......
......@@ -8,6 +8,7 @@
#include "rsmportalexample.hh"
#include <QApplication>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QInputDialog>
#include <QLabel>
......@@ -19,40 +20,92 @@ using namespace rsm;
ExamplePortalWidget::ExamplePortalWidget(QWidget *parent)
: QWidget(parent)
{
queue = &queueSGE;
QGridLayout *layout = new QGridLayout(this);
QLabel *proxyHostLabel = new QLabel("Proxy:", this);
QLabel *hostLabel = new QLabel("Host:", this);
QLabel *portLabel = new QLabel("Port:", this);
QLabel *userNameLabel = new QLabel("Username:", this);
mProxyEdit = new QLineEdit(this);
mHostEdit = new QLineEdit(this);
mPortEdit = new QLineEdit(this);
mUserNameEdit = new QLineEdit(this);
mConnectButton = new QPushButton("Connect", this);
mCommandEdit = new QLineEdit(this);
mCommandSubmitButton = new QPushButton("Submit", this);
mProxyEdit = new QLineEdit(this);
mHostEdit = new QLineEdit("", this);
mPortEdit = new QLineEdit("", this);
mUserNameEdit = new QLineEdit("", this);
mConnectButton = new QPushButton("Connect", this);
mCommandEdit = new QLineEdit(this);
mCommandSubmitButton = new QPushButton("Submit", this);
mSchedulerBox = new QGroupBox(this);
mPBSRadioButton = new QRadioButton("PBS", this);
mSGERadioButton = new QRadioButton("SGE", this);
mListAllQueuesButton = new QPushButton("List All Queues", this);
mGetQueueInfoButton = new QPushButton("Queue Info", this);
mGetQueueInfoTextEdit = new QLineEdit(this);
mGetAllNodeInfoButton = new QPushButton("Node Info", this);
mGetAllJobInfoButton = new QPushButton("Job Info", this);
mDeleteJobButton = new QPushButton("Delete Job", this);
mDeleteJobTextEdit = new QLineEdit(this);
mTextEdit = new QTextEdit(this);
layout->addWidget(proxyHostLabel, 0, 0);
layout->addWidget(mProxyEdit, 0, 1);
layout->addWidget(hostLabel, 1, 0);
layout->addWidget(mHostEdit, 1, 1);
layout->addWidget(portLabel, 2, 0);
layout->addWidget(mPortEdit, 2, 1);
layout->addWidget(userNameLabel, 3, 0);
layout->addWidget(mUserNameEdit, 3, 1);
layout->addWidget(mConnectButton, 4, 1);
layout->addWidget(mCommandEdit, 5, 0, 1, 2);
layout->addWidget(mCommandSubmitButton, 6, 1);
layout->addWidget(mTextEdit, 7, 0, 2, 2);
int row = 0;
layout->addWidget(proxyHostLabel, row, 0);
layout->addWidget(mProxyEdit, row, 1);
layout->addWidget(hostLabel, ++row, 0);
layout->addWidget(mHostEdit, row, 1);
layout->addWidget(portLabel, ++row, 0);
layout->addWidget(mPortEdit, row, 1);
layout->addWidget(userNameLabel, ++row, 0);
layout->addWidget(mUserNameEdit, row, 1);
layout->addWidget(mConnectButton, ++row, 1);
QHBoxLayout *mSGBLayout = new QHBoxLayout(mSchedulerBox);
mSchedulerBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
mSGBLayout->addWidget(mPBSRadioButton);
mSGBLayout->addWidget(mSGERadioButton);
layout->addWidget(mSchedulerBox, ++row, 1);
mSchedulerButtonGroup = new QButtonGroup(this);
mSchedulerButtonGroup->addButton(mPBSRadioButton);
mSchedulerButtonGroup->addButton(mSGERadioButton);
layout->addWidget(mSchedulerBox, ++row, 1);
layout->addWidget(mCommandSubmitButton, ++row, 1);
layout->addWidget(mCommandEdit, row, 2);
layout->addWidget(mListAllQueuesButton, ++row, 0);
layout->addWidget(mGetQueueInfoButton, row, 1);
layout->addWidget(mGetQueueInfoTextEdit, row, 2);
layout->addWidget(mGetAllNodeInfoButton, ++row, 1);
layout->addWidget(mGetAllJobInfoButton, ++row, 1);
layout->addWidget(mDeleteJobButton, ++row, 1);
layout->addWidget(mDeleteJobTextEdit, row, 2);
layout->addWidget(mTextEdit, ++row, 0, 2, 3);
connect(mConnectButton, &QPushButton::pressed, this,
&ExamplePortalWidget::connectToHost);
connect(mSchedulerButtonGroup,
QOverload<int>::of(&QButtonGroup::buttonClicked), [=](int id) {
QString name = mSchedulerButtonGroup->checkedButton()->text();
if ("PBS" == name)
queue = &queuePBS;
else if ("SGE" == name)
queue = &queueSGE;
});
mSGERadioButton->click();
connect(mCommandSubmitButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitCommandToHost);
connect(mListAllQueuesButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitListAllQueuesToHost);
connect(mGetQueueInfoButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitGetQueueInfoToHost);
connect(mGetAllNodeInfoButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitGetAllNodeInfoToHost);
connect(mGetAllJobInfoButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitGetAllJobInfoToHost);
connect(mDeleteJobButton, &QPushButton::pressed, this,
&ExamplePortalWidget::submitDeleteJobToHost);
mSession = std::make_shared<SessionController>();
connect(mSession.get(), &SessionController::connectionFailed, this,
......@@ -116,6 +169,48 @@ void ExamplePortalWidget::submitCommandToHost()
mSession->requestExec(command);
}
void ExamplePortalWidget::submitListAllQueuesToHost()
{
radix_tagged_line("submitListAllQueuesToHost()");
QString command = queue->listAllQueues();
mSession->requestExec(command);
}
void ExamplePortalWidget::submitGetQueueInfoToHost()
{
radix_tagged_line("submitGetQueueInfoToHost()");
QString command = queue->showQueueInfo(mGetQueueInfoTextEdit->text());
fprintf(stderr, "%s\n", command.toStdString().c_str());
mSession->requestExec(command);
}
void ExamplePortalWidget::submitGetAllNodeInfoToHost()
{
radix_tagged_line("submitGetAllNodeInfoToHost()");
QString command = queue->listAllNodeInfo();
mSession->requestExec(command);
}
void ExamplePortalWidget::submitGetAllJobInfoToHost()
{
radix_tagged_line("submitGetAllJobInfoToHost()");
QString command = queue->checkJobs(QStringList());
fprintf(stderr, "%s\n", command.toStdString().c_str());
mSession->requestExec(command);
}
void ExamplePortalWidget::submitDeleteJobToHost()
{
radix_tagged_line("submitDeleteJobToHost()");
QStringList jobIDs = QStringList();
if (mDeleteJobTextEdit->text().length() > 0)
jobIDs = mDeleteJobTextEdit->text().split(QRegExp("[ ,]"));
QString command = queue->deleteJobs(jobIDs);
fprintf(stderr, "%d\n", jobIDs.size());
fprintf(stderr, "%s\n", command.toStdString().c_str());
mSession->requestExec(command);
}
void ExamplePortalWidget::slotExecOutputReady()
{
QByteArray output = mSession->readExecOutput();
......@@ -210,13 +305,13 @@ void ExamplePortalWidget::hostPublicKeyChanged(QString host_hash)
{
mTextEdit->append("Host key has changed.\nChanged key:");
mTextEdit->append(host_hash);
mTextEdit->append("This could be a man-in-the-middle attach.\n");
mTextEdit->append("This could be a man-in-the-middle attack.\n");
mSession->disconnect();
}
void ExamplePortalWidget::hostPublicKeyUnavailable()
{
mTextEdit->append("Host key is unavaible.\n");
mTextEdit->append("Host key is unavailable.\n");
mSession->disconnect();
}
......@@ -291,7 +386,7 @@ void ExamplePortalWidget::execFinished()
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setGeometry(400, 250, 542, 390);
setGeometry(120, 120, 720, 720);
ExamplePortalWidget *portalView = new ExamplePortalWidget(this);
setCentralWidget(portalView);
......
......@@ -2,13 +2,18 @@
#define RSM_RSMWIDGETS_EXAMPLE_RSMPORTALEXAMPLE_HH_
#include <QAbstractTableModel>
#include <QButtonGroup>
#include <QGroupBox>
#include <QLineEdit>
#include <QMainWindow>
#include <QPushButton>
#include <QRadioButton>
#include <QTextEdit>
#include <QWidget>
#include "rsmcore/sessioncontroller.hh"
#include "rsmcore/queuepbs.hh"
#include "rsmcore/queuesge.hh"
#include "rsmpbs/pbssession.hh"
#include <memory>
......@@ -26,10 +31,27 @@ class ExamplePortalWidget : public QWidget
QLineEdit *mHostEdit;
QLineEdit *mPortEdit;
QLineEdit *mUserNameEdit;
QGroupBox *mSchedulerBox;
QButtonGroup *mSchedulerButtonGroup;
QRadioButton *mPBSRadioButton;
QRadioButton *mSGERadioButton;
QLineEdit *mCommandEdit;
QPushButton *mCommandSubmitButton;
QPushButton *mListAllQueuesButton;
QPushButton *mGetQueueInfoButton;
QLineEdit *mGetQueueInfoTextEdit;
QPushButton *mGetAllNodeInfoButton;
QPushButton *mGetAllJobInfoButton;
QPushButton *mDeleteJobButton;
QLineEdit *mDeleteJobTextEdit;
QTextEdit *mTextEdit;
rsm::SessionController::SP mSession;
rsm::QueuePBS queuePBS;
rsm::QueueSGE queueSGE;
rsm::QueueBase *queue;
public:
ExamplePortalWidget(QWidget *parent = nullptr);
......@@ -37,6 +59,11 @@ class ExamplePortalWidget : public QWidget
public slots:
void connectToHost();
void submitCommandToHost();
void submitListAllQueuesToHost();
void submitGetQueueInfoToHost();
void submitGetAllNodeInfoToHost();
void submitGetAllJobInfoToHost();
void submitDeleteJobToHost();
void slotExecOutputReady();
void connectionFailed(QString message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment