source: src/JobMarket/Controller/FragmentController.hpp@ 404d2b

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_JobMarket Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 404d2b was 404d2b, checked in by Frederik Heber <heber@…>, 8 years ago

Squashed 'ThirdParty/JobMarket/' content from commit e194722

git-subtree-dir: ThirdParty/JobMarket
git-subtree-split: e19472277e62c493f6c10f1483fe21e64c1039e9

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * FragmentController.hpp
3 *
4 * Created on: Nov 27, 2011
5 * Author: heber
6 */
7
8#ifndef FRAGMENTCONTROLLER_HPP_
9#define FRAGMENTCONTROLLER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <boost/asio.hpp>
17#include <string>
18#include <vector>
19
20#include "JobMarket/Connection.hpp"
21#include "JobMarket/ExitflagContainer.hpp"
22#include "JobMarket/JobId.hpp"
23#include "JobMarket/Jobs/FragmentJob.hpp"
24#include "JobMarket/Results/FragmentResult.hpp"
25
26#include "JobMarket/Operations/OperationRegistry.hpp"
27
28class FragmentController_JobIdProxy;
29
30/** The FragmentController sends bunches of jobs to a FragmentScheduler,
31 * waits for their calculation and is called when they are done. Then,
32 * he loads the bunch of results from the Scheduler.
33 *
34 * While the FragmentScheduler and FragmentWorker rather act on their own
35 * this is the piece to implant into the user software to allow for
36 * communication with the Server/Worker duo to perform the calculation
37 * of the fragments on distant computers.
38 */
39class FragmentController : public ExitflagContainer
40{
41public:
42 FragmentController(boost::asio::io_service& io_service);
43 ~FragmentController();
44
45 void requestIds(const std::string &host, const std::string &service, const size_t NumberIds);
46 JobId_t getAvailableId();
47 void addJobs(std::vector<FragmentJob::ptr> &jobs);
48 void sendJobs(const std::string &host, const std::string &service);
49 void checkResults(const std::string &host, const std::string &service);
50 std::pair<size_t, size_t> getJobStatus() const;
51 void removeWaitingResults(const std::string &host, const std::string &service);
52 void removeWaitingJobs(const std::string &host, const std::string &service);
53 void removeall(const std::string &host, const std::string &service);
54 void receiveResults(const std::string &host, const std::string &service);
55 std::vector<FragmentResult::ptr> getReceivedResults();
56 void shutdown(const std::string &host, const std::string &service);
57
58protected:
59 void changeJobId(FragmentJob::ptr &job, const JobId_t _newid) const;
60
61protected:
62 /// The Connection to the server.
63 Connection connection_;
64
65public:
66 //!> registry with all operations of this controller
67 OperationRegistry Commands;
68
69private:
70 //!> internally bound function that sets the Exitflag to ErrorFlag
71 boost::function<void ()> failed;
72
73private:
74 //!> grant this specifically made proxy access to jobids
75 friend class FragmentController_JobIdProxy;
76
77 //!> list of all job ids that the server currently has
78 std::set<JobId_t> jobids;
79};
80
81#endif /* FRAGMENTCONTROLLER_HPP_ */
Note: See TracBrowser for help on using the repository browser.