-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntime.cpp
More file actions
67 lines (45 loc) · 1.63 KB
/
runtime.cpp
File metadata and controls
67 lines (45 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <cstdlib>
#include "allscale/runtime/runtime.h"
#include "allscale/runtime/utils/timer.h"
#include "allscale/runtime/data/data_item_manager.h"
#include "allscale/runtime/work/scheduler.h"
#include "allscale/runtime/work/treeture.h"
#include "allscale/runtime/work/worker.h"
#include "allscale/runtime/mon/dashboard.h"
#include "allscale/runtime/mon/file_logger.h"
namespace allscale {
namespace runtime {
Runtime::Runtime(com::Network& net) : network(net) {
// start with the basic, periodic executor service
utils::installPeriodicExecutorService(network);
// install data item manager services
network.installServiceOnNodes<data::DataItemManagerService>();
// install treeture service
work::installTreetureStateService(network);
// install scheduler service
work::installSchedulerService(network);
// install dashboard service
mon::installDashbordService(network);
// install file logger service
mon::installFileLoggerService(network);
// install and start workers in nodes
work::startWorkerPool(network);
// wait for all network instances to be at this state
network.sync();
}
void Runtime::shutdown() {
// wait until all network instances are at this point
network.sync();
// start by stopping periodic operations
utils::removePeriodicExecutorService(network);
// wait until all periodic executor are down
network.sync();
// shutdown file logger service
mon::shutdownFileLoggerService(network);
// shutdown dashboard service
mon::shutdownDashbordService(network);
// shut down workers
work::stopWorkerPool(network);
}
} // end of namespace runtime
} // end of namespace allscale