diff -C 3 -P -r MetaData/interface/ResumeRun.h MetaData.new/interface/ResumeRun.h *** MetaData/interface/ResumeRun.h Sat Jan 11 01:04:34 2003 --- MetaData.new/interface/ResumeRun.h Wed Jan 29 23:52:17 2003 *************** *** 30,35 **** --- 30,39 ---- const ooRef(CollectionI) & eventColl() { return eventColl_; } const string & stringUUID() { return stringUUID_; } + char const *AutoResumeFileName(); + bool AutoResumeEnabled(); + void AddAutoResumeData(string const &config_data); + private: ooRef(SmartRun) run_; diff -C 3 -P -r MetaData/src/DBPopulator.cc MetaData.new/src/DBPopulator.cc *** MetaData/src/DBPopulator.cc Thu Jan 23 19:56:06 2003 --- MetaData.new/src/DBPopulator.cc Wed Jan 29 23:53:16 2003 *************** *** 358,383 **** commitNext = false; // do not commit again... cout << "\n\n"; cout << "-----------------------------------------------------------------"<< endl; cout << "Here the run really starts" << endl; ! cout << "If crashes use this datacard to start from last commit" << endl; ! cout << "CARF:ResumeRun = " << string(run.sprint()); ! cout << " " << string(eventColl.sprint()) << endl; cout << "-----------------------------------------------------------------"<< endl; cout << "\n\n" << endl; runStatusLog("CARF:ResumeRun", //string("\"")+ ! string(run.sprint())+ ! string(" ")+string(eventColl.sprint()) // +string("\"") ); // temporary ofstream cr((string(uuidN)+string(".runid")).c_str()); ! cr << "CARF:ResumeRun = " << string(run.sprint()); ! cr << " " << string(eventColl.sprint())<< endl; cr.close(); return true; --- 358,401 ---- commitNext = false; // do not commit again... + string resume_data = string(run.sprint())+ + string(" ")+string(eventColl.sprint()); + cout << "\n\n"; cout << "-----------------------------------------------------------------"<< endl; cout << "Here the run really starts" << endl; ! if(ResumeRun::exists()) { ! if(ResumeRun::instance()->AutoResumeEnabled()) { ! cout << "In case it does not finish, simply restart and it will" << endl ! << "resume using the following datacard, from" << endl ! << "the AutoResumeRun file " ! << ResumeRun::instance()->AutoResumeFileName() << "." << endl; ! } ! else { ! cout << "If crashes use this datacard to start from last commit" << endl; ! } ! ! cout << "CARF:ResumeRun = " << resume_data << endl; ! } cout << "-----------------------------------------------------------------"<< endl; cout << "\n\n" << endl; runStatusLog("CARF:ResumeRun", //string("\"")+ ! resume_data // +string("\"") ); + if(ResumeRun::exists() && ResumeRun::instance()->run()==0) { + //This is a new run. Record data for CARF:AutoResumeRun + ResumeRun::instance()->AddAutoResumeData(string("CARF:ResumeRun = ")+ + resume_data + ); + } + // temporary ofstream cr((string(uuidN)+string(".runid")).c_str()); ! cr << "CARF:ResumeRun = " << resume_data << endl; cr.close(); return true; diff -C 3 -P -r MetaData/src/ResumeRun.cc MetaData.new/src/ResumeRun.cc *** MetaData/src/ResumeRun.cc Sat Jan 11 01:04:34 2003 --- MetaData.new/src/ResumeRun.cc Wed Jan 29 23:54:59 2003 *************** *** 8,13 **** --- 8,15 ---- #include "Utilities/Notification/interface/ErrorReport.h" #include "Utilities/UI/interface/ConfigurableVector.h" + #include "Utilities/GenUtil/interface/ConfigurationRecord.h" + #include "Utilities/UI/interface/SimpleConfiguration.h" // DELETE #include "Utilities/ObjyUtil/interface/ObjyAncillaryTransaction.h" *************** *** 26,38 **** // static ConfigurableVector srun("CARF:ResumeRun"); ! if (srun.size()<2) return; cout << "\nresuming run " << srun[0] << " collection " << srun[1] << endl; - // DELETE ObjyAncillaryTransaction a(oocRead, oocMROW); --- 28,55 ---- // static ConfigurableVector srun("CARF:ResumeRun"); ! ! if (AutoResumeEnabled()) { ! char const *resume_fname = AutoResumeFileName(); ! ! ifstream resume_file(resume_fname); ! if(resume_file) { //file exists, this must be a restarted run ! ! //Load the saved configuration (CARF:ResumeRun) ! ConfigurationRecord resume_conf(resume_file); ! SimpleConfiguration *conf = SimpleConfiguration::current(); ! if(conf) conf->add(resume_conf); ! ! } ! //else no existing file, this must be a new run ! //resume file will be created in AddAutoResumeData() ! } ! if (srun.size()<2) return; cout << "\nresuming run " << srun[0] << " collection " << srun[1] << endl; // DELETE ObjyAncillaryTransaction a(oocRead, oocMROW); *************** *** 63,65 **** --- 80,104 ---- } ResumeRun::~ResumeRun(){} + + char const *ResumeRun::AutoResumeFileName() { + static ConfigurableVector auto_resume("CARF:AutoResumeRun"); + if(auto_resume.size() == 1) return auto_resume[0].c_str(); + return NULL; + } + + bool ResumeRun::AutoResumeEnabled() { + return AutoResumeFileName() != NULL; + } + + void ResumeRun::AddAutoResumeData(string const &config_data) { + + if (AutoResumeEnabled()) { + char const *resume_fname = AutoResumeFileName(); + + ofstream resume_file(resume_fname,ios::ate); + if(resume_file) { + resume_file << config_data << endl; + } + } + }