11 #define FILE_CLEANUP // remove temporary files
12 #define DUMMY // file are not removed
21 gROOT->Macro(gSystem->ExpandPathName(
"$CWB_PARAMETERS_FILE"));
26 vector<TString> nodeList;
28 cout <<
"NodesCleanup.C : get node list ..." << endl;
29 char cmd[1024];
strcpy(cmd,
"condor_status -format \"%s\n\" Machine");
30 FILE* fp = gSystem->OpenPipe(cmd,
"r");
33 while(fgets(cmdout,
sizeof(cmdout)-1, fp)!=NULL) {
34 cmdout[strlen(cmdout)-1]=0;
35 if(
TString(cmdout).BeginsWith(
"a")) {
38 for(
int j=0;
j<(
int)nodeList.size();
j++) {
39 if(
TString(nodeList[
j])==cmdout) {check=
true;
break;}
41 if(!check) nodeList.push_back(cmdout);
45 gSystem->ClosePipe(fp);
47 UserGroup_t*
uinfo = gSystem->GetUserInfo();
55 int nodes = nodeList.size();
58 char node_user_path[1024];
59 sprintf(node_user_path,
"/atlas/node/%s/user/%s",nodeList[
i].Data(),uname.Data());
60 cout <<
"NODE : " << node_user_path <<
" (" <<
i <<
"/" << nodes <<
")" << endl;
62 int estat = gSystem->GetPathInfo(node_user_path,&
id,&size,&flags,&mt);
65 fsize =
GetSize(node_user_path);
78 cout <<
"total file size : " << tot_fsize <<
" MB" << endl;
81 cout <<
"tot deleted files : " << tot_nfiles <<
" - tot size " << tot_fsize2 <<
" MB" << endl;
95 for(
int j=0;
j<fileList.size();
j++) {
96 bool toBeRemoved=
false;
97 if(fileList[
j].Contains(
"/wave_")) toBeRemoved=
true;
98 if(fileList[
j].Contains(
"/job_")) toBeRemoved=
true;
99 if(fileList[
j].Contains(
"/CWB_Plugin_")) toBeRemoved=
true;
102 int estat = gSystem->GetPathInfo(fileList[
j].Data(),&
id,&size,&flags,&mt);
106 sprintf(cmd,
"rm %s",fileList[
j].Data());
118 fsize=(
int)size_tot/(1024.*1024.);
120 cout <<
"deleted files : " << nfiles <<
" - size " << fsize <<
" MB" << endl;
130 sprintf(cmd,
"du -sm %s",dir.Data());
132 FILE* fp = gSystem->OpenPipe(cmd,
"r");
135 if(fgets(cmdout,
sizeof(cmdout)-1, fp)!=NULL) {
140 SIZE.Resize(SIZE.First(0x9));
141 if(SIZE.IsDigit()) size=SIZE.Atoi();
145 gSystem->ClosePipe(fp);
147 cout <<
"total file size " << size <<
" MB" << endl;
int FilesCleanup(TString dir, int &fsize)
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
strcpy(RunLabel, RUN_LABEL)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
std::vector< wavenode > nodes