26 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
27 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
28 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
32 cout <<
"cwb_condor_recovery.C : Error - the accounting_group is not defined !!!" << endl;
33 cout <<
"The accounting_group must be defined in the user_parameters.C file" << endl;
34 cout <<
"See the following link:" << endl;
35 cout <<
" https://ldas-gridmon.ligo.caltech.edu/accounting/condor_groups/determine_condor_account_group.html" << endl;
36 cout <<
"Examples : " << endl;
37 cout <<
"strcpy(condor_tag,\"ligo.dev.o2.burst.allsky.cwboffline\");" << endl;
38 cout <<
"strcpy(condor_tag,\"ligo.prod.o2.burst.allsky.cwboffline\");" << endl;
39 cout <<
"If you don't need it set : strcpy(condor_tag,\"disabled\");" << endl << endl;
45 if(gSystem->Getenv(
"CWB_UPARAMETERS_FILE")==NULL) {
46 cout <<
"Error : environment CWB_UPARAMETERS_FILE is not defined!!!" << endl;
exit(1);
48 cwb_uparameters_file=
TString(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
53 if(gSystem->Getenv(
"CWB_STAGE_NAME")!=NULL) {
54 cwb_stage_name=
TString(gSystem->Getenv(
"CWB_STAGE_NAME"));
56 if(cwb_stage_name==
"CWB_STAGE_FULL") cwb_stage_name=
"CWB_STAGE_LIKELIHOOD";
60 if(cwb_stage_name==
"CWB_STAGE_FULL") {cwb_stage=
CWB_STAGE_LIKELIHOOD; cwb_resume_label+=
"/supercluster_";}
61 if(cwb_stage_name==
"CWB_STAGE_INIT") {cwb_stage=
CWB_STAGE_INIT; cwb_resume_label+=
"";}
62 if(cwb_stage_name==
"CWB_STAGE_STRAIN") {cwb_stage=
CWB_STAGE_STRAIN; cwb_resume_label+=
"/init_";}
63 if(cwb_stage_name==
"CWB_STAGE_CSTRAIN") {cwb_stage=
CWB_STAGE_CSTRAIN; cwb_resume_label+=
"/strain_";}
64 if(cwb_stage_name==
"CWB_STAGE_COHERENCE") {cwb_stage=
CWB_STAGE_COHERENCE; cwb_resume_label+=
"/cstrain_";}
65 if(cwb_stage_name==
"CWB_STAGE_SUPERCLUSTER") {cwb_stage=
CWB_STAGE_SUPERCLUSTER;cwb_resume_label+=
"/coherence_";}
66 if(cwb_stage_name==
"CWB_STAGE_LIKELIHOOD") {cwb_stage=
CWB_STAGE_LIKELIHOOD; cwb_resume_label+=
"/supercluster_";}
67 if(gSystem->Getenv(
"CWB_STAGE_NAME")!=NULL) {
68 cwb_stage_name=
TString(gSystem->Getenv(
"CWB_STAGE_NAME"));
79 TString exec_cmd = TString::Format(
"%s/cwb_condor.csh create",cwb_scripts.Data());
80 int ret=gSystem->Exec(exec_cmd);
81 if(ret) {cout <<
"Error while executing cwb_condor create !!!" << endl;
exit(1);}
88 for(
int i=0;
i<jobList.size();
i++)
if(jobList[
i]>max_jobs) max_jobs=jobList[
i];
95 for (
int i=0;
i<jobList.size();
i++) jobStage[jobList[
i]-1]=(
CWB_STAGE)0;
100 for(
int i=0;
i<fileList.size();
i++) {
103 TObjString* srecoveryID = (TObjString*)token->At(token->GetEntries()-1);
104 if(srecoveryID->GetString().IsDigit()) {
105 cout <<
i <<
" " << fileList[
i].Data() << endl;
106 int recoveryID = srecoveryID->GetString().Atoi();
107 if(iversion<recoveryID) iversion=recoveryID;
117 int estat = gSystem->GetPathInfo(dagfile,&
id,&size,&flags,&mt);
122 cout <<
"File \"" << dagfile <<
"\" already exist" << endl;
123 cout <<
"Do you want to overwrite the file ? (y/n) ";
125 cout << endl << endl;
126 }
while ((strcmp(answer,
"y")!=0)&&(strcmp(answer,
"n")!=0));
127 if (strcmp(answer,
"n")==0) {
135 if(gSystem->Getenv(
"CWB_STAGE_RESUME")!=NULL) {
136 cwb_stage_resume=
TString(gSystem->Getenv(
"CWB_STAGE_RESUME"));
141 if(gSystem->Getenv(
"CWB_STAGE_INPUT")!=NULL) {
142 cwb_stage_input=
TString(gSystem->Getenv(
"CWB_STAGE_INPUT"));
157 sprintf(sfactor,
"_%i",ioffset);
162 cout <<
"Starting reading output directory ..." << endl;
166 for(
int n=0;
n<fileList.size();
n++) {
171 if(fileList[n].BeginsWith(cwb_stage_input+
"/init_"))
174 if(fileList[n].BeginsWith(cwb_stage_input+
"/strain_"))
177 if(fileList[n].BeginsWith(cwb_stage_input+
"/cstrain_"))
180 if(fileList[n].BeginsWith(cwb_stage_input+
"/coherence_"))
183 if(fileList[n].BeginsWith(cwb_stage_input+
"/supercluster_"))
186 if(fileList[n].BeginsWith(cwb_stage_input+
"/wave_")&&fileList[n].Contains(job_label))
209 cout <<
"No Jobs to be recovered" << endl;
213 cout <<
"New Recovey File " << endl;
214 cout << dagfile << endl;
229 if (
i%1000==0) cout <<
i <<
"/" << max_jobs << endl;
231 if(cwb_stage_resume==
"TRUE")
if(!
jobFiles[
i].BeginsWith(cwb_resume_label))
continue;
235 sprintf(ostring,
"JOB A%i %s/%s.sub.recovery.%d",jobID,full_condor_dir,
data_label,iversion);
236 out << ostring << endl;
237 sprintf(ostring,
"VARS A%i PID=\"%i\" CWB_UFILE=\"%s\" CWB_STAGE=\"%s\"",
238 jobID,jobID,
jobFiles[
i].Data(),cwb_stage_name.Data());
239 out << ostring << endl;
240 sprintf(ostring,
"RETRY A%i 3000",jobID);
241 out << ostring << endl;
246 sprintf(symlink,
"%s/%d_%s_%s.out",full_condor_out_dir,jobID,
data_label,cwb_stage_name.Data());
249 int estat = gSystem->GetPathInfo(path.Data(),&
id,&
size,&
flags,&
mt);
251 char cmd[1024];
sprintf(cmd,
"rm -f %s",symlink);
255 sprintf(symlink,
"%s/%d_%s_%s.err",full_condor_err_dir,jobID,
data_label,cwb_stage_name.Data());
258 int estat = gSystem->GetPathInfo(symlink,&
id,&size,&flags,&mt);
260 char cmd[1024];
sprintf(cmd,
"rm -f %s",symlink);
268 if(gSystem->Getenv(
"_USE_LSF")!=NULL) {
271 char lsf_label[1024];
272 if(cwb_stage_name==
"CWB_STAGE_FULL") {
279 TString exec_cmd = TString::Format(
"tar -czf %s/%s.tgz %s %s %s %s/*.sh --exclude='*/.svn'",
281 gSystem->Exec(exec_cmd);
282 cout << endl <<
"Created tgz file : " <<
condor_dir<<
"/"<<lsf_label<<
".tgz" << endl;
287 cout << endl <<
"Unfinished Jobs : " << cnt <<
"/" << jobList.size() << endl;
288 cout << endl <<
"Created LSF file : " << lsfFile << endl << endl;
289 cout <<
"To submit LSF recovered jobs, type :" << endl;
290 cout <<
"cwb_lsf submit " << lsfFile << endl << endl;
292 cout << endl <<
"No jobs to be submitted !!!" << endl << endl;
297 if(gSystem->Getenv(
"_USE_PEGASUS")!=NULL) {
304 out <<
"../" <<
input_dir <<
"/" << endl;
305 out <<
"../" <<
macro_dir <<
"/" << endl;
317 TString exec_cmd = TString::Format(
"cd %s;%s/cwb_pegasus_create.sh %s",
319 int ret=gSystem->Exec(exec_cmd);
320 if(ret) {cout <<
"Error while executing cwb_pegasus_create !!!" << endl;
exit(1);}
323 cout <<
"Unfinished Jobs : " << cnt <<
"/" << jobList.size() << endl;
326 cout <<
"To submit pegasus recovered jobs, type :" << endl;
327 cout <<
"cwb_pegasus submit " << dagfile << endl;
330 char extention[1024];
331 sprintf(extention,
"recovery.%d",iversion);
333 full_condor_err_dir,
condor_log, extention, condor_tag);
335 cout <<
"Unfinished Jobs : " << cnt <<
"/" << jobList.size() << endl;
338 cout <<
"To submit condor recovered jobs, type :" << endl;
339 cout <<
"cwb_condor submit " << dagfile << endl;
343 if(gSystem->Getenv(
"_USE_LSF")!=NULL) {
346 if( cwb_stage_input==
"FULL") cwb_stage_label=
"wave_";
347 if( cwb_stage_input==
"INIT") cwb_stage_label=
"init_";
348 if( cwb_stage_input==
"STRAIN") cwb_stage_label=
"strain_";
349 if( cwb_stage_input==
"CSTRAIN") cwb_stage_label=
"cstrain_";
350 if( cwb_stage_input==
"COHERENCE") cwb_stage_label=
"coherence_";
351 if( cwb_stage_input==
"SUPERCLUSTER") cwb_stage_label=
"supercluster_";
352 if( cwb_stage_input==
"LIKELIHOOD") cwb_stage_label=
"wave_";
355 TString exec_cmd = TString::Format(
"export file_n_st=""$(ls %s*_job%i.root)""",cwb_stage_label.Data(),
jobID);
356 gSystem->Exec(exec_cmd);
357 gSystem->Exec(
"echo $file_n_st");
358 if(gSystem->Getenv(
"file_n_st")!=NULL) {
359 char *file_tmp = gSystem->ExpandPathName(
"output/$file_n_st");
361 exec_cmd = TString::Format(
"tar -czf %s/%s.tgz %s %s %s %s %s %s --exclude='*/.svn' --exclude='%s/*' --exclude='%s/*'",
366 exec_cmd = TString::Format(
"tar -czf %s/%s.tgz %s %s %s %s %s --exclude='*/.svn' --exclude='%s/*' --exclude='%s/*'",
369 gSystem->Exec(exec_cmd);
sprintf(full_condor_dir,"%s/%s", work_dir, condor_dir)
char full_condor_dir[1024]
char full_condor_out_dir[1024]
char full_condor_err_dir[1024]
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
double fabs(const Complex &x)
strcpy(RunLabel, RUN_LABEL)
cout<< "Starting reading output directory ..."<< endl;vector< TString > jobFiles(max_jobs)