Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xtpcpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
PAPPSO
xtpcpp
Commits
f977f07c
Commit
f977f07c
authored
6 years ago
by
Langella Olivier
Browse files
Options
Downloads
Patches
Plain Diff
new try catch blocks to ensure condor process
parent
a9a57d51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/tandem_run/tandemcondorprocess.cpp
+209
-148
209 additions, 148 deletions
src/core/tandem_run/tandemcondorprocess.cpp
with
209 additions
and
148 deletions
src/core/tandem_run/tandemcondorprocess.cpp
+
209
−
148
View file @
f977f07c
...
...
@@ -249,81 +249,96 @@ TandemCondorProcess::run()
QStringList
arguments
;
arguments
<<
QFileInfo
(
submit_file
.
fileName
()).
absoluteFilePath
();
QProcess
*
condor_process
=
new
QProcess
();
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::run command "
<<
_condor_submit_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_process
->
start
(
_condor_submit_command
,
arguments
);
try
{
QProcess
condor_process
;
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::run command "
<<
_condor_submit_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_process
.
start
(
_condor_submit_command
,
arguments
);
if
(
!
condor_process
->
waitForStarted
())
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed to start"
));
}
if
(
!
condor_process
.
waitForStarted
())
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed to start"
));
}
if
(
!
condor_process
->
waitForFinished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed to finish"
));
}
if
(
!
condor_process
.
waitForFinished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed to finish"
));
}
QString
perr
=
condor_process
->
readAllStandardError
();
if
(
perr
.
length
())
{
QString
perr
=
condor_process
.
readAllStandardError
();
if
(
perr
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardError "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed :
\n
%1"
).
arg
(
perr
));
}
else
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardError OK "
<<
perr
;
}
qDebug
()
<<
"TandemCondorProcess::run readAllStandardError "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed :
\n
%1"
).
arg
(
perr
));
}
else
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardError OK "
<<
perr
;
}
QString
pjob
=
condor_process
->
readAllStandardOutput
();
if
(
pjob
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardOutput OK "
<<
pjob
;
}
else
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardOutput "
<<
pjob
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed :
\n
%1"
).
arg
(
pjob
));
}
QString
pjob
=
condor_process
.
readAllStandardOutput
();
if
(
pjob
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardOutput OK "
<<
pjob
;
}
else
{
qDebug
()
<<
"TandemCondorProcess::run readAllStandardOutput "
<<
pjob
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor X!Tandem process failed :
\n
%1"
).
arg
(
pjob
));
}
// Submitting job(s).\n1 job(s) submitted to cluster 29.\n
parseCondorJobNumber
(
pjob
);
// Submitting job(s).\n1 job(s) submitted to cluster 29.\n
parseCondorJobNumber
(
pjob
);
_p_monitor
->
setProgressMaximumValue
(
_condor_job_size
);
qDebug
()
<<
"TandemCondorProcess::run job="
<<
_condor_cluster_number
<<
" size="
<<
_condor_job_size
;
_p_monitor
->
setProgressMaximumValue
(
_condor_job_size
);
qDebug
()
<<
"TandemCondorProcess::run job="
<<
_condor_cluster_number
<<
" size="
<<
_condor_job_size
;
/*
if (!xt_process->waitForFinished(_max_xt_time_ms)) {
throw pappso::PappsoException(QObject::tr("can't wait for X!Tandem
process
to finish : timeout at %1").arg(_max_xt_time_ms));
}
*/
QByteArray
result
=
condor_process
->
readAll
();
/*
if (!xt_process->waitForFinished(_max_xt_time_ms)) {
throw pappso::PappsoException(QObject::tr("can't wait for X!Tandem
process
to finish : timeout at %1").arg(_max_xt_time_ms));
}
*/
QByteArray
result
=
condor_process
.
readAll
();
QProcess
::
ExitStatus
Status
=
condor_process
->
exitStatus
();
QProcess
::
ExitStatus
Status
=
condor_process
.
exitStatus
();
qDebug
()
<<
"TandemCondorProcess::run ExitStatus "
<<
Status
<<
result
.
data
();
if
(
Status
!=
0
)
qDebug
()
<<
"TandemCondorProcess::run ExitStatus "
<<
Status
<<
result
.
data
();
if
(
Status
!=
0
)
{
// != QProcess::NormalExit
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error executing HTCondor Status != 0 : %1 %2
\n
%3"
)
.
arg
(
_tandem_run_batch
.
_tandem_bin_path
)
.
arg
(
arguments
.
join
(
" "
).
arg
(
result
.
data
())));
}
}
catch
(
pappso
::
PappsoException
exception_pappso
)
{
// != QProcess::NormalExit
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error executing HTCondor Status != 0 : %1 %2
\n
%3"
)
.
arg
(
_tandem_run_batch
.
_tandem_bin_path
)
.
arg
(
arguments
.
join
(
" "
).
arg
(
result
.
data
())));
QObject
::
tr
(
"error launching X!Tandem condor jobs :
\n
%1"
)
.
arg
(
exception_pappso
.
qwhat
()));
}
catch
(
std
::
exception
exception_std
)
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error launching X!Tandem condor jobs (std::exception):
\n
%1"
)
.
arg
(
exception_std
.
what
()));
}
delete
condor_process
;
surveyCondorJob
();
...
...
@@ -365,6 +380,7 @@ TandemCondorProcess::surveyCondorJob()
}
}
}
void
TandemCondorProcess
::
condorRemoveJob
()
{
...
...
@@ -372,43 +388,59 @@ TandemCondorProcess::condorRemoveJob()
QStringList
arguments
;
arguments
<<
QString
(
"%1"
).
arg
(
_condor_cluster_number
);
QString
pjob
;
try
{
QProcess
condor_q_process
;
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob command "
<<
_condor_rm_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_q_process
.
start
(
_condor_rm_command
,
arguments
);
QProcess
condor_q_process
;
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob command "
<<
_condor_rm_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_q_process
.
start
(
_condor_rm_command
,
arguments
);
if
(
!
condor_q_process
.
waitForStarted
())
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_rm process failed to start"
));
}
if
(
!
condor_q_process
.
waitFor
Started
(
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_rm process failed to
start
"
));
}
if
(
!
condor_q_process
.
waitFor
Finished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_rm process failed to
finish
"
));
}
if
(
!
condor_q_process
.
waitForFinished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_rm process failed to finish"
));
}
QString
perr
=
condor_q_process
.
readAllStandardError
();
if
(
perr
.
length
())
{
QString
perr
=
condor_q_process
.
readAllStandardError
();
if
(
perr
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob readAllStandardError "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
perr
));
}
else
{
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob readAllStandardError OK "
<<
perr
;
}
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob readAllStandardError "
<<
perr
;
pjob
=
condor_q_process
.
readAllStandardOutput
();
}
catch
(
pappso
::
PappsoException
exception_pappso
)
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
perr
));
QObject
::
tr
(
"error removing condor jobs :
\n
%1"
)
.
arg
(
exception_pappso
.
qwhat
()));
}
else
catch
(
std
::
exception
exception_std
)
{
qDebug
()
<<
"TandemCondorProcess::condorRemoveJob readAllStandardError OK "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error removing condor jobs (std::exception):
\n
%1"
)
.
arg
(
exception_std
.
what
()))
;
}
QString
pjob
=
condor_q_process
.
readAllStandardOutput
();
if
(
pjob
.
length
())
{
qDebug
()
...
...
@@ -431,65 +463,80 @@ TandemCondorProcess::getCondorJobState()
QStringList
arguments
;
arguments
<<
"-xml"
<<
QString
(
"%1"
).
arg
(
_condor_cluster_number
);
QString
pjob
;
try
{
QProcess
condor_q_process
;
// QProcess::error(QProcess::ProcessError)
// finished(int,QProcess::ExitStatus)
// connect(&condor_q_process, &QProcess::finished, this,
// &TandemCondorProcess::receivedCondorQueueProcessCompleted);
// connect(&condor_q_process, &QProcess::error, this,
// &TandemCondorProcess::receivedCondorQueueProcessError);
QProcess
condor_q_process
;
// QProcess::error(QProcess::ProcessError)
// finished(int,QProcess::ExitStatus)
// connect(&condor_q_process, &QProcess::finished, this,
// &TandemCondorProcess::receivedCondorQueueProcessCompleted);
// connect(&condor_q_process, &QProcess::error, this,
// &TandemCondorProcess::receivedCondorQueueProcessError);
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::getCondorJobState command "
<<
_condor_q_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_q_process
.
start
(
_condor_q_command
,
arguments
);
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
qDebug
()
<<
"TandemCondorProcess::getCondorJobState command "
<<
_condor_q_command
<<
" "
<<
arguments
.
join
(
" "
);
condor_q_process
.
start
(
_condor_q_command
,
arguments
);
if
(
!
condor_q_process
.
waitForStarted
())
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed to start"
));
}
if
(
!
condor_q_process
.
waitFor
Started
(
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed to
start
"
));
}
if
(
!
condor_q_process
.
waitFor
Finished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed to
finish
"
));
}
if
(
!
condor_q_process
.
waitForFinished
(
_max_xt_time_ms
))
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed to finish"
));
}
QString
perr
=
condor_q_process
.
readAllStandardError
();
if
(
perr
.
length
())
{
QString
perr
=
condor_q_process
.
readAllStandardError
();
if
(
perr
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardError "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
perr
));
}
else
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardError OK "
<<
perr
;
}
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardError "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
perr
));
pjob
=
condor_q_process
.
readAllStandardOutput
();
if
(
pjob
.
length
())
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState "
"readAllStandardOutput OK "
<<
pjob
;
}
else
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardOutput "
<<
pjob
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
pjob
));
}
}
else
catch
(
pappso
::
PappsoException
exception_pappso
)
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardError OK "
<<
perr
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error watching condor status :
\n
%1"
)
.
arg
(
exception_pappso
.
qwhat
()))
;
}
QString
pjob
=
condor_q_process
.
readAllStandardOutput
();
if
(
pjob
.
length
())
catch
(
std
::
exception
exception_std
)
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardOutput OK "
<<
pjob
;
}
else
{
qDebug
()
<<
"TandemCondorProcess::getCondorJobState readAllStandardOutput "
<<
pjob
;
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"HTCondor condor_q process failed :
\n
%1"
).
arg
(
pjob
));
QObject
::
tr
(
"error watching condor status (std::exception):
\n
%1"
)
.
arg
(
exception_std
.
what
()));
}
// Submitting job(s).\n1 job(s) submitted to cluster 29.\n
parseCondorQueue
(
pjob
);
}
...
...
@@ -498,31 +545,45 @@ void
TandemCondorProcess
::
parseCondorQueue
(
QString
&
condor_q_xml
)
{
try
{
CondorQxmlSaxHandler
*
parser
=
new
CondorQxmlSaxHandler
(
this
);
CondorQxmlSaxHandler
*
parser
=
new
CondorQxmlSaxHandler
(
this
);
QXmlSimpleReader
simplereader
;
simplereader
.
setContentHandler
(
parser
);
simplereader
.
setErrorHandler
(
parser
);
QXmlSimpleReader
simplereader
;
simplereader
.
setContentHandler
(
parser
);
simplereader
.
setErrorHandler
(
parser
);
qDebug
()
<<
"TandemCondorProcess::parseCondorQueue Read condor_q_xml"
;
qDebug
()
<<
"TandemCondorProcess::parseCondorQueue Read condor_q_xml"
;
QXmlInputSource
xml_input_source
;
xml_input_source
.
setData
(
condor_q_xml
);
QXmlInputSource
xml_input_source
;
xml_input_source
.
setData
(
condor_q_xml
);
if
(
simplereader
.
parse
(
xml_input_source
))
{
}
else
{
qDebug
()
<<
parser
->
errorString
();
if
(
simplereader
.
parse
(
xml_input_source
))
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"Error reading condor_q xml string :
\n
%1
\n
%2"
)
.
arg
(
parser
->
errorString
())
.
arg
(
condor_q_xml
));
}
delete
parser
;
}
catch
(
pappso
::
PappsoException
exception_pappso
)
{
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"error parsing condor queue :
\n
%1"
)
.
arg
(
exception_pappso
.
qwhat
()));
}
else
catch
(
std
::
exception
exception_std
)
{
qDebug
()
<<
parser
->
errorString
();
throw
pappso
::
PappsoException
(
QObject
::
tr
(
"Error reading condor_q xml string :
\n
%1
\n
%2"
)
.
arg
(
parser
->
errorString
())
.
arg
(
condor_q_xml
));
QObject
::
tr
(
"error parsing condor queue (std::exception):
\n
%1"
)
.
arg
(
exception_std
.
what
()));
}
delete
parser
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment