ATLAS Offline Software
SoGEDriver.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 //
10 // includes
11 //
12 
13 #include <EventLoop/SoGEDriver.h>
14 
16 #include <EventLoop/Job.h>
17 #include <EventLoop/ManagerData.h>
18 #include <EventLoop/MessageCheck.h>
19 #include <RootCoreUtils/ThrowMsg.h>
20 #include <TSystem.h>
21 #include <sstream>
22 
23 //
24 // method implementations
25 //
26 
28 
29 namespace EL
30 {
31  void SoGEDriver ::
32  testInvariant () const
33  {
34  RCU_INVARIANT (this != 0);
35  }
36 
37 
38 
40  SoGEDriver ()
41  {
42  RCU_NEW_INVARIANT (this);
43  }
44 
45 
46 
48  doManagerStep (Detail::ManagerData& data) const
49  {
50  RCU_READ_INVARIANT (this);
51  using namespace msgEventLoop;
53  switch (data.step)
54  {
56  {
57  data.batchJobId = "EL_JOBID=$(($SGE_TASK_ID-1))\n";
58  }
59  break;
60 
63  {
64  if (data.resubmit)
65  RCU_THROW_MSG ("resubmission not supported for this driver");
66 
67  assert (!data.batchJobIndices.empty());
68  assert (data.batchJobIndices.back() + 1 == data.batchJobIndices.size());
69  const std::size_t njob = data.batchJobIndices.size();
70 
71  std::ostringstream cmd;
72  cmd << "cd " << data.submitDir << "/submit && qsub "
73  << data.options.castString (Job::optSubmitFlags)
74  << " -t 1-" << (njob) << " run";
75  if (gSystem->Exec (cmd.str().c_str()) != 0)
76  RCU_THROW_MSG (("failed to execute: " + cmd.str()).c_str());
77  data.submitted = true;
78  }
79  break;
80 
81  default:
82  break;
83  }
84  return ::StatusCode::SUCCESS;
85  }
86 }
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
EL::Detail::ManagerStep::batchScriptVar
@ batchScriptVar
create the variables needed for the batch-run script
EL::BatchDriver::doManagerStep
virtual ::StatusCode doManagerStep(Detail::ManagerData &data) const override
rerun_display.cmd
string cmd
Definition: rerun_display.py:67
Job.h
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
MessageCheck.h
ClassImp
ClassImp(EL::SoGEDriver) namespace EL
Definition: SoGEDriver.cxx:27
EL::SoGEDriver::doManagerStep
virtual ::StatusCode doManagerStep(Detail::ManagerData &data) const override
EL::Detail::ManagerStep::doResubmit
@ doResubmit
call the actual doResubmit method
EL::SoGEDriver
a Driver for running on SoGE(?) batch systems
Definition: SoGEDriver.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ManagerData.h
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::Job::optSubmitFlags
static const std::string optSubmitFlags
description: the name of the option for supplying extra submit parameters to batch systems rationale:...
Definition: Job.h:293
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
StatusCode.h
ThrowMsg.h
SoGEDriver.h
EL::SoGEDriver::SoGEDriver
SoGEDriver()
effects: standard default constructor guarantee: strong failures: low level errors I
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
EL::Detail::ManagerStep::submitJob
@ submitJob
do the actual job submission
EL::SoGEDriver::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233