35 void SlurmDriver :: testInvariant ()
const
40 SlurmDriver :: SlurmDriver ()
50 doManagerStep (Detail::ManagerData&
data)
const
53 using namespace msgEventLoop;
57 case Detail::ManagerStep::batchScriptVar:
59 data.batchInit =
"export PATH LD_LIBRARY_PATH PYTHONPATH";
63 case Detail::ManagerStep::submitJob:
64 case Detail::ManagerStep::doResubmit:
66 auto all_set = m_b_job_name && m_b_account && m_b_run_time;
73 ANA_MSG_ERROR(
"All parameters need to be set before job can be submitted");
74 return ::StatusCode::FAILURE;
82 assert (!
data.batchJobIndices.empty());
83 assert (
data.batchJobIndices.back() + 1 ==
data.batchJobIndices.size());
84 const std::size_t njob =
data.batchJobIndices.size();
86 if(!
data.options.castBool(Job::optBatchSharedFileSystem,
true))
88 int status=gSystem->CopyFile(
"RootCore.par",(
data.submitDir+
"/submit/RootCore.par").c_str());
94 std::ofstream
file ((
data.submitDir +
"/submit/submit").c_str());
96 file <<
"#!/bin/bash \n";
98 file <<
"#SBATCH --job-name=" << m_job_name <<
"\n";
99 file <<
"#SBATCH --output=slurm-%j.out\n";
100 file <<
"#SBATCH --error=slurm-%j.err\n";
101 file <<
"#SBATCH --account=" << m_account <<
"\n";
102 if(!m_partition .
empty())
file <<
"#SBATCH --partition=" << m_partition <<
"\n";
103 file <<
"#SBATCH --time=" << m_run_time <<
"\n";
104 if(!m_memory .
empty())
file <<
"#SBATCH --mem=" << m_memory <<
"\n";
105 if(!m_constraint.empty())
file <<
"#SBATCH --constraint=" << m_constraint <<
"\n";
107 file <<
data.options.castString(Job::optBatchSlurmExtraConfigLines) <<
"\n";
110 file <<
data.options.castString(Job::optBatchSlurmWrapperExec);
111 file <<
"./run ${SLURM_ARRAY_TASK_ID}\n";
115 std::ostringstream
cmd;
116 cmd <<
"cd " <<
data.submitDir <<
"/submit && sbatch --array=0-" << njob-1 <<
" " <<
data.options.castString (Job::optSubmitFlags) <<
" submit";
117 if (gSystem->Exec (
cmd.str().c_str()) != 0)
120 data.submitted =
true;
127 return ::StatusCode::SUCCESS;
131 void SlurmDriver :: SetJobName(std::string job_name)
134 m_job_name = job_name;
136 void SlurmDriver :: SetAccount(std::string account)
141 void SlurmDriver :: SetPartition(std::string
partition)
145 void SlurmDriver :: SetRunTime(std::string run_time)
148 m_run_time = run_time;
150 void SlurmDriver :: SetMemory(std::string
memory)
154 void SlurmDriver :: SetConstrain(std::string constraint)
156 m_constraint = constraint;