- Timestamp:
- Jun 27, 2012, 4:07:20 PM (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:
- 545446
- Parents:
- 306f60
- git-author:
- Frederik Heber <heber@…> (02/15/12 14:14:19)
- git-committer:
- Frederik Heber <heber@…> (06/27/12 16:07:20)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/FragmentScheduler.cpp
r306f60 rff60cfa 34 34 #include "CodePatterns/Info.hpp" 35 35 #include "CodePatterns/Log.hpp" 36 #include "Jobs/MPQCCommandJob.hpp" 36 37 #include "Jobs/SystemCommandJob.hpp" 37 38 #include "JobId.hpp" … … 39 40 #include "FragmentScheduler.hpp" 40 41 41 FragmentJob::ptr FragmentScheduler::NoJob(new SystemCommandJob(std::string("/bin/false"), std::string("NoJob"), JobId::NoJob)); 42 FragmentJob::ptr FragmentScheduler::NoJob(new SystemCommandJob(std::string("/bin/true"), std::string("dosomething"), JobId::NoJob)); 43 44 /** Helper function to enforce binding of FragmentWorker to possible derived 45 * FragmentJob classes. 46 */ 47 void dummyInit() { 48 SystemCommandJob("/bin/false", "something", JobId::IllegalJob); 49 MPQCCommandJob("nofile", JobId::IllegalJob); 50 } 42 51 43 52 /** Constructor of class FragmentScheduler. -
src/Fragmentation/Automation/Makefile.am
r306f60 rff60cfa 50 50 Controller/Commands/ReceiveJobsOperation.cpp \ 51 51 Controller/Commands/SendResultsOperation.cpp \ 52 Controller/Commands/ShutdownOperation.cpp 52 Controller/Commands/ShutdownOperation.cpp \ 53 GlobalJobId.cpp 53 54 54 55 FRAGMENTATIONAUTOMATIONHEADER = \ … … 62 63 Controller/Commands/ReceiveJobsOperation.hpp \ 63 64 Controller/Commands/SendResultsOperation.hpp \ 64 Controller/Commands/ShutdownOperation.hpp 65 Controller/Commands/ShutdownOperation.hpp \ 66 GlobalJobId.hpp 65 67 66 68 noinst_LTLIBRARIES += libMolecuilderFragmentationAutomation.la -
src/Fragmentation/Automation/controller.cpp
r306f60 rff60cfa 27 27 #include "CodePatterns/MemDebug.hpp" 28 28 29 #include <fstream> 29 30 #include <iostream> 31 #include <map> 32 #include <sstream> 33 #include <streambuf> 30 34 #include <vector> 31 #include <map>32 35 33 36 #include "atexit.hpp" … … 39 42 #include "Controller/Commands/SendResultsOperation.hpp" 40 43 #include "Controller/Commands/ShutdownOperation.hpp" 44 #include "GlobalJobId.hpp" 45 #include "Jobs/MPQCCommandJob.hpp" 41 46 #include "Jobs/SystemCommandJob.hpp" 42 47 #include "Results/FragmentResult.hpp" … … 44 49 enum CommandIndices { 45 50 UnknownCommandIndex = 0, 46 SendJobsIndex = 1, 47 CheckResultsIndex = 2, 48 ReceiveResultsIndex = 3, 49 ShutdownIndex = 4 51 AddJobsIndex = 1, 52 CreateJobsIndex = 2, 53 CheckResultsIndex = 3, 54 ReceiveResultsIndex = 4, 55 ShutdownIndex = 5 50 56 }; 51 57 58 // TODO: replace this instance by a IdPool owned by controller. 59 GlobalJobId globalId; 60 52 61 void createjobs(std::vector<FragmentJob::ptr> &jobs) 53 62 { 54 FragmentJob::ptr testJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), 1) );55 FragmentJob::ptr othertestJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), 2) );63 FragmentJob::ptr testJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), globalId.getNextId()) ); 64 FragmentJob::ptr othertestJob( new SystemCommandJob( std::string("cat"), std::string("Nothing"), globalId.getNextId()) ); 56 65 jobs.push_back(testJob); 57 66 jobs.push_back(othertestJob); 67 } 68 69 void parsejob(std::vector<FragmentJob::ptr> &jobs, const std::string &filename) 70 { 71 std::ifstream file; 72 file.open(filename.c_str()); 73 ASSERT( file.good(), "parsejob() - file "+filename+" does not exist."); 74 std::string output((std::istreambuf_iterator<char>(file)), 75 std::istreambuf_iterator<char>()); 76 FragmentJob::ptr testJob( new MPQCCommandJob(output, globalId.getNextId()) ); 77 jobs.push_back(testJob); 78 file.close(); 79 LOG(1, "INFO: Added MPQCCommandJob from file "+filename+"."); 58 80 } 59 81 … … 136 158 137 159 size_t Exitflag = 0; 138 std::map<std::string, CommandIndices> CommandsMap; 139 CommandsMap.insert( std::make_pair("sendjobs", SendJobsIndex) ); 160 typedef std::map<std::string, CommandIndices> CommandsMap_t; 161 CommandsMap_t CommandsMap; 162 CommandsMap.insert( std::make_pair("addjobs", AddJobsIndex) ); 163 CommandsMap.insert( std::make_pair("createjobs", CreateJobsIndex) ); 140 164 CommandsMap.insert( std::make_pair("checkresults", CheckResultsIndex) ); 141 165 CommandsMap.insert( std::make_pair("receiveresults", ReceiveResultsIndex) ); … … 144 168 { 145 169 // Check command line arguments. 146 if (argc !=4)170 if (argc < 4) 147 171 { 148 std::cerr << "Usage: " << argv[0] << " <host> <port> <command>" << std::endl; 172 std::cerr << "Usage: " << argv[0] << " <host> <port> <command> [options to command]" << std::endl; 173 std::cerr << "List of available commands:" << std::endl; 174 for(CommandsMap_t::const_iterator iter = CommandsMap.begin(); 175 iter != CommandsMap.end(); ++iter) { 176 std::cerr << "\t" << iter->first << std::endl; 177 } 149 178 return 1; 150 179 } … … 154 183 155 184 switch(getCommandIndex(CommandsMap, argv[3])) { 156 case SendJobsIndex: 185 case AddJobsIndex: 186 { 187 std::vector<FragmentJob::ptr> jobs; 188 if (argc == 4) { 189 ELOG(1, "Please add a filename for the MPQCCommandJob."); 190 } else { 191 for (int argcount = 4; argcount < argc; ++argcount) { 192 LOG(1, "INFO: Parsing job for file " << argv[argcount] << "."); 193 parsejob(jobs, argv[argcount]); 194 } 195 addjobs(controller, jobs); 196 sendjobs(controller, argv[1], argv[2]); 197 } 198 break; 199 } 200 case CreateJobsIndex: 157 201 { 158 202 std::vector<FragmentJob::ptr> jobs; … … 189 233 190 234 switch(getCommandIndex(CommandsMap, argv[3])) { 191 case SendJobsIndex: 235 case AddJobsIndex: 236 case CreateJobsIndex: 192 237 break; 193 238 case CheckResultsIndex:
Note:
See TracChangeset
for help on using the changeset viewer.