peplum 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peplum/application.rb +12 -12
- data/lib/peplum/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba9afc619d143df37446d3a6106a81df6fa2e7123faf3266d764b07221526361
|
4
|
+
data.tar.gz: c1317747cf60bb0ad277afcd18e37a9f75d669a1fffa3152e6d433bc415b1178
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1451674a3ba4585df1efd8acdb2ad2860f83b4b12f446b51de6ecda1caa858ba5c9eaf5c5b4046181eca54cce5690969a5d6072818d13f3dc25c51ab198590c8
|
7
|
+
data.tar.gz: 9a3c612baae480207d083a3276c9c9aba9aeb6b13781435634b8336fe12ac3c8b21a210044d00dab954099ed7d5c82b023a9d383125594303c487cce37c6ed64
|
data/lib/peplum/application.rb
CHANGED
@@ -41,15 +41,15 @@ module Peplum
|
|
41
41
|
|
42
42
|
options = @options.dup
|
43
43
|
peplum_options = options.delete( 'peplum' )
|
44
|
-
|
44
|
+
payload_options = options.delete( 'payload' )
|
45
45
|
|
46
46
|
# We have a master so we're not the scheduler, run the payload.
|
47
47
|
if peplum_options['master']
|
48
|
-
execute( peplum_options,
|
48
|
+
execute( peplum_options, payload_options )
|
49
49
|
|
50
50
|
# We're the scheduler Instance, get to grouping and spawning.
|
51
51
|
else
|
52
|
-
schedule( peplum_options,
|
52
|
+
schedule( peplum_options, payload_options )
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -61,31 +61,31 @@ module Peplum
|
|
61
61
|
# That's all we need to turn any application into a super version of itself.
|
62
62
|
#
|
63
63
|
# @abstract
|
64
|
-
def
|
65
|
-
fail Error, 'Missing
|
64
|
+
def payload
|
65
|
+
fail Error, 'Missing payload app!'
|
66
66
|
end
|
67
67
|
|
68
68
|
def report( data )
|
69
|
-
super
|
69
|
+
super payload.merge( data )
|
70
70
|
end
|
71
71
|
|
72
72
|
private
|
73
73
|
|
74
|
-
def execute( peplum_options,
|
74
|
+
def execute( peplum_options, payload_options )
|
75
75
|
master_info = peplum_options.delete( 'master' )
|
76
76
|
|
77
77
|
self.peers.set( peplum_options.delete( 'peers' ) || {} )
|
78
78
|
|
79
|
-
report_data =
|
79
|
+
report_data = payload.run( peplum_options['objects'], payload_options )
|
80
80
|
|
81
81
|
master = Processes::Instances.connect( master_info['url'], master_info['token'] )
|
82
82
|
master.scheduler.report report_data, Cuboid::Options.rpc.url
|
83
83
|
end
|
84
84
|
|
85
|
-
def schedule( peplum_options,
|
85
|
+
def schedule( peplum_options, payload_options )
|
86
86
|
max_workers = peplum_options.delete('max_workers')
|
87
87
|
objects = peplum_options.delete('objects')
|
88
|
-
groups =
|
88
|
+
groups = payload.group( objects, max_workers )
|
89
89
|
|
90
90
|
# Workload turned out to be less than our maximum allowed instances.
|
91
91
|
# Don't spawn the max if we don't have to.
|
@@ -110,7 +110,7 @@ module Peplum
|
|
110
110
|
# We couldn't get the workers we were going for, Grid reached its capacity,
|
111
111
|
# re-balance distribution.
|
112
112
|
if scheduler.workers.size < groups.size
|
113
|
-
groups =
|
113
|
+
groups = payload.group( objects, scheduler.workers.size )
|
114
114
|
end
|
115
115
|
|
116
116
|
peers = Hash[scheduler.workers.values.map { |client| [client.url, client.token] }]
|
@@ -125,7 +125,7 @@ module Peplum
|
|
125
125
|
token: Cuboid::Options.datastore.token
|
126
126
|
}
|
127
127
|
},
|
128
|
-
|
128
|
+
payload: payload_options
|
129
129
|
)
|
130
130
|
end
|
131
131
|
|
data/lib/peplum/version.rb
CHANGED