ATLAS Offline Software
Loading...
Searching...
No Matches
TorqueDriver.cxx File Reference
#include <EventLoop/TorqueDriver.h>
#include <AsgMessaging/StatusCode.h>
#include <EventLoop/Job.h>
#include <EventLoop/ManagerData.h>
#include <EventLoop/MessageCheck.h>
#include <RootCoreUtils/ShellExec.h>
#include <TSystem.h>
#include <sstream>
Include dependency graph for TorqueDriver.cxx:

Go to the source code of this file.

Functions

 ClassImp (EL::TorqueDriver) namespace EL

Function Documentation

◆ ClassImp()

ClassImp ( EL::TorqueDriver )
Author
Nils Krumnack

Definition at line 26 of file TorqueDriver.cxx.

29{
30 void TorqueDriver ::
31 testInvariant () const
32 {}
33
34
35
36 TorqueDriver ::
37 TorqueDriver ()
38 {
39 RCU_NEW_INVARIANT (this);
40 }
41
42
43
44 ::StatusCode TorqueDriver ::
45 doManagerStep (Detail::ManagerData& data) const
46 {
47 RCU_READ_INVARIANT (this);
48 using namespace msgEventLoop;
49 ANA_CHECK (BatchDriver::doManagerStep (data));
50 switch (data.step)
51 {
52 case Detail::ManagerStep::batchScriptVar:
53 {
54 data.batchJobId = "EL_JOBID=$PBS_ARRAYID\n";
55 }
56 break;
57
58
59 case Detail::ManagerStep::submitJob:
60 case Detail::ManagerStep::doResubmit:
61 {
62 if (data.resubmit)
63 {
64 ANA_MSG_ERROR ("resubmission not supported for the Torque driver");
65 return StatusCode::FAILURE;
66 }
67
68 if (data.batchJobIndices.empty())
69 {
70 ANA_MSG_ERROR ("no job indices to submit");
71 return ::StatusCode::FAILURE;
72 }
73 if (data.batchJobIndices.back() + 1 != data.batchJobIndices.size())
74 {
75 ANA_MSG_ERROR ("submitting a non-contiguous set of job indices is not supported");
76 return ::StatusCode::FAILURE;
77 }
78 const std::size_t njob = data.batchJobIndices.size();
79
80 std::ostringstream cmd;
81 cmd << "cd " << RCU::Shell::quote (data.submitDir) << "/submit && qsub "
82 << data.options.castString (Job::optSubmitFlags)
83 << " -t 0-" << (njob-1) << " run";
84 if (gSystem->Exec (cmd.str().c_str()) != 0)
85 {
86 ANA_MSG_ERROR ("failed to execute: " << cmd.str());
87 return StatusCode::FAILURE;
88 }
89 data.submitted = true;
90 }
91 break;
92
93 default:
94 break;
95 }
96 return ::StatusCode::SUCCESS;
97 }
98}
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:221
#define RCU_READ_INVARIANT(x)
Definition Assert.h:217
#define ANA_MSG_ERROR(xmsg,...)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
std::string quote(const std::string &name)
effects: quote the given name to protect it from the shell returns: the quoted name guarantee: strong...
Definition ShellExec.cxx:65