Skip to content
Snippets Groups Projects
Commit 396c51b9 authored by Langella Olivier's avatar Langella Olivier
Browse files

to test: condor job survey

parent 1224d990
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,9 @@ TandemCondorProcess::TandemCondorProcess(MainWindow * p_main_window, WorkMonitor
TandemCondorProcess::~TandemCondorProcess () {
delete _p_tmp_dir;
}
unsigned int TandemCondorProcess::getCondorJobSize() const {
return _condor_job_size;
}
void TandemCondorProcess::prepareXmlDatabaseFile() {
......@@ -386,3 +389,11 @@ void TandemCondorProcess::parseCondorJobNumber(QString condor_job) {
}
}
void TandemCondorProcess::setCondorJobStatus(std::int8_t count_status[10]) {
QString status_message = QString("%1 unexpanded jobs\n%2 idle jobs\n%3 running jobs\n%4 removed jobs\n%5 completed jobs\n%6 held jobs\n%7 submission errors").arg(count_status[0]).arg(count_status[1]).arg(count_status[2]).arg(count_status[3]).arg(count_status[4]).arg(count_status[5]).arg(count_status[6]);
_p_monitor->setText(status_message);
}
......@@ -41,6 +41,10 @@ public:
virtual void prepareXmlDatabaseFile();
virtual void run();
unsigned int getCondorJobSize() const;
void setCondorJobStatus(std::int8_t count_status[10]);
private :
void parseCondorJobNumber(QString condor_job);
void surveyCondorJob();
......
......@@ -138,6 +138,9 @@ void MainWindow::doDisplayLoadingMessagePercent(QString message, int value) {
ui->statusbar->showMessage(message);
}
void MainWindow::doWorkerSetText(QString text) {
_p_waiting_message_dialog->setText(text);
}
void MainWindow::doWorkerAppendText(char * text) {
_p_waiting_message_dialog->appendText(text);
}
......
......@@ -76,6 +76,7 @@ public slots:
void doDisplayLoadingMessage(QString message);
void doDisplayLoadingMessagePercent(QString message, int value);
void doWorkerAppendText(char *);
void doWorkerSetText(QString);
void doProjectReady(ProjectSp project_sp);
void doProjectNotReady(QString error);
void doAcceptedLoadResultDialog();
......
......@@ -100,6 +100,12 @@ void WaitingMessageDialog::appendText(char * text) {
ui->console_plaintextedit->insertPlainText (text);
}
void WaitingMessageDialog::setText(const QString text) {
ui->console_plaintextedit->setHidden(false);
//ui->console_plaintextedit->appendText(text);
ui->console_plaintextedit->setPlainText(text);
}
void WaitingMessageDialog::hideEvent( QHideEvent* event ) {
QWidget::hideEvent( event );
qDebug() << "WaitingMessageDialog::hideEvent";
......
......@@ -47,6 +47,7 @@ public:
void message(const QString & message);
void message(const QString & message, int progress_value);
void appendText(char * text);
void setText(const QString text);
void showEvent( QShowEvent* event );
void hideEvent( QHideEvent* event );
......
......@@ -54,6 +54,7 @@ WorkerThread::WorkerThread(MainWindow * p_main_window)
connect(_p_work_monitor, &WorkMonitor::workerMessage, p_main_window,&MainWindow::doDisplayLoadingMessage);
connect(_p_work_monitor, &WorkMonitor::workerMessagePercent, p_main_window,&MainWindow::doDisplayLoadingMessagePercent);
connect(_p_work_monitor, &WorkMonitor::workerAppendText, p_main_window,&MainWindow::doWorkerAppendText);
connect(_p_work_monitor, &WorkMonitor::workerSetText, p_main_window,&MainWindow::doWorkerSetText);
connect(p_main_window, &MainWindow::operateXpipFile, this,&WorkerThread::doXpipFileLoad);
connect(this, &WorkerThread::projectReady, p_main_window,&MainWindow::doProjectReady);
......
......@@ -33,6 +33,8 @@
#include <pappsomspp/pappsoexception.h>
CondorQxmlSaxHandler::CondorQxmlSaxHandler(TandemCondorProcess * tandem_condor_process) {
_is_empty = true;
_tandem_condor_process = tandem_condor_process;
}
CondorQxmlSaxHandler::~CondorQxmlSaxHandler() {
}
......@@ -40,20 +42,20 @@ CondorQxmlSaxHandler::~CondorQxmlSaxHandler() {
bool CondorQxmlSaxHandler::startElement(const QString & namespaceURI, const QString & localName,
const QString & qName, const QXmlAttributes & attributes) {
const QString & qName, const QXmlAttributes & attributes) {
qDebug()<< "CondorQxmlSaxHandler::startElement begin" << namespaceURI << " " << localName << " " << qName ;
_tag_stack.push_back(qName);
bool is_ok = true;
try {
//startElement_group
/*
if (qName == "match") {
is_ok = startElement_match(attributes);
} else if (qName == "protein") {
is_ok = startElement_protein(attributes);
if (qName == "c") {
is_ok = startElement_c(attributes);
} else if (qName == "a") {
is_ok = startElement_a(attributes);
}
*/
_current_text.clear();
}
catch (pappso::PappsoException exception_pappso) {
......@@ -68,20 +70,26 @@ bool CondorQxmlSaxHandler::startElement(const QString & namespaceURI, const QStr
}
bool CondorQxmlSaxHandler::endElement(const QString & namespaceURI, const QString & localName,
const QString & qName) {
const QString & qName) {
bool is_ok = true;
// endElement_peptide_list
try {
/*
if (qName == "protein")
if (qName == "a")
{
is_ok = endElement_protein();
is_ok = endElement_a();
}
else if (qName == "c") {
is_ok = endElement_c();
}
else if (qName == "identification") {
is_ok = endElement_identification();
else if (qName == "i") {
is_ok = endElement_i();
}
*/
else if (qName == "s") {
is_ok = endElement_s();
}
}
catch (pappso::PappsoException exception_pappso) {
_errorStr = QObject::tr("ERROR in CondorQxmlSaxHandler::endElement tag %1, PAPPSO exception:\n%2").arg(qName).arg(exception_pappso.qwhat());
......@@ -121,11 +129,37 @@ QString CondorQxmlSaxHandler::errorString() const {
bool CondorQxmlSaxHandler::endDocument() {
//_p_project->getProteinStore().setRegexpDecoyPattern(_p_project->getProteinStore().getRegexpDecoy().pattern());
unsigned int really_completed_jobs = 0;
if (_is_empty) {
really_completed_jobs = _tandem_condor_process->getCondorJobSize();
} else {
int total_jobs = 0;
for (std::int8_t i=0; i < 10; i++) {
total_jobs += _count_status[i];
}
int diff_jobs = _tandem_condor_process->getCondorJobSize()
- total_jobs;
really_completed_jobs = _count_status[(std::int8_t) CondorJobStatus::Completed] + diff_jobs;
}
_count_status[(std::int8_t) CondorJobStatus::Completed] = really_completed_jobs;
_tandem_condor_process->setCondorJobStatus(_count_status);
/*
xtandemCondorAnalysis.setJobCompleted(junexpanded, jidle, jrunning,
jremoved, reallyCompletedJobs, jheld, jsubmission_error);
*/
return true;
}
bool CondorQxmlSaxHandler::startDocument() {
for (std::int8_t i=0; i < 10; i++) {
_count_status[i] = 0;
}
_is_empty = true;
return true;
}
......@@ -134,6 +168,67 @@ bool CondorQxmlSaxHandler::characters(const QString &str) {
return true;
}
bool CondorQxmlSaxHandler::startElement_c(QXmlAttributes attributes) {
// <c>
// <a n="ProcId"><i>0</i></a>
_condor_job_status = CondorJobStatus::Unexpanded;
_current_proc_id = 0;
_is_empty = false;
_current_remote_host = "";
_current_last_remote_host = "";
return true;
}
bool CondorQxmlSaxHandler::startElement_a(QXmlAttributes attributes) {
// logger.debug("startElementgroup begin");
// <group label="performance parameters" type="parameters">
_in_name = attributes.value("n");
return true;
}
bool CondorQxmlSaxHandler::endElement_a() {
_in_name = "";
return true;
}
bool CondorQxmlSaxHandler::endElement_i() {
if (_in_name == "ProcId") {
_current_proc_id = _current_text.toInt();
} else if (_in_name == "JobStatus") {
// <a n="JobStatus"><i>2</i></a>
_condor_job_status = static_cast<CondorJobStatus>(_current_text.toInt());
// logger.debug(currentProcId);
}
return true;
}
bool CondorQxmlSaxHandler::endElement_s() {
if (_in_name == "RemoteHost") {
// <a n="RemoteHost"><s>slot1@proteus3</s></a>
_current_remote_host = _current_text;
} else if ( _in_name == "LastRemoteHost") {
// <a n="LastRemoteHost"><s>slot1@proteus4</s></a>
_current_last_remote_host = _current_text;
}
return true;
}
bool CondorQxmlSaxHandler::endElement_c() {
/*
* 0 Unexpanded U 1 Idle I 2 Running R 3 Removed X 4 Completed C 5 Held
* H 6 Submission_err E
*/
_count_status[(std::int8_t) _condor_job_status] += 1;
qDebug() << "currentRemoteHost:" << _current_remote_host <<
" currentLastRemoteHost" << _current_last_remote_host << " "
<< (std::int8_t)_condor_job_status;
}
/*
package fr.inra.pappso.xtandempipeline.sax_parse;
......@@ -174,110 +269,6 @@ public void startDocument() throws SAXException {
this.empty = true;
}
@Override
public void endDocument() throws SAXException {
int reallyCompletedJobs = 0;
if (this.empty) {
reallyCompletedJobs = xtandemCondorAnalysis.getCondorJobNumber();
} else {
int totalJobs = junexpanded + jidle + jrunning + jremoved
+ jcompleted + jheld + jsubmission_error;
int diffJobs = xtandemCondorAnalysis.getCondorJobNumber()
- totalJobs;
reallyCompletedJobs = jcompleted + diffJobs;
}
xtandemCondorAnalysis.setJobCompleted(junexpanded, jidle, jrunning,
jremoved, reallyCompletedJobs, jheld, jsubmission_error);
String statusMessage = "" + junexpanded + " unexpanded jobs\n";
statusMessage += jidle + " idle jobs\n";
statusMessage += jrunning + " running jobs\n";
statusMessage += jremoved + " removed jobs\n";
statusMessage += reallyCompletedJobs + " completed jobs\n";
statusMessage += jheld + " held jobs\n";
statusMessage += jsubmission_error + " submission_errors\n";
logger.debug(statusMessage);
xtandemCondorAnalysis.setStatusMessage(statusMessage);
}
// <c>
// <a n="ProcId"><i>0</i></a>
public void startElementc(String nameSpaceUri, Attributes attrs) {
this.empty = false;
currentProcId = null;
currentJobStatus = null;
currentRemoteHost = null;
currentLastRemoteHost = null;
}
public void startElementa(String nameSpaceUri, Attributes attrs) {
// logger.debug("startElementgroup begin");
// <group label="performance parameters" type="parameters">
this.inName = attrs.getValue("n");
}
public void endElementi(String nameSpaceUri, String data)
throws MSMSException {
if (inName.equals("ProcId")) {
this.currentProcId = new Integer(data);
// logger.debug(currentProcId);
} else if (inName.equals("JobStatus")) {
// <a n="JobStatus"><i>2</i></a>
this.currentJobStatus = new Integer(data);
// logger.debug(currentProcId);
}
}
public void endElements(String nameSpaceUri, String data)
throws MSMSException {
if (inName.equals("RemoteHost")) {
// <a n="RemoteHost"><s>slot1@proteus3</s></a>
this.currentRemoteHost = data;
// logger.debug(currentProcId);
} else if (inName.equals("LastRemoteHost")) {
// <a n="LastRemoteHost"><s>slot1@proteus4</s></a>
this.currentLastRemoteHost = data;
// logger.debug(currentProcId);
}
}
public void endElementa(String nameSpaceUri, String data) {
this.inName = "";
}
public void endElementc(String nameSpaceUri, String data)
throws MSMSException {
/*
* 0 Unexpanded U 1 Idle I 2 Running R 3 Removed X 4 Completed C 5 Held
* H 6 Submission_err E
*
if (currentJobStatus == 0) {
this.junexpanded += 1;
} else if (currentJobStatus == 1) {
this.jidle += 1;
} else if (currentJobStatus == 2) {
this.jrunning += 1;
} else if (currentJobStatus == 3) {
this.jremoved += 1;
} else if (currentJobStatus == 4) {
this.jcompleted += 1;
} else if (currentJobStatus == 5) {
this.jheld += 1;
} else if (currentJobStatus == 6) {
this.jsubmission_error += 1;
}
logger.debug("currentRemoteHost:" + this.currentRemoteHost
+ " currentLastRemoteHost" + this.currentLastRemoteHost + " "
+ currentJobStatus);
}
}
*/
......@@ -35,13 +35,24 @@
class TandemCondorProcess;
/** \def CondorJobStatus
* */
enum class CondorJobStatus: std::int8_t {
Unexpanded =0, ///< 0 Unexpanded U
Idle =1, ///< 1 Idle I
Running=2, ///< 2 Running R
Removed=3, ///< 3 Removed X
Completed=4, ///< 4 Completed C
Held=5, ///< 5 Held H
Submission_err=6 ///< 6 Submission_err E
};
class CondorQxmlSaxHandler: public QXmlDefaultHandler
{
public:
CondorQxmlSaxHandler(TandemCondorProcess * tandem_condor_process);
~CondorQxmlSaxHandler();
bool startElement(const QString & namespaceURI, const QString & localName,
const QString & qName, const QXmlAttributes & attributes);
......@@ -58,6 +69,14 @@ public:
bool error(const QXmlParseException &exception);
QString errorString() const;
private:
bool startElement_c(QXmlAttributes attributes);
bool startElement_a(QXmlAttributes attributes);
bool endElement_c();
bool endElement_a();
bool endElement_i();
bool endElement_s();
private:
TandemCondorProcess * _tandem_condor_process;
......@@ -65,6 +84,15 @@ private:
std::vector<QString> _tag_stack;
QString _errorStr;
QString _current_text;
QString _in_name;
CondorJobStatus _condor_job_status;
unsigned int _current_proc_id;
QString _current_remote_host;
QString _current_last_remote_host;
std::int8_t _count_status[10];
bool _is_empty;
};
......
......@@ -60,3 +60,7 @@ void WorkMonitor::appendText(char * p_char) {
//qDebug() << "WorkMonitor::setProgressMaximumValue " << max_value;
emit workerAppendText(p_char);
}
void WorkMonitor::setText(const QString text) {
emit workerSetText(text);
}
......@@ -41,6 +41,7 @@ public:
virtual void message(const QString & message, int value) = 0;
virtual void setProgressMaximumValue(int max_value) = 0;
virtual void appendText(char * p_char) =0;
virtual void setText(const QString text)=0;
};
class WorkMonitor: public QObject, public WorkMonitorInterface
......@@ -52,11 +53,13 @@ public:
void message(const QString & message, int value) override;
void setProgressMaximumValue(int max_value) override;
void appendText(char * p_char) override;
void setText(const QString text) override;
signals:
void workerMessage(QString message);
void workerMessagePercent(QString message, int value);
void workerAppendText(char * p_char);
void workerSetText(QString text);
private :
QTime _time;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment