74 std::cout <<
"Class for managing job arrays/job groups" << std::endl;
75 std::cout <<
" Usage:" << std::endl;
76 std::cout <<
"\thal-jobs [file] where file is name of xml file with settings" << std::endl;
77 std::cout <<
"\thal-jobs --debug=[file] where file is name of xml file with settings, submit commands are displayed"
79 std::cout <<
"hal-jobs --prepare=[X] where X" << std::endl;
80 std::cout <<
"\t pbs_single for torque" << std::endl;
81 std::cout <<
"\t pbs_array for torque array" << std::endl;
82 std::cout <<
"\t sbatch_single for sbatch" << std::endl;
83 std::cout <<
"\t sbatch_array for sbatch array" << std::endl;
84 std::cout <<
"hal-jobs --submit=[Y] --stage=[X] prepares jobs" << std::endl;
85 std::cout <<
"\t Y - name of the files with configured jobs " << std::endl;
86 std::cout <<
"\t X stage of deploying:" << std::endl;
87 std::cout <<
"\t create - only creates job file(s)" << std::endl;
88 std::cout <<
"\t deploy - only submit job(s)" << std::endl;
89 std::cout <<
"--export=[X] --id=[Y] --par=[Z] - prints the name of the value from "
92 std::cout <<
"X - configuration parm, Y job id, par parameter number" << std::endl;
94int main(
int argc,
char* argv[]) {
96 Hal::Cout::PrintInfo(
"No arguments! run: hal-jobs --help to get help", Hal::EInfo::kCriticalError);
99 std::vector<std::pair<TString, TString>> args = Hal::Std::ConvertMainArgs(argc, argv);
101 Int_t nArgs = args.size();
103 TString flag1 = args[0].first;
104 TString val1 = args[0].second;
105 if (flag1 ==
"help") {
108 }
else if (flag1 ==
"" && val1.EndsWith(
".xml")) {
113 }
else if (flag1 ==
"debug" && val1.EndsWith(
".xml")) {
115 jobs.DebugCommands();
118 }
else if (flag1 ==
"prepare") {
119 TString name = val1 +
".xml";
120 TString path = Hal::Std::GetHalrootPlus();
121 Hal::Std::CopyFiles(Form(
"%s/job_patterns/%s", path.Data(), name.Data()), name);
122 gSystem->mkdir(
"jobs");
123 gSystem->mkdir(
"logs");
124 gSystem->mkdir(
"errors");
127 }
else if (nArgs == 2) {
128 TString flag1 = args[0].first;
129 TString val1 = args[0].second;
130 TString flag2 = args[1].first;
131 TString val2 = args[1].second;
132 if (flag1 ==
"submit" && val2 ==
"create") {
136 }
else if (flag1 ==
"submit" && val2 ==
"deploy") {
141 }
else if (nArgs == 3) {
142 TString flag1 = args[0].first;
143 TString flag2 = args[1].first;
144 TString flag3 = args[2].first;
145 TString val1 = args[0].second;
146 TString val2 = args[1].second;
147 TString val3 = args[2].second;
148 if (flag1 ==
"export" && flag2 ==
"id" && flag3 ==
"par") {
150 TString job_id = val1;
151 TString parameter_id = val2;
152 TString textfile = val3;
157 std::cout <<
"Uknown parameter try --help" << std::endl;
static void PrintInfo(TString text, Hal::EInfo status)
static TString GetParameter(TString textfile, Int_t job_no, Int_t var_no)