peplum 0.2.6 → 0.3.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 +11 -5
- data/lib/peplum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39d9ce50f924ae2ba75b9722feab0a00b40d7c18bca14fdfcfe823de5672ef4b
|
4
|
+
data.tar.gz: 995a13165a99b8dde616ce02fc878876e9ede71b70016f3f08928312cd969566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f5eb468b00c381da6731f52295cce1636875ad4ba19df0494f2c8957e420cd4161599f65faccec22dd3e1238e1dacc2e18242ba4ecf216e5e3cb5686fe98c8a
|
7
|
+
data.tar.gz: bf11c45c00a5a2d1f028ac028060588448a2dbc342c133bf0ab7526c8fe09585f17eb2624897231b4bc06b40199b6b6fa24c937ec43cf30e2b12a9eee933da1f
|
data/lib/peplum/application.rb
CHANGED
@@ -25,6 +25,7 @@ module Peplum
|
|
25
25
|
end
|
26
26
|
|
27
27
|
attr_reader :peers
|
28
|
+
attr_reader :master
|
28
29
|
|
29
30
|
def initialize(*)
|
30
31
|
super
|
@@ -51,16 +52,21 @@ module Peplum
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
55
|
+
def worker?
|
56
|
+
# Has a master?
|
57
|
+
!!@master
|
58
|
+
end
|
59
|
+
|
54
60
|
# Implements:
|
55
61
|
# * `.run` -- Worker; executes its payload against `objects`.
|
56
|
-
# * `.
|
62
|
+
# * `.split` -- Splits given `objects` into groups for each worker.
|
57
63
|
# * `.merge` -- Merges results from multiple workers.
|
58
64
|
#
|
59
65
|
# That's all we need to turn any application into a super version of itself.
|
60
66
|
#
|
61
67
|
# @abstract
|
62
68
|
def payload
|
63
|
-
fail Error, 'Missing payload
|
69
|
+
fail Error, 'Missing #payload!'
|
64
70
|
end
|
65
71
|
|
66
72
|
def report( data )
|
@@ -71,19 +77,19 @@ module Peplum
|
|
71
77
|
|
72
78
|
def execute( peplum_options, payload_options )
|
73
79
|
master_info = peplum_options.delete( 'master' )
|
80
|
+
@master = Processes::Instances.connect( master_info['url'], master_info['token'] )
|
74
81
|
|
75
82
|
self.peers.set( peplum_options.delete( 'peers' ) || {} )
|
76
83
|
|
77
84
|
report_data = payload.run( peplum_options['objects'], payload_options )
|
78
85
|
|
79
|
-
master
|
80
|
-
master.scheduler.report report_data, Cuboid::Options.rpc.url
|
86
|
+
@master.scheduler.report report_data, Cuboid::Options.rpc.url
|
81
87
|
end
|
82
88
|
|
83
89
|
def schedule( peplum_options, payload_options )
|
84
90
|
max_workers = peplum_options.delete('max_workers')
|
85
91
|
objects = peplum_options.delete('objects')
|
86
|
-
groups = payload.
|
92
|
+
groups = payload.split( objects, max_workers )
|
87
93
|
|
88
94
|
# Workload turned out to be less than our maximum allowed instances.
|
89
95
|
# Don't spawn the max if we don't have to.
|
data/lib/peplum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peplum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tasos Laskos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cuboid
|