#define TSelVerifyDataSet_cxx
#include "TSelVerifyDataSet.h"
#include "TDataSetManager.h"
#include "TDSet.h"
#include "TParameter.h"
#include "TTree.h"
#include "TFile.h"
#include "TNamed.h"
#include "TSystem.h"
#include "TROOT.h"
#include "TEnv.h"
#include "TFileStager.h"
#include "TProofDebug.h"
#include "TProofServ.h"
#include "TFileCollection.h"
#include "TFileInfo.h"
ClassImp(TSelVerifyDataSet)
TSelVerifyDataSet::TSelVerifyDataSet(TTree *)
{
InitMembers();
}
TSelVerifyDataSet::TSelVerifyDataSet()
{
InitMembers();
}
void TSelVerifyDataSet::InitMembers()
{
fFopt = -1;
fSopt = 0;
fRopt = 0;
fAllf = 0;
fCheckstg = 0;
fNonStgf = 0;
fReopen = 0;
fTouch = 0;
fStgf = 0;
fNoaction = 0;
fFullproc = 0;
fLocateonly = 0;
fStageonly = 0;
fDoall = 0;
fGetlistonly = 0;
fScanlist = 0;
fDbg = 0;
fChangedDs = kFALSE;
fTouched = 0;
fOpened = 0;
fDisappeared = 0;
fSubDataSet = 0;
}
void TSelVerifyDataSet::SlaveBegin(TTree *)
{
TString dsname, opts;
TNamed* par = dynamic_cast<TNamed*>(fInput->FindObject("PROOF_VerifyDataSet"));
if (par) {
dsname = par->GetTitle();
} else {
Abort("cannot find dataset name: cannot continue", kAbortProcess);
return;
}
par = dynamic_cast<TNamed*>(fInput->FindObject("PROOF_VerifyDataSetOption"));
if (par) {
opts = par->GetTitle();
} else {
Abort("cannot find verify options: cannot continue", kAbortProcess);
return;
}
par = dynamic_cast<TNamed*>(fInput->FindObject("PROOF_MSS"));
if (par) {
fMss = par->GetTitle();
PDB(kSelector, 2) Info("SlaveBegin", "dataset MSS: '%s'", fMss.Data());
}
par = dynamic_cast<TNamed*>(fInput->FindObject("PROOF_StageOption"));
if (par) {
fStageopts = par->GetTitle();
PDB(kSelector, 2) Info("SlaveBegin", "dataset stage options: '%s'", fStageopts.Data());
}
UInt_t o = 0;
if (!opts.IsNull()) {
if (strstr(opts, "allfiles:") || strchr(opts, 'A'))
o |= TDataSetManager::kAllFiles;
else if (strstr(opts, "staged:") || strchr(opts, 'D'))
o |= TDataSetManager::kStagedFiles;
if (strstr(opts, "open:") || strchr(opts, 'O'))
o |= TDataSetManager::kReopen;
if (strstr(opts, "touch:") || strchr(opts, 'T'))
o |= TDataSetManager::kTouch;
if (strstr(opts, "nostagedcheck:") || strchr(opts, 'I'))
o |= TDataSetManager::kNoStagedCheck;
if (strstr(opts, "noaction:") || strchr(opts, 'N'))
o |= TDataSetManager::kNoAction;
if (strstr(opts, "locateonly:") || strchr(opts, 'L'))
o |= TDataSetManager::kLocateOnly;
if (strstr(opts, "stageonly:") || strchr(opts, 'S'))
o |= TDataSetManager::kStageOnly;
if (strstr(opts, "verbose:") || strchr(opts, 'V'))
o |= TDataSetManager::kDebug;
} else {
o = TDataSetManager::kReopen | TDataSetManager::kDebug;
}
PDB(kSelector, 1) Info("SlaveBegin", "o=%d", o);
fFopt = ((o & TDataSetManager::kAllFiles)) ? -1 : 0;
if (fFopt >= 0) {
if ((o & TDataSetManager::kStagedFiles)) {
fFopt = 10;
} else {
if ((o & TDataSetManager::kReopen)) fFopt++;
if ((o & TDataSetManager::kTouch)) fFopt++;
}
if ((o & TDataSetManager::kNoStagedCheck)) fFopt += 100;
} else {
if ((o & TDataSetManager::kStagedFiles) || (o & TDataSetManager::kReopen) || (o & TDataSetManager::kTouch)) {
Warning("SlaveBegin", "kAllFiles mode: ignoring kStagedFiles or kReopen"
" or kTouch requests");
}
if ((o & TDataSetManager::kNoStagedCheck)) fFopt -= 100;
}
PDB(kSelector, 1) Info("SlaveBegin", "fFopt=%d", fFopt);
fSopt = ((o & TDataSetManager::kNoAction)) ? -1 : 0;
if (fSopt >= 0) {
if ((o & TDataSetManager::kLocateOnly) && (o & TDataSetManager::kStageOnly)) {
Error("SlaveBegin", "kLocateOnly and kStageOnly cannot be processed concurrently");
return;
}
if ((o & TDataSetManager::kLocateOnly)) fSopt = 1;
if ((o & TDataSetManager::kStageOnly)) fSopt = 2;
} else if ((o & TDataSetManager::kLocateOnly) || (o & TDataSetManager::kStageOnly)) {
Warning("SlaveBegin", "kNoAction mode: ignoring kLocateOnly or kStageOnly requests");
}
PDB(kSelector, 1) Info("SlaveBegin", "fSopt=%d", fSopt);
fDbg = ((o & TDataSetManager::kDebug)) ? kTRUE : kFALSE;
fAllf = (fFopt == -1) ? kTRUE : kFALSE;
fCheckstg = (fFopt >= 100 || fFopt < -1) ? kFALSE : kTRUE;
if (fFopt >= 0) fFopt %= 100;
fNonStgf = (fFopt >= 0 && fFopt < 10) ? kTRUE : kFALSE;
fReopen = (fFopt >= 1 && fFopt < 10) ? kTRUE : kFALSE;
fTouch = (fFopt >= 2 && fFopt < 10) ? kTRUE : kFALSE;
fStgf = (fFopt == 10) ? kTRUE : kFALSE;
PDB(kSelector, 1) Info("SlaveBegin",
"fAllf=%d fCheckstg=%d fNonStgf=%d fReopen=%d fTouch=%d fStgf=%d",
fAllf, fCheckstg, fNonStgf, fReopen, fTouch, fStgf);
fNoaction = (fSopt == -1) ? kTRUE : kFALSE;
fFullproc = (fSopt == 0) ? kTRUE : kFALSE;
fLocateonly = (fSopt == 1) ? kTRUE : kFALSE;
fStageonly = (fSopt == 2) ? kTRUE : kFALSE;
PDB(kSelector, 1) Info("SlaveBegin",
"fNoaction=%d fFullproc=%d fLocateonly=%d fStageonly=%d",
fNoaction, fFullproc, fLocateonly, fStageonly);
fDoall = (fRopt == 0) ? kTRUE : kFALSE;
fGetlistonly = (fRopt == 1) ? kTRUE : kFALSE;
fScanlist = (fRopt == 2) ? kTRUE : kFALSE;
PDB(kSelector, 1) Info("SlaveBegin",
"fDoall=%d fGetlistonly=%d fScanlist=%d",
fDoall, fGetlistonly, fScanlist);
TString hostname(TUrl(gSystem->HostName()).GetHostFQDN());
TString thisordinal = gProofServ ? gProofServ->GetOrdinal() : "n.d";
TString title =
TString::Format("TSelVerifyDataSet_%s_%s", hostname.Data(), thisordinal.Data());
fSubDataSet= new TFileCollection(dsname, title);
}
Bool_t TSelVerifyDataSet::Process(Long64_t entry)
{
TDSetElement *fCurrent = 0;
TPair *elemPair = 0;
if (fInput && (elemPair = dynamic_cast<TPair *>
(fInput->FindObject("PROOF_CurrentElement")))) {
if ((fCurrent = dynamic_cast<TDSetElement *>(elemPair->Value())))
Info("Process", "entry %lld: file: '%s'", entry, fCurrent->GetName());
}
if (!fCurrent) {
Error("Process", "entry %lld: current element not found!", entry);
return kFALSE;
}
TFileInfo *fileInfo = dynamic_cast<TFileInfo*>(fCurrent->GetAssocObj(0));
if (!fileInfo) {
Error("Process", "can not get TFileInfo; returning");
return kFALSE;
}
PDB(kSelector, 1) {
Info("Process", "input fileinfo: ");
fileInfo->Print("L");
}
TFileStager *stager = 0;
Bool_t createStager = kFALSE;
TFileInfo* newfileinfo = new TFileInfo(*fileInfo);
newfileinfo->SetIndex(fileInfo->GetIndex());
if (fDoall || fGetlistonly) {
stager = (fMss && strlen(fMss) > 0) ? TFileStager::Open(fMss) : 0;
createStager = (stager) ? kFALSE : kTRUE;
gSystem->DispatchOneEvent(kTRUE);
Bool_t changed = kFALSE;
Bool_t touched = kFALSE;
Bool_t disappeared = kFALSE;
TDataSetManager::CheckStagedStatus(newfileinfo, fFopt, -1, 0, stager, createStager,
fDbg, changed, touched, disappeared);
if (changed) fChangedDs = kTRUE;
if (touched) fTouched++;
if (disappeared) fDisappeared++;
SafeDelete(stager);
PDB(kSelector, 1) Info("Process",
"fChangedDs = %d, fTouched = %d disappeared = %d",
fChangedDs, fTouched, fDisappeared);
if (fGetlistonly) {
Info("Process", "updated fileinfo: ");
newfileinfo->Print("F");
fSubDataSet->Add(newfileinfo);
return kTRUE;
}
}
if (!fNoaction && (fDoall || fScanlist)) {
if (!fDoall && fScanlist) {
SafeDelete(newfileinfo);
newfileinfo = new TFileInfo(*fileInfo);
newfileinfo->SetIndex(fileInfo->GetIndex());
}
PDB(kSelector, 1) Info("Process",
"file appear to be newly staged; %s",
newfileinfo->GetFirstUrl()->GetUrl());
if (fLocateonly || fStageonly) {
stager = (fMss && strlen(fMss) > 0) ? TFileStager::Open(fMss) : 0;
createStager = (stager) ? kFALSE : kTRUE;
}
Bool_t changed = kFALSE;
Bool_t opened = kFALSE;
TDataSetManager::ProcessFile(newfileinfo, fSopt, fCheckstg, fDoall, stager, createStager, fStageopts,
fDbg, changed, opened);
if (changed) fChangedDs = kTRUE;
if (opened) fOpened++;
}
PDB(kSelector, 1) {
Info("Process", "updated fileinfo: ");
newfileinfo->Print("L");
}
fSubDataSet->Add(newfileinfo);
return kTRUE;
}
void TSelVerifyDataSet::SlaveTerminate()
{
if (fSubDataSet) {
fSubDataSet->Update();
if (fSubDataSet->GetNFiles() > 0) {
fOutput->Add(fSubDataSet);
Info("SlaveTerminate",
"sub-dataset '%s' added to the output list (%lld files)",
fSubDataSet->GetTitle(), fSubDataSet->GetNFiles());
}
fOutput->Add(new TNamed(TString::Format("DATASET_%s", fSubDataSet->GetName()).Data(),"OT:sortidx:"));
fOutput->Add(new TNamed("PROOFSERV_RegisterDataSet", ""));
}
TString hostname(TUrl(gSystem->HostName()).GetHostFQDN());
TString thisordinal = gProofServ ? gProofServ->GetOrdinal() : "n.d";
TString sfdisppeared= TString::Format("PROOF_NoFilesDisppeared_%s_%s", hostname.Data(), thisordinal.Data());
fOutput->Add(new TParameter<Int_t>(sfdisppeared.Data(), fDisappeared));
TString sfOpened= TString::Format("PROOF_NoFilesOpened_%s_%s", hostname.Data(), thisordinal.Data());
fOutput->Add(new TParameter<Int_t>(sfOpened.Data(), fOpened));
TString sfTouched = TString::Format("PROOF_NoFilesTouched_%s_%s", hostname.Data(), thisordinal.Data());
fOutput->Add(new TParameter<Int_t>(sfTouched.Data(), fTouched));
TString schanged= TString::Format("PROOF_DataSetChanged_%s_%s", hostname.Data(), thisordinal.Data());
fOutput->Add(new TParameter<Bool_t>(schanged.Data(), fChangedDs));
}
TSelVerifyDataSet.cxx:100 TSelVerifyDataSet.cxx:101 TSelVerifyDataSet.cxx:102 TSelVerifyDataSet.cxx:103 TSelVerifyDataSet.cxx:104 TSelVerifyDataSet.cxx:105 TSelVerifyDataSet.cxx:106 TSelVerifyDataSet.cxx:107 TSelVerifyDataSet.cxx:108 TSelVerifyDataSet.cxx:109 TSelVerifyDataSet.cxx:110 TSelVerifyDataSet.cxx:111 TSelVerifyDataSet.cxx:112 TSelVerifyDataSet.cxx:113 TSelVerifyDataSet.cxx:114 TSelVerifyDataSet.cxx:115 TSelVerifyDataSet.cxx:116 TSelVerifyDataSet.cxx:117 TSelVerifyDataSet.cxx:118 TSelVerifyDataSet.cxx:119 TSelVerifyDataSet.cxx:120 TSelVerifyDataSet.cxx:121 TSelVerifyDataSet.cxx:122 TSelVerifyDataSet.cxx:123 TSelVerifyDataSet.cxx:124 TSelVerifyDataSet.cxx:125 TSelVerifyDataSet.cxx:126 TSelVerifyDataSet.cxx:127 TSelVerifyDataSet.cxx:128 TSelVerifyDataSet.cxx:129 TSelVerifyDataSet.cxx:130 TSelVerifyDataSet.cxx:131 TSelVerifyDataSet.cxx:132 TSelVerifyDataSet.cxx:133 TSelVerifyDataSet.cxx:134 TSelVerifyDataSet.cxx:135 TSelVerifyDataSet.cxx:136 TSelVerifyDataSet.cxx:137 TSelVerifyDataSet.cxx:138 TSelVerifyDataSet.cxx:139 TSelVerifyDataSet.cxx:140 TSelVerifyDataSet.cxx:141 TSelVerifyDataSet.cxx:142 TSelVerifyDataSet.cxx:143 TSelVerifyDataSet.cxx:144 TSelVerifyDataSet.cxx:145 TSelVerifyDataSet.cxx:146 TSelVerifyDataSet.cxx:147 TSelVerifyDataSet.cxx:148 TSelVerifyDataSet.cxx:149 TSelVerifyDataSet.cxx:150 TSelVerifyDataSet.cxx:151 TSelVerifyDataSet.cxx:152 TSelVerifyDataSet.cxx:153 TSelVerifyDataSet.cxx:154 TSelVerifyDataSet.cxx:155 TSelVerifyDataSet.cxx:156 TSelVerifyDataSet.cxx:157 TSelVerifyDataSet.cxx:158 TSelVerifyDataSet.cxx:159 TSelVerifyDataSet.cxx:160 TSelVerifyDataSet.cxx:161 TSelVerifyDataSet.cxx:162 TSelVerifyDataSet.cxx:163 TSelVerifyDataSet.cxx:164 TSelVerifyDataSet.cxx:165 TSelVerifyDataSet.cxx:166 TSelVerifyDataSet.cxx:167 TSelVerifyDataSet.cxx:168 TSelVerifyDataSet.cxx:169 TSelVerifyDataSet.cxx:170 TSelVerifyDataSet.cxx:171 TSelVerifyDataSet.cxx:172 TSelVerifyDataSet.cxx:173 TSelVerifyDataSet.cxx:174 TSelVerifyDataSet.cxx:175 TSelVerifyDataSet.cxx:176 TSelVerifyDataSet.cxx:177 TSelVerifyDataSet.cxx:178 TSelVerifyDataSet.cxx:179 TSelVerifyDataSet.cxx:180 TSelVerifyDataSet.cxx:181 TSelVerifyDataSet.cxx:182 TSelVerifyDataSet.cxx:183 TSelVerifyDataSet.cxx:184 TSelVerifyDataSet.cxx:185 TSelVerifyDataSet.cxx:186 TSelVerifyDataSet.cxx:187 TSelVerifyDataSet.cxx:188 TSelVerifyDataSet.cxx:189 TSelVerifyDataSet.cxx:190 TSelVerifyDataSet.cxx:191 TSelVerifyDataSet.cxx:192 TSelVerifyDataSet.cxx:193 TSelVerifyDataSet.cxx:194 TSelVerifyDataSet.cxx:195 TSelVerifyDataSet.cxx:196 TSelVerifyDataSet.cxx:197 TSelVerifyDataSet.cxx:198 TSelVerifyDataSet.cxx:199 TSelVerifyDataSet.cxx:200 TSelVerifyDataSet.cxx:201 TSelVerifyDataSet.cxx:202 TSelVerifyDataSet.cxx:203 TSelVerifyDataSet.cxx:204 TSelVerifyDataSet.cxx:205 TSelVerifyDataSet.cxx:206 TSelVerifyDataSet.cxx:207 TSelVerifyDataSet.cxx:208 TSelVerifyDataSet.cxx:209 TSelVerifyDataSet.cxx:210 TSelVerifyDataSet.cxx:211 TSelVerifyDataSet.cxx:212 TSelVerifyDataSet.cxx:213 TSelVerifyDataSet.cxx:214 TSelVerifyDataSet.cxx:215 TSelVerifyDataSet.cxx:216 TSelVerifyDataSet.cxx:217 TSelVerifyDataSet.cxx:218 TSelVerifyDataSet.cxx:219 TSelVerifyDataSet.cxx:220 TSelVerifyDataSet.cxx:221 TSelVerifyDataSet.cxx:222 TSelVerifyDataSet.cxx:223 TSelVerifyDataSet.cxx:224 TSelVerifyDataSet.cxx:225 TSelVerifyDataSet.cxx:226 TSelVerifyDataSet.cxx:227 TSelVerifyDataSet.cxx:228 TSelVerifyDataSet.cxx:229 TSelVerifyDataSet.cxx:230 TSelVerifyDataSet.cxx:231 TSelVerifyDataSet.cxx:232 TSelVerifyDataSet.cxx:233 TSelVerifyDataSet.cxx:234 TSelVerifyDataSet.cxx:235 TSelVerifyDataSet.cxx:236 TSelVerifyDataSet.cxx:237 TSelVerifyDataSet.cxx:238 TSelVerifyDataSet.cxx:239 TSelVerifyDataSet.cxx:240 TSelVerifyDataSet.cxx:241 TSelVerifyDataSet.cxx:242 TSelVerifyDataSet.cxx:243 TSelVerifyDataSet.cxx:244 TSelVerifyDataSet.cxx:245 TSelVerifyDataSet.cxx:246 TSelVerifyDataSet.cxx:247 TSelVerifyDataSet.cxx:248 TSelVerifyDataSet.cxx:249 TSelVerifyDataSet.cxx:250 TSelVerifyDataSet.cxx:251 TSelVerifyDataSet.cxx:252 TSelVerifyDataSet.cxx:253 TSelVerifyDataSet.cxx:254 TSelVerifyDataSet.cxx:255 TSelVerifyDataSet.cxx:256 TSelVerifyDataSet.cxx:257 TSelVerifyDataSet.cxx:258 TSelVerifyDataSet.cxx:259 TSelVerifyDataSet.cxx:260 TSelVerifyDataSet.cxx:261 TSelVerifyDataSet.cxx:262 TSelVerifyDataSet.cxx:263 TSelVerifyDataSet.cxx:264 TSelVerifyDataSet.cxx:265 TSelVerifyDataSet.cxx:266 TSelVerifyDataSet.cxx:267 TSelVerifyDataSet.cxx:268 TSelVerifyDataSet.cxx:269 TSelVerifyDataSet.cxx:270 TSelVerifyDataSet.cxx:271 TSelVerifyDataSet.cxx:272 TSelVerifyDataSet.cxx:273 TSelVerifyDataSet.cxx:274 TSelVerifyDataSet.cxx:275 TSelVerifyDataSet.cxx:276 TSelVerifyDataSet.cxx:277 TSelVerifyDataSet.cxx:278 TSelVerifyDataSet.cxx:279 TSelVerifyDataSet.cxx:280 TSelVerifyDataSet.cxx:281 TSelVerifyDataSet.cxx:282 TSelVerifyDataSet.cxx:283 TSelVerifyDataSet.cxx:284 TSelVerifyDataSet.cxx:285 TSelVerifyDataSet.cxx:286 TSelVerifyDataSet.cxx:287 TSelVerifyDataSet.cxx:288 TSelVerifyDataSet.cxx:289 TSelVerifyDataSet.cxx:290 TSelVerifyDataSet.cxx:291 TSelVerifyDataSet.cxx:292 TSelVerifyDataSet.cxx:293 TSelVerifyDataSet.cxx:294 TSelVerifyDataSet.cxx:295 TSelVerifyDataSet.cxx:296 TSelVerifyDataSet.cxx:297 TSelVerifyDataSet.cxx:298 TSelVerifyDataSet.cxx:299 TSelVerifyDataSet.cxx:300 TSelVerifyDataSet.cxx:301 TSelVerifyDataSet.cxx:302 TSelVerifyDataSet.cxx:303 TSelVerifyDataSet.cxx:304 TSelVerifyDataSet.cxx:305 TSelVerifyDataSet.cxx:306 TSelVerifyDataSet.cxx:307 TSelVerifyDataSet.cxx:308 TSelVerifyDataSet.cxx:309 TSelVerifyDataSet.cxx:310 TSelVerifyDataSet.cxx:311 TSelVerifyDataSet.cxx:312 TSelVerifyDataSet.cxx:313 TSelVerifyDataSet.cxx:314 TSelVerifyDataSet.cxx:315 TSelVerifyDataSet.cxx:316 TSelVerifyDataSet.cxx:317 TSelVerifyDataSet.cxx:318 TSelVerifyDataSet.cxx:319 TSelVerifyDataSet.cxx:320 TSelVerifyDataSet.cxx:321 TSelVerifyDataSet.cxx:322 TSelVerifyDataSet.cxx:323 TSelVerifyDataSet.cxx:324 TSelVerifyDataSet.cxx:325 TSelVerifyDataSet.cxx:326 TSelVerifyDataSet.cxx:327 TSelVerifyDataSet.cxx:328 TSelVerifyDataSet.cxx:329 TSelVerifyDataSet.cxx:330 TSelVerifyDataSet.cxx:331 TSelVerifyDataSet.cxx:332 TSelVerifyDataSet.cxx:333 TSelVerifyDataSet.cxx:334 TSelVerifyDataSet.cxx:335 TSelVerifyDataSet.cxx:336 TSelVerifyDataSet.cxx:337 TSelVerifyDataSet.cxx:338 TSelVerifyDataSet.cxx:339 TSelVerifyDataSet.cxx:340 TSelVerifyDataSet.cxx:341 TSelVerifyDataSet.cxx:342 TSelVerifyDataSet.cxx:343 TSelVerifyDataSet.cxx:344 TSelVerifyDataSet.cxx:345 TSelVerifyDataSet.cxx:346 TSelVerifyDataSet.cxx:347 TSelVerifyDataSet.cxx:348 TSelVerifyDataSet.cxx:349 TSelVerifyDataSet.cxx:350 TSelVerifyDataSet.cxx:351 TSelVerifyDataSet.cxx:352 TSelVerifyDataSet.cxx:353 TSelVerifyDataSet.cxx:354 TSelVerifyDataSet.cxx:355 TSelVerifyDataSet.cxx:356 TSelVerifyDataSet.cxx:357 TSelVerifyDataSet.cxx:358 TSelVerifyDataSet.cxx:359 TSelVerifyDataSet.cxx:360 TSelVerifyDataSet.cxx:361 TSelVerifyDataSet.cxx:362 TSelVerifyDataSet.cxx:363 TSelVerifyDataSet.cxx:364 TSelVerifyDataSet.cxx:365