Changeset cbcbbd
- Timestamp:
- Jul 6, 2012, 10:18:45 AM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 014bc4
- Parents:
- ee61ce
- git-author:
- Frederik Heber <heber@…> (06/01/12 19:53:13)
- git-committer:
- Frederik Heber <heber@…> (07/06/12 10:18:45)
- Location:
- src
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControllerOptions_MPQCCommandJob.cpp
ree61ce rcbcbbd 25 25 #include "ControllerOptions_MPQCCommandJob.hpp" 26 26 27 int ControllerOptions_MPQCCommandJob::parseExecutable(boost::program_options::variables_map &vm) { 28 if ((command == "createjobs") || (command == "addjobs")) { 29 if (!vm.count("executable")) { 30 ELOG(1, "'"+command+"' requires two options: [executable] [jobcommand]."); 31 return 255; 32 } 33 executable = vm["executable"].as< std::string >(); 34 } 35 return 0; 36 } 37 38 int ControllerOptions_MPQCCommandJob::parseJobCommand(boost::program_options::variables_map &vm) { 39 if (command == "createjobs") { 40 if (!vm.count("jobcommand")) { 41 ELOG(1, "'"+command+"' requires two options: [executable] [jobcommand]."); 42 return 255; 43 } 44 jobcommand = vm["jobcommand"].as< std::string >(); 45 } 46 return 0; 47 } 48 27 49 int ControllerOptions_MPQCCommandJob::parseFragmentpath(boost::program_options::variables_map &vm) { 28 50 if (command == "receivempqc") { -
src/ControllerOptions_MPQCCommandJob.hpp
ree61ce rcbcbbd 18 18 #include <string> 19 19 20 #include "ControllerOptions _SystemCommandJob.hpp"20 #include "ControllerOptions.hpp" 21 21 22 struct ControllerOptions_MPQCCommandJob : public ControllerOptions _SystemCommandJob22 struct ControllerOptions_MPQCCommandJob : public ControllerOptions 23 23 { 24 int parseExecutable(boost::program_options::variables_map &vm); 25 int parseJobCommand(boost::program_options::variables_map &vm); 26 24 27 int parseFragmentpath(boost::program_options::variables_map &vm); 25 28 int parseJobfiles(boost::program_options::variables_map &vm); 26 29 30 std::string executable; 31 std::string jobcommand; 27 32 std::string fragmentpath; 28 33 std::vector<std::string> jobfiles; -
src/Makefile.am
ree61ce rcbcbbd 381 381 Fragmentation/Automation/Pool/WorkerPool.hpp 382 382 383 Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp ControllerCommand.hpp ControllerCommandRegistry.cpp ControllerCommandRegistry.hpp DefaultOptions.cpp DefaultOptions.hpp ControllerOptions.cpp ControllerOptions.hpp ControllerOptions_MPQCCommandJob.cpp ControllerOptions_MPQCCommandJob.hpp ControllerOptions_SystemCommandJob.cpp ControllerOptions_SystemCommandJob.hpp 383 Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp controller_MPQCCommandJob.cpp controller_MPQCCommandJob.hpp ControllerCommand.hpp ControllerCommandRegistry.cpp ControllerCommandRegistry.hpp DefaultOptions.cpp DefaultOptions.hpp ControllerOptions.cpp ControllerOptions.hpp ControllerOptions_MPQCCommandJob.cpp ControllerOptions_MPQCCommandJob.hpp 384 #controller_SystemCommandJob.cpp controller_SystemCommandJob.hpp ControllerOptions_SystemCommandJob.cpp ControllerOptions_SystemCommandJob.hpp 384 385 Controller_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PROGRAM__OPTIONS_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS) 385 386 Controller_CXXFLAGS = $(AM_CPPFLAGS) -
src/controller.cpp
ree61ce rcbcbbd 40 40 #include "CodePatterns/Info.hpp" 41 41 #include "CodePatterns/Log.hpp" 42 #include "Fragmentation/EnergyMatrix.hpp" 43 #include "Fragmentation/ForceMatrix.hpp" 44 #include "Fragmentation/KeySetsContainer.hpp" 42 45 43 #include "FragmentController.hpp" 46 #include "Helpers/defs.hpp"47 #include "Jobs/MPQCCommandJob.hpp"48 #include "Jobs/MPQCCommandJob_MPQCData.hpp"49 #include "Fragmentation/Automation/Jobs/SystemCommandJob.hpp"50 #include "Fragmentation/Automation/Results/FragmentResult.hpp"51 44 #include "ControllerOptions_MPQCCommandJob.hpp" 52 #include "ControllerOptions_SystemCommandJob.hpp"53 45 #include "ControllerCommandRegistry.hpp" 46 47 #include "controller_MPQCCommandJob.hpp" 54 48 55 49 /** Print the status of scheduled and done jobs. … … 63 57 } 64 58 65 /** Creates a MPQCCommandJob with argument \a filename. 66 * 67 * @param jobs created job is added to this vector 68 * @param command mpqc command to execute 69 * @param filename filename being argument to job 70 * @param nextid id for this job 71 */ 72 void parsejob( 73 std::vector<FragmentJob::ptr> &jobs, 74 const std::string &command, 75 const std::string &filename, 76 const JobId_t nextid) 59 inline std::vector<std::string> getListOfCommands(const ControllerCommandRegistry &ControllerCommands) 77 60 { 78 std::ifstream file; 79 file.open(filename.c_str()); 80 ASSERT( file.good(), "parsejob() - file "+filename+" does not exist."); 81 std::string output((std::istreambuf_iterator<char>(file)), 82 std::istreambuf_iterator<char>()); 83 FragmentJob::ptr testJob( new MPQCCommandJob(output, nextid, command) ); 84 jobs.push_back(testJob); 85 file.close(); 86 LOG(1, "INFO: Added MPQCCommandJob from file "+filename+"."); 87 } 61 std::vector<std::string> Commands; 62 for (ControllerCommandRegistry::const_iterator iter = ControllerCommands.getBeginIter(); 63 iter != ControllerCommands.getEndIter(); ++iter) 64 Commands.push_back(iter->first); 88 65 89 /** Print received results. 90 * 91 * @param results received results to print 92 */ 93 void printReceivedResults(const std::vector<FragmentResult::ptr> &results) 94 { 95 for (std::vector<FragmentResult::ptr>::const_iterator iter = results.begin(); 96 iter != results.end(); ++iter) 97 LOG(1, "RESULT: job #"+toString((*iter)->getId())+": "+toString((*iter)->result)); 98 } 99 100 /** Print MPQCData from received results. 101 * 102 * @param results received results to extract MPQCData from 103 * @param KeySetFilename filename with keysets to associate forces correctly 104 * @param NoAtoms total number of atoms 105 */ 106 bool printReceivedMPQCResults( 107 const std::vector<FragmentResult::ptr> &results, 108 const std::string &KeySetFilename, 109 size_t NoAtoms) 110 { 111 EnergyMatrix Energy; 112 EnergyMatrix EnergyFragments; 113 ForceMatrix Force; 114 ForceMatrix ForceFragments; 115 KeySetsContainer KeySet; 116 117 // align fragments 118 std::map< JobId_t, size_t > MatrixNrLookup; 119 size_t FragmentCounter = 0; 120 { 121 // bring ids in order ... 122 typedef std::map< JobId_t, FragmentResult::ptr> IdResultMap_t; 123 IdResultMap_t IdResultMap; 124 for (std::vector<FragmentResult::ptr>::const_iterator iter = results.begin(); 125 iter != results.end(); ++iter) { 126 #ifndef NDEBUG 127 std::pair< IdResultMap_t::iterator, bool> inserter = 128 #endif 129 IdResultMap.insert( make_pair((*iter)->getId(), *iter) ); 130 ASSERT( inserter.second, 131 "printReceivedMPQCResults() - two results have same id " 132 +toString((*iter)->getId())+"."); 133 } 134 // ... and fill lookup 135 for(IdResultMap_t::const_iterator iter = IdResultMap.begin(); 136 iter != IdResultMap.end(); ++iter) 137 MatrixNrLookup.insert( make_pair(iter->first, FragmentCounter++) ); 138 } 139 LOG(1, "INFO: There are " << FragmentCounter << " fragments."); 140 141 // extract results 142 std::vector<MPQCData> fragmentData(results.size()); 143 MPQCData combinedData; 144 145 LOG(2, "DEBUG: Parsing now through " << results.size() << " results."); 146 for (std::vector<FragmentResult::ptr>::const_iterator iter = results.begin(); 147 iter != results.end(); ++iter) { 148 LOG(1, "RESULT: job #"+toString((*iter)->getId())+": "+toString((*iter)->result)); 149 MPQCData extractedData; 150 std::stringstream inputstream((*iter)->result); 151 LOG(2, "DEBUG: First 50 characters FragmentResult's string: "+(*iter)->result.substr(0, 50)); 152 boost::archive::text_iarchive ia(inputstream); 153 ia >> extractedData; 154 LOG(1, "INFO: extracted data is " << extractedData << "."); 155 156 // place results into EnergyMatrix ... 157 { 158 MatrixContainer::MatrixArray matrix; 159 matrix.resize(1); 160 matrix[0].resize(1, extractedData.energy); 161 if (!Energy.AddMatrix( 162 std::string("MPQCJob ")+toString((*iter)->getId()), 163 matrix, 164 MatrixNrLookup[(*iter)->getId()])) { 165 ELOG(1, "Adding energy matrix failed."); 166 return false; 167 } 168 } 169 // ... and ForceMatrix (with two empty columns in front) 170 { 171 MatrixContainer::MatrixArray matrix; 172 const size_t rows = extractedData.forces.size(); 173 matrix.resize(rows); 174 for (size_t i=0;i<rows;++i) { 175 const size_t columns = 2+extractedData.forces[i].size(); 176 matrix[i].resize(columns, 0.); 177 // for (size_t j=0;j<2;++j) 178 // matrix[i][j] = 0.; 179 for (size_t j=2;j<columns;++j) 180 matrix[i][j] = extractedData.forces[i][j-2]; 181 } 182 if (!Force.AddMatrix( 183 std::string("MPQCJob ")+toString((*iter)->getId()), 184 matrix, 185 MatrixNrLookup[(*iter)->getId()])) { 186 ELOG(1, "Adding force matrix failed."); 187 return false; 188 } 189 } 190 } 191 // add one more matrix (not required for energy) 192 MatrixContainer::MatrixArray matrix; 193 matrix.resize(1); 194 matrix[0].resize(1, 0.); 195 if (!Energy.AddMatrix(std::string("MPQCJob total"), matrix, FragmentCounter)) 196 return false; 197 // but for energy because we need to know total number of atoms 198 matrix.resize(NoAtoms); 199 for (size_t i = 0; i< NoAtoms; ++i) 200 matrix[i].resize(2+NDIM, 0.); 201 if (!Force.AddMatrix(std::string("MPQCJob total"), matrix, FragmentCounter)) 202 return false; 203 204 205 // combine all found data 206 if (!Energy.InitialiseIndices()) return false; 207 208 if (!Force.ParseIndices(KeySetFilename.c_str())) return false; 209 210 if (!KeySet.ParseKeySets(KeySetFilename.c_str(), Force.RowCounter, Force.MatrixCounter)) return false; 211 212 if (!KeySet.ParseManyBodyTerms()) return false; 213 214 if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return false; 215 if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return false; 216 217 if(!Energy.SetLastMatrix(0., 0)) return false; 218 if(!Force.SetLastMatrix(0., 2)) return false; 219 220 for (int BondOrder=0;BondOrder<KeySet.Order;BondOrder++) { 221 // --------- sum up energy -------------------- 222 LOG(1, "INFO: Summing energy of order " << BondOrder+1 << " ..."); 223 if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return false; 224 if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return false; 225 226 // --------- sum up Forces -------------------- 227 LOG(1, "INFO: Summing forces of order " << BondOrder+1 << " ..."); 228 if (!ForceFragments.SumSubManyBodyTerms(Force, KeySet, BondOrder)) return false; 229 if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return false; 230 } 231 232 // for debugging print resulting energy and forces 233 LOG(1, "INFO: Resulting energy is " << Energy.Matrix[ FragmentCounter ][0][0]); 234 std::stringstream output; 235 for (int i=0; i< Force.RowCounter[FragmentCounter]; ++i) { 236 for (int j=0; j< Force.ColumnCounter[FragmentCounter]; ++j) 237 output << Force.Matrix[ FragmentCounter ][i][j] << " "; 238 output << "\n"; 239 } 240 LOG(1, "INFO: Resulting forces are " << std::endl << output.str()); 241 242 return true; 243 } 244 245 /** Helper function to get number of atoms somehow. 246 * 247 * Here, we just parse the number of lines in the adjacency file as 248 * it should correspond to the number of atoms, except when some atoms 249 * are not bonded, but then fragmentation makes no sense. 250 * 251 * @param path path to the adjacency file 252 */ 253 size_t getNoAtomsFromAdjacencyFile(const std::string &path) 254 { 255 size_t NoAtoms = 0; 256 257 // parse in special file to get atom count (from line count) 258 std::string filename(path); 259 filename += FRAGMENTPREFIX; 260 filename += ADJACENCYFILE; 261 std::ifstream adjacency(filename.c_str()); 262 if (adjacency.fail()) { 263 LOG(0, endl << "getNoAtomsFromAdjacencyFile() - Unable to open " << filename << ", is the directory correct?"); 264 return false; 265 } 266 std::string buffer; 267 while (getline(adjacency, buffer)) 268 NoAtoms++; 269 LOG(1, "INFO: There are " << NoAtoms << " atoms."); 270 271 return NoAtoms; 272 } 273 274 /** Creates a SystemCommandJob out of give \a command with \a argument. 275 * 276 * @param controller reference to controller to add jobs 277 * @param ControllerInfo information on the job 278 */ 279 void createJobs(FragmentController &controller, const ControllerOptions_SystemCommandJob &ControllerInfo) 280 { 281 const JobId_t next_id = controller.getAvailableId(); 282 FragmentJob::ptr testJob( 283 new SystemCommandJob(ControllerInfo.executable, ControllerInfo.jobcommand, next_id) ); 284 std::vector<FragmentJob::ptr> jobs; 285 jobs.push_back(testJob); 286 controller.addJobs(jobs); 287 controller.sendJobs(ControllerInfo.server, ControllerInfo.serverport); 288 LOG(1, "INFO: Added one SystemCommandJob."); 289 } 290 291 /** Creates a MPQCCommandJob out of give \a command with \a argument. 292 * 293 * @param controller reference to controller to add jobs 294 * @param ControllerInfo information on the job 295 */ 296 void AddJobs(FragmentController &controller, const ControllerOptions_MPQCCommandJob &ControllerInfo) 297 { 298 std::vector<FragmentJob::ptr> jobs; 299 for (std::vector< std::string >::const_iterator iter = ControllerInfo.jobfiles.begin(); 300 iter != ControllerInfo.jobfiles.end(); ++iter) { 301 const JobId_t next_id = controller.getAvailableId(); 302 const std::string &filename = *iter; 303 LOG(1, "INFO: Creating MPQCCommandJob with filename '" 304 +filename+"', and id "+toString(next_id)+"."); 305 parsejob(jobs, ControllerInfo.executable, filename, next_id); 306 } 307 controller.addJobs(jobs); 308 controller.sendJobs(ControllerInfo.server, ControllerInfo.serverport); 66 return Commands; 309 67 } 310 68 … … 317 75 size_t Exitflag = 0; 318 76 319 ControllerOptions _MPQCCommandJob ControllerInfo;77 ControllerOptions *ControllerInfo = allocateControllerInfo(); 320 78 boost::asio::io_service io_service; 321 79 FragmentController controller(io_service); … … 326 84 // in contrast to other functions that return void 327 85 ControllerCommandRegistry ControllerCommands; 328 ControllerCommands.registerInstance(new ControllerCommand("addjobs", 329 boost::assign::list_of< ControllerCommand::commands_t > 330 (boost::bind(&FragmentController::requestIds, 331 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport), 332 boost::bind(&std::vector<std::string>::size, boost::cref(ControllerInfo.jobfiles)))) 333 (boost::bind(&AddJobs, boost::ref(controller), boost::cref(ControllerInfo))) 334 )); 335 ControllerCommands.registerInstance(new ControllerCommand("createjobs", 336 boost::assign::list_of< ControllerCommand::commands_t > 337 (boost::bind(&FragmentController::requestIds, 338 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport), 1)) 339 (boost::bind(&createJobs, boost::ref(controller), boost::cref(ControllerInfo))) 340 )); 341 ControllerCommands.registerInstance(new ControllerCommand("checkresults", 86 boost::function<void (ControllerCommand *)> registrator = 87 (boost::bind(&Registry<ControllerCommand>::registerInstance, boost::ref(ControllerCommands), _1)); 88 registrator(new ControllerCommand("checkresults", 342 89 boost::assign::list_of< ControllerCommand::commands_t > 343 90 (boost::bind(&FragmentController::checkResults, 344 boost::ref(controller), boost::cref(ControllerInfo .server), boost::cref(ControllerInfo.serverport)))91 boost::ref(controller), boost::cref(ControllerInfo->server), boost::cref(ControllerInfo->serverport))) 345 92 (boost::bind(&printJobStatus, 346 93 boost::bind(&FragmentController::getJobStatus, boost::ref(controller)))) 347 94 )); 348 ControllerCommands.registerInstance(new ControllerCommand("receiveresults", 349 boost::assign::list_of< ControllerCommand::commands_t > 350 (boost::bind(&FragmentController::receiveResults, 351 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport))) 352 (boost::bind(&printReceivedResults, 353 boost::bind(&FragmentController::getReceivedResults, boost::ref(controller)))) 354 )); 355 ControllerCommands.registerInstance(new ControllerCommand("receivempqc", 356 boost::assign::list_of< ControllerCommand::commands_t > 357 (boost::bind(&FragmentController::receiveResults, 358 boost::ref(controller), boost::cref(ControllerInfo.server), boost::cref(ControllerInfo.serverport))) 359 (boost::bind(&printReceivedMPQCResults, 360 boost::bind(&FragmentController::getReceivedResults, boost::ref(controller)), 361 boost::cref(ControllerInfo.fragmentpath), 362 boost::bind(&getNoAtomsFromAdjacencyFile, boost::cref(ControllerInfo.fragmentpath)))) 363 )); 364 ControllerCommands.registerInstance(new ControllerCommand("removeall", 95 registrator(new ControllerCommand("removeall", 365 96 boost::assign::list_of< ControllerCommand::commands_t > 366 97 (boost::bind(&FragmentController::removeall, 367 boost::ref(controller), boost::cref(ControllerInfo .server), boost::cref(ControllerInfo.serverport)))98 boost::ref(controller), boost::cref(ControllerInfo->server), boost::cref(ControllerInfo->serverport))) 368 99 )); 369 ControllerCommands.registerInstance(new ControllerCommand("shutdown",100 registrator(new ControllerCommand("shutdown", 370 101 boost::assign::list_of< ControllerCommand::commands_t > 371 102 (boost::bind(&FragmentController::shutdown, 372 boost::ref(controller), boost::cref(ControllerInfo .server), boost::cref(ControllerInfo.serverport)))103 boost::ref(controller), boost::cref(ControllerInfo->server), boost::cref(ControllerInfo->serverport))) 373 104 )); 374 std::vector<std::string> Commands; 375 for (ControllerCommandRegistry::const_iterator iter = ControllerCommands.getBeginIter(); 376 iter != ControllerCommands.getEndIter(); ++iter) 377 Commands.push_back(iter->first); 105 addSpecificCommands(registrator, controller, *ControllerInfo, vm); 378 106 379 107 // Declare the supported options. … … 383 111 ("verbosity,v", boost::program_options::value<size_t>(), "set verbosity level") 384 112 ("server", boost::program_options::value< std::string >(), "connect to server at this address (host:port)") 385 ("command", boost::program_options::value< std::string >(), (std::string("command to send to server: ")+toString(Commands)).c_str()) 386 ("executable", boost::program_options::value< std::string >(), "executable for commands 'addjobs' and 'createjobs'") 387 ("fragment-path", boost::program_options::value< std::string >(), "path to fragment files for 'receivempqc'") 388 ("jobcommand", boost::program_options::value< std::string >(), "command argument for executable for 'createjobs'") 389 ("jobfiles", boost::program_options::value< std::vector< std::string > >()->multitoken(), "list of files as single argument to executable for 'addjobs'") 113 ("command", boost::program_options::value< std::string >(), (std::string("command to send to server: ")+toString(getListOfCommands(ControllerCommands))).c_str()) 390 114 ; 115 addSpecificOptions(desc.add_options()); 391 116 392 117 // parse command line … … 396 121 // set controller information 397 122 int status = 0; 398 status = ControllerInfo .parseHelp(vm, desc);123 status = ControllerInfo->parseHelp(vm, desc); 399 124 if (status) return status; 400 status = ControllerInfo .parseVerbosity(vm);125 status = ControllerInfo->parseVerbosity(vm); 401 126 if (status) return status; 402 status = ControllerInfo .parseServerPort(vm);127 status = ControllerInfo->parseServerPort(vm); 403 128 if (status) return status; 404 status = ControllerInfo .parseCommand(vm, Commands);129 status = ControllerInfo->parseCommand(vm, getListOfCommands(ControllerCommands)); 405 130 if (status) return status; 406 131 407 132 // all later parse functions depend on parsed command 408 status = ControllerInfo.parseExecutable(vm); 409 if (status) return status; 410 status = ControllerInfo.parseJobCommand(vm); 411 if (status) return status; 412 status = ControllerInfo.parseFragmentpath(vm); 413 if (status) return status; 414 status = ControllerInfo.parseJobfiles(vm); 133 status = addOtherParsings(*ControllerInfo, vm, ControllerCommands); 415 134 if (status) return status; 416 135 417 136 // parse given ControllerCommand 418 if(!ControllerCommands.isPresentByName(ControllerInfo .command)) {419 ELOG(1, "Unrecognized command '"+toString(ControllerInfo .command)+"'.");137 if(!ControllerCommands.isPresentByName(ControllerInfo->command)) { 138 ELOG(1, "Unrecognized command '"+toString(ControllerInfo->command)+"'."); 420 139 return 255; 421 140 } 422 const ControllerCommand *commands = ControllerCommands.getByName(ControllerInfo .command);141 const ControllerCommand *commands = ControllerCommands.getByName(ControllerInfo->command); 423 142 try 424 143 { … … 440 159 std::cerr << e.what() << std::endl; 441 160 } 161 delete ControllerInfo; 442 162 443 163 return Exitflag;
Note:
See TracChangeset
for help on using the changeset viewer.