flor 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/LICENSE.txt +1 -1
- data/Makefile +4 -4
- data/README.md +1 -1
- data/lib/flor/colours.rb +2 -2
- data/lib/flor/flor.rb +1 -1
- data/lib/flor/parser.rb +11 -4
- data/lib/flor/unit/caller.rb +13 -5
- data/lib/flor/unit/executor.rb +11 -7
- data/lib/flor/unit/ganger.rb +14 -4
- data/lib/flor/unit/models/message.rb +2 -0
- data/lib/flor/unit/models/pointer.rb +2 -0
- data/lib/flor/unit/models/timer.rb +2 -0
- data/lib/flor/unit/models/trace.rb +2 -0
- data/lib/flor/unit/models/trap.rb +2 -0
- data/lib/flor/unit/storage.rb +5 -5
- data/lib/flor/unit/taskers.rb +5 -2
- data/lib/flor.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b28e7de7c950544c32279d8a63917911ae9d12be4154a1bcc0539c8ae343b6d6
|
4
|
+
data.tar.gz: 1838e6d66710983c5adce4dc19b799bed0a34bf5427ee8156c516749d740e703
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f75fd74bd118784e7cf3285bff5f55d4e97c67f4666332712dc9b878c267690247468372ec3970d6cff570f90f235b31ae182279aec87f77d442d7cfa1c6536a
|
7
|
+
data.tar.gz: 8c4b251c6bd1cc514580aae6430dcc70489ca046940e8a9e23104260f48be0a5049ac70310bcecfa3fdb62d00a8e603c644e177ab1db080e38bea04c1c538fa7
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## flor 1.6.0 released 2023-01-13
|
6
|
+
|
7
|
+
* Add #fei to Message, Pointer, Timer, Trace and Trap models
|
8
|
+
* Allow for // comments in Flor language
|
9
|
+
* Call post_task when tasker hands back task
|
10
|
+
|
11
|
+
|
5
12
|
## flor 1.5.0 released 2021-11-24
|
6
13
|
|
7
14
|
* Add storage callbacks `on(:pointers, :any) { do_that }`
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2015-
|
2
|
+
Copyright (c) 2015-2023, John Mettraux, jmettraux+flor@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
## gem tasks ##
|
3
3
|
|
4
|
-
NAME
|
5
|
-
|
6
|
-
VERSION
|
7
|
-
|
4
|
+
NAME != \
|
5
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name"
|
6
|
+
VERSION != \
|
7
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version"
|
8
8
|
|
9
9
|
count_lines:
|
10
10
|
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ require 'flor/unit'
|
|
47
47
|
# uncomment to see the flor activity
|
48
48
|
|
49
49
|
sto_uri = 'sqlite://flor_qs.db'
|
50
|
-
sto_uri = 'jdbc:sqlite://flor_qs.db' if RUBY_PLATFORM.match(/java/)
|
50
|
+
sto_uri = 'jdbc:sqlite://flor_qs.db' if RUBY_PLATFORM.match?(/java/)
|
51
51
|
|
52
52
|
flor = Flor::Unit.new(loader: Flor::HashLoader, sto_uri: sto_uri)
|
53
53
|
# instantiate flor unit
|
data/lib/flor/colours.rb
CHANGED
@@ -27,7 +27,7 @@ module Flor
|
|
27
27
|
class Colours
|
28
28
|
|
29
29
|
Flor::COLS.each do |k, v|
|
30
|
-
if v.match(/\A\d/)
|
30
|
+
if v.match(/\A\d/) # Ruby 2.3 doesn't have String#match?
|
31
31
|
class_eval(%{
|
32
32
|
def #{k}(s=nil)
|
33
33
|
s ? "[#{v}m" + s + "[0;0m" : "[#{v}m"
|
@@ -42,7 +42,7 @@ module Flor
|
|
42
42
|
class NoColours
|
43
43
|
|
44
44
|
Flor::COLS.each do |k, v|
|
45
|
-
if v.match(/\A\d/)
|
45
|
+
if v.match(/\A\d/) # Ruby 2.3 doesn't have String#match?
|
46
46
|
class_eval("def #{k}(s=''); s; end")
|
47
47
|
else
|
48
48
|
class_eval("alias #{k} #{v}")
|
data/lib/flor/flor.rb
CHANGED
data/lib/flor/parser.rb
CHANGED
@@ -6,6 +6,9 @@ module Flor
|
|
6
6
|
|
7
7
|
#Raabro.pp(Flor::Parser.parse(input, debug: 2), colours: true)
|
8
8
|
#Raabro.pp(Flor::Parser.parse(input, debug: 3), colours: true)
|
9
|
+
#
|
10
|
+
# turn one or the other when debugging the parser...
|
11
|
+
|
9
12
|
opts = fname if fname.is_a?(Hash) && opts.empty?
|
10
13
|
|
11
14
|
if r = Flor::Parser.parse(input, opts)
|
@@ -49,7 +52,7 @@ module Flor
|
|
49
52
|
def semicolon(i); str(nil, i, ';'); end
|
50
53
|
def comma(i); str(nil, i, ','); end
|
51
54
|
def dquote(i); str(nil, i, '"'); end
|
52
|
-
def slash(i);
|
55
|
+
def slash(i); rex(nil, i, /\/(?!\/)/); end
|
53
56
|
def dollar(i); str(nil, i, '$'); end
|
54
57
|
def pipepipe(i); str(nil, i, '||'); end
|
55
58
|
|
@@ -95,7 +98,11 @@ module Flor
|
|
95
98
|
seq(nil, i, :dot, :rf_symbol)
|
96
99
|
end
|
97
100
|
def rf_index(i); alt(nil, i, :rf_dot_idx, :rf_sqa_idx); end
|
98
|
-
|
101
|
+
#
|
102
|
+
def rf_symbol(i)
|
103
|
+
rex(:refsym, i, /([^.:;| \b\f\n\r\t"',()\[\]{}#\\\/]|\/(?!\/))+/)
|
104
|
+
# anything but... a slash is ok, but not a double slash...
|
105
|
+
end
|
99
106
|
#
|
100
107
|
def reference(i); seq(:ref, i, :rf_symbol, :rf_index, '*'); end
|
101
108
|
|
@@ -165,7 +172,7 @@ module Flor
|
|
165
172
|
}x)
|
166
173
|
end
|
167
174
|
|
168
|
-
def comment(i); rex(nil, i,
|
175
|
+
def comment(i); rex(nil, i, /(#|\/\/)[^\r\n]*/); end
|
169
176
|
|
170
177
|
def eol(i); seq(nil, i, :wstar, :comment, '?', :rnstar); end
|
171
178
|
def eol_wstar(i); seq(nil, i, :wstar, :comment, '?', :rnstar, :wstar); end
|
@@ -210,7 +217,7 @@ module Flor
|
|
210
217
|
# %w[ equ == != <> ], %w[ lgt < > <= >= ], %w[ sum + - ], %w[ prd * / % ],
|
211
218
|
|
212
219
|
def ssmod(i); str(:sop, i, /%/); end
|
213
|
-
def ssprd(i); rex(:sop, i, /
|
220
|
+
def ssprd(i); rex(:sop, i, /(\*|\/(?!\/))/); end
|
214
221
|
def sssum(i); rex(:sop, i, /[+-]/); end
|
215
222
|
def sslgt(i); rex(:sop, i, /(<=?|>=?)/); end
|
216
223
|
def ssequ(i); rex(:sop, i, /(==?|!=|<>)/); end
|
data/lib/flor/unit/caller.rb
CHANGED
@@ -110,10 +110,16 @@ module Flor
|
|
110
110
|
pt = message['point']
|
111
111
|
|
112
112
|
ms = [ "call_#{pt}", "on_#{pt}", :on_message, :on, pt ]
|
113
|
-
|
113
|
+
case pt
|
114
|
+
when 'detask' then ms = ms + [ :on_cancel, :cancel ]
|
115
|
+
when 'return' then ms = [ :on_return, :return, :post_task ] # /!\
|
116
|
+
end
|
114
117
|
|
115
118
|
m = ms.find { |mm| o.respond_to?(mm) }
|
116
119
|
|
120
|
+
return [ message ] if pt == 'return' && ! m
|
121
|
+
# don't call if :post_task not present
|
122
|
+
|
117
123
|
fail(
|
118
124
|
"#{k.class.to_s.downcase} #{k} doesn't respond to " +
|
119
125
|
ms[0..-2].collect { |e| "##{e}" }.join(', ') + ", or ##{ms[-1]}"
|
@@ -316,10 +322,12 @@ module Flor
|
|
316
322
|
|
317
323
|
def to_messages(o)
|
318
324
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
325
|
+
if Flor.is_array_of_messages?(o)
|
326
|
+
o
|
327
|
+
elsif Flor.is_message?(o)
|
328
|
+
[ o ]
|
329
|
+
else
|
330
|
+
[]
|
323
331
|
end
|
324
332
|
end
|
325
333
|
|
data/lib/flor/unit/executor.rb
CHANGED
@@ -48,7 +48,7 @@ module Flor
|
|
48
48
|
|
49
49
|
protected
|
50
50
|
|
51
|
-
CLOSING_POINTS = %w[ task terminated ceased ]
|
51
|
+
CLOSING_POINTS = %w[ task terminated ceased ].freeze
|
52
52
|
#
|
53
53
|
# point for messages that, after consumption, are conserved
|
54
54
|
# in the execution's "closing_messages" array
|
@@ -160,14 +160,18 @@ module Flor
|
|
160
160
|
def return(message)
|
161
161
|
|
162
162
|
n = @execution['nodes'][message['nid']] || {}
|
163
|
-
|
164
|
-
c = m['cause']
|
163
|
+
c = (n['message'] || {})['cause']
|
165
164
|
|
166
|
-
|
167
|
-
|
168
|
-
|
165
|
+
ms =
|
166
|
+
if n['task']
|
167
|
+
@unit.ganger.task(self, message)
|
168
|
+
else
|
169
|
+
[ message.dup ]
|
170
|
+
end
|
169
171
|
|
170
|
-
|
172
|
+
ms.each { |m|
|
173
|
+
m['point'] = 'receive'
|
174
|
+
m['cause'] = c if c }
|
171
175
|
end
|
172
176
|
|
173
177
|
def schedule(message)
|
data/lib/flor/unit/ganger.rb
CHANGED
@@ -47,16 +47,14 @@ module Flor
|
|
47
47
|
def task(executor, message)
|
48
48
|
|
49
49
|
domain = message['exid'].split('-', 2).first
|
50
|
-
tname = message['tasker']
|
50
|
+
#tname = message['tasker']
|
51
|
+
tname = determine_tasker_name(executor, message)
|
51
52
|
|
52
53
|
tconf =
|
53
54
|
( ! message['routed'] &&
|
54
55
|
(@unit.loader.tasker(domain, 'ganger', message) ||
|
55
56
|
@unit.loader.tasker(domain, 'tasker', message))) ||
|
56
57
|
@unit.loader.tasker(domain, tname, message)
|
57
|
-
#puts "=" * 80
|
58
|
-
#pp tconf
|
59
|
-
#puts "=" * 80
|
60
58
|
|
61
59
|
fail ArgumentError.new(
|
62
60
|
"tasker #{tname.inspect} not found"
|
@@ -66,6 +64,7 @@ module Flor
|
|
66
64
|
|
67
65
|
points = [ nil, message['point'] ]
|
68
66
|
points << 'detask' if points.include?('cancel')
|
67
|
+
points << 'task' if points.include?('return')
|
69
68
|
|
70
69
|
tconf = tconf.find { |h| points.include?(h['point']) }
|
71
70
|
end
|
@@ -154,6 +153,17 @@ module Flor
|
|
154
153
|
|
155
154
|
vars
|
156
155
|
end
|
156
|
+
|
157
|
+
def determine_tasker_name(executor, message)
|
158
|
+
|
159
|
+
tname = message['tasker']
|
160
|
+
|
161
|
+
return tname if tname
|
162
|
+
|
163
|
+
n = executor.node(message)
|
164
|
+
|
165
|
+
n['task']['tasker']
|
166
|
+
end
|
157
167
|
end
|
158
168
|
end
|
159
169
|
|
@@ -29,6 +29,8 @@ module Flor
|
|
29
29
|
# # we don't care, pointers are cleaned anyway when the flow dies
|
30
30
|
#end
|
31
31
|
|
32
|
+
def fei; [ exid, nid ].join('-'); end
|
33
|
+
|
32
34
|
# If the pointer is a "var" pointer, returns the full value
|
33
35
|
# for the variable, as found in the execution's node "0".
|
34
36
|
#
|
data/lib/flor/unit/storage.rb
CHANGED
@@ -908,11 +908,11 @@ module Flor
|
|
908
908
|
fail ArgumentError.new("no 'sto_uri' conf, cannot connect to db") \
|
909
909
|
unless uri
|
910
910
|
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
911
|
+
begin
|
912
|
+
Kernel.const_get(uri)
|
913
|
+
rescue NameError
|
914
|
+
Sequel.connect(uri)
|
915
|
+
end
|
916
916
|
end
|
917
917
|
|
918
918
|
def connect
|
data/lib/flor/unit/taskers.rb
CHANGED
@@ -169,9 +169,12 @@ module Flor
|
|
169
169
|
|
170
170
|
pt = @message['point']
|
171
171
|
|
172
|
-
ms = [ "post_#{pt}" ]; ms << :post_cancel if pt == 'detask'
|
172
|
+
#ms = [ "post_#{pt}" ]; ms << :post_cancel if pt == 'detask'
|
173
|
+
#call_one_of(ms)
|
173
174
|
#
|
174
|
-
|
175
|
+
# :post_task is called by, well, the caller
|
176
|
+
#
|
177
|
+
call_one_of([ :post_detask, :post_cancel ]) if pt == 'detask'
|
175
178
|
|
176
179
|
msg = derive_message(message)
|
177
180
|
|
data/lib/flor.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: munemo
|
@@ -290,7 +290,7 @@ metadata:
|
|
290
290
|
mailing_list_uri: https://groups.google.com/forum/#!forum/floraison
|
291
291
|
homepage_uri: https://github.com/floraison/flor
|
292
292
|
source_code_uri: https://github.com/floraison/flor
|
293
|
-
post_install_message:
|
293
|
+
post_install_message:
|
294
294
|
rdoc_options: []
|
295
295
|
require_paths:
|
296
296
|
- lib
|
@@ -305,8 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
307
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
308
|
+
rubygems_version: 3.1.6
|
309
|
+
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: A Ruby workflow engine
|
312
312
|
test_files: []
|