flor 0.18.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +3 -0
- data/CREDITS.md +1 -0
- data/LICENSE.txt +1 -1
- data/Makefile +1 -1
- data/README.md +15 -1
- data/flor.gemspec +1 -2
- data/lib/flor.rb +2 -2
- data/lib/flor/colours.rb +5 -3
- data/lib/flor/conf.rb +1 -0
- data/lib/flor/core.rb +9 -8
- data/lib/flor/core/executor.rb +20 -16
- data/lib/flor/core/node.rb +1 -13
- data/lib/flor/core/procedure.rb +10 -1
- data/lib/flor/core/texecutor.rb +9 -2
- data/lib/flor/djan.rb +1 -0
- data/lib/flor/errors.rb +1 -0
- data/lib/flor/flor.rb +144 -15
- data/lib/flor/id.rb +1 -0
- data/lib/flor/log.rb +2 -1
- data/lib/flor/migrations/0001_tables.rb +1 -0
- data/lib/flor/migrations/0002_cunit_and_munit.rb +1 -0
- data/lib/flor/migrations/0003_timer_onid_bnid.rb +1 -0
- data/lib/flor/migrations/0004_trap_bnid.rb +1 -0
- data/lib/flor/migrations/0005_pointer_content.rb +1 -0
- data/lib/flor/parser.rb +19 -11
- data/lib/flor/pcore/_apply.rb +1 -0
- data/lib/flor/pcore/_arr.rb +1 -0
- data/lib/flor/pcore/_atom.rb +1 -0
- data/lib/flor/pcore/_att.rb +1 -0
- data/lib/flor/pcore/_coll.rb +1 -0
- data/lib/flor/pcore/_dmute.rb +1 -0
- data/lib/flor/pcore/_dol.rb +1 -0
- data/lib/flor/pcore/_dqs.rb +1 -0
- data/lib/flor/pcore/_dump.rb +1 -0
- data/lib/flor/pcore/_err.rb +1 -0
- data/lib/flor/pcore/_head.rb +1 -0
- data/lib/flor/pcore/_obj.rb +1 -0
- data/lib/flor/pcore/_pat_.rb +1 -0
- data/lib/flor/pcore/_pat_arr.rb +1 -0
- data/lib/flor/pcore/_pat_guard.rb +1 -0
- data/lib/flor/pcore/_pat_obj.rb +1 -0
- data/lib/flor/pcore/_pat_or.rb +1 -0
- data/lib/flor/pcore/_pat_regex.rb +1 -0
- data/lib/flor/pcore/_ref.rb +1 -0
- data/lib/flor/pcore/_rxs.rb +1 -0
- data/lib/flor/pcore/_skip.rb +1 -0
- data/lib/flor/pcore/_val.rb +1 -0
- data/lib/flor/pcore/all.rb +1 -0
- data/lib/flor/pcore/andor.rb +1 -0
- data/lib/flor/pcore/any.rb +1 -0
- data/lib/flor/pcore/apply.rb +1 -0
- data/lib/flor/pcore/arith.rb +1 -0
- data/lib/flor/pcore/array_qmark.rb +1 -0
- data/lib/flor/pcore/break.rb +1 -0
- data/lib/flor/pcore/case.rb +1 -0
- data/lib/flor/pcore/cmp.rb +1 -0
- data/lib/flor/pcore/collect.rb +2 -1
- data/lib/flor/pcore/cond.rb +1 -0
- data/lib/flor/pcore/cursor.rb +45 -3
- data/lib/flor/pcore/define.rb +1 -0
- data/lib/flor/pcore/detect.rb +1 -0
- data/lib/flor/pcore/do_return.rb +1 -0
- data/lib/flor/pcore/each.rb +1 -0
- data/lib/flor/pcore/echo.rb +1 -0
- data/lib/flor/pcore/empty.rb +1 -0
- data/lib/flor/pcore/fail.rb +1 -0
- data/lib/flor/pcore/filter.rb +1 -0
- data/lib/flor/pcore/find.rb +1 -0
- data/lib/flor/pcore/flatten.rb +1 -0
- data/lib/flor/pcore/for_each.rb +1 -0
- data/lib/flor/pcore/if.rb +1 -0
- data/lib/flor/pcore/includes.rb +1 -0
- data/lib/flor/pcore/inject.rb +1 -0
- data/lib/flor/pcore/iterator.rb +1 -0
- data/lib/flor/pcore/keys.rb +1 -0
- data/lib/flor/pcore/length.rb +1 -0
- data/lib/flor/pcore/loop.rb +1 -0
- data/lib/flor/pcore/map.rb +1 -0
- data/lib/flor/pcore/match.rb +1 -0
- data/lib/flor/pcore/matchr.rb +1 -0
- data/lib/flor/pcore/max.rb +1 -0
- data/lib/flor/pcore/merge.rb +1 -0
- data/lib/flor/pcore/move.rb +1 -0
- data/lib/flor/pcore/noeval.rb +1 -0
- data/lib/flor/pcore/noret.rb +1 -0
- data/lib/flor/pcore/not.rb +1 -0
- data/lib/flor/pcore/on.rb +4 -3
- data/lib/flor/pcore/on_cancel.rb +1 -0
- data/lib/flor/pcore/on_error.rb +1 -0
- data/lib/flor/pcore/push.rb +1 -0
- data/lib/flor/pcore/rand.rb +1 -0
- data/lib/flor/pcore/range.rb +1 -0
- data/lib/flor/pcore/reduce.rb +1 -0
- data/lib/flor/pcore/return.rb +1 -0
- data/lib/flor/pcore/reverse.rb +1 -0
- data/lib/flor/pcore/select.rb +1 -0
- data/lib/flor/pcore/sequence.rb +1 -0
- data/lib/flor/pcore/set.rb +1 -0
- data/lib/flor/pcore/shuffle.rb +1 -0
- data/lib/flor/pcore/slice.rb +1 -0
- data/lib/flor/pcore/sort.rb +1 -0
- data/lib/flor/pcore/sort_by.rb +1 -0
- data/lib/flor/pcore/split.rb +1 -0
- data/lib/flor/pcore/stall.rb +1 -0
- data/lib/flor/pcore/strings.rb +1 -0
- data/lib/flor/pcore/timestamp.rb +1 -0
- data/lib/flor/pcore/to_array.rb +1 -0
- data/lib/flor/pcore/twig.rb +1 -0
- data/lib/flor/pcore/type_of.rb +1 -0
- data/lib/flor/pcore/until.rb +1 -0
- data/lib/flor/punit/abort.rb +50 -0
- data/lib/flor/punit/c_collect.rb +1 -0
- data/lib/flor/punit/c_each.rb +19 -0
- data/lib/flor/punit/c_for_each.rb +2 -1
- data/lib/flor/punit/c_iterator.rb +1 -0
- data/lib/flor/punit/c_map.rb +1 -0
- data/lib/flor/punit/cancel.rb +1 -0
- data/lib/flor/punit/concurrence.rb +1 -0
- data/lib/flor/punit/cron.rb +1 -0
- data/lib/flor/punit/do_trap.rb +1 -0
- data/lib/flor/punit/every.rb +1 -0
- data/lib/flor/punit/graft.rb +1 -0
- data/lib/flor/punit/m_ram.rb +1 -0
- data/lib/flor/punit/on_timeout.rb +1 -0
- data/lib/flor/punit/part.rb +1 -0
- data/lib/flor/punit/schedule.rb +1 -0
- data/lib/flor/punit/signal.rb +1 -0
- data/lib/flor/punit/sleep.rb +1 -0
- data/lib/flor/punit/task.rb +1 -0
- data/lib/flor/punit/trace.rb +1 -0
- data/lib/flor/punit/trap.rb +10 -1
- data/lib/flor/to_string.rb +1 -0
- data/lib/flor/tools/env.rb +1 -0
- data/lib/flor/tools/shell.rb +1 -0
- data/lib/flor/tools/shell_out.rb +1 -0
- data/lib/flor/tt.rb +98 -0
- data/lib/flor/unit.rb +2 -0
- data/lib/flor/unit/caller.rb +152 -19
- data/lib/flor/unit/caller_jruby.rb +132 -0
- data/lib/flor/unit/dump.rb +36 -0
- data/lib/flor/unit/executor.rb +1 -0
- data/lib/flor/unit/ganger.rb +6 -12
- data/lib/flor/unit/hloader.rb +34 -7
- data/lib/flor/unit/hook.rb +3 -0
- data/lib/flor/unit/hooker.rb +32 -15
- data/lib/flor/unit/journal.rb +23 -0
- data/lib/flor/unit/loader.rb +102 -7
- data/lib/flor/unit/logger.rb +24 -5
- data/lib/flor/unit/models.rb +8 -1
- data/lib/flor/unit/models/execution.rb +51 -0
- data/lib/flor/unit/models/message.rb +1 -0
- data/lib/flor/unit/models/pointer.rb +1 -0
- data/lib/flor/unit/models/timer.rb +1 -0
- data/lib/flor/unit/models/trace.rb +1 -0
- data/lib/flor/unit/models/trap.rb +3 -2
- data/lib/flor/unit/scheduler.rb +35 -28
- data/lib/flor/unit/spooler.rb +1 -0
- data/lib/flor/unit/storage.rb +68 -44
- data/lib/flor/unit/taskers.rb +2 -1
- data/lib/flor/unit/waiter.rb +2 -1
- data/lib/flor/unit/wlist.rb +10 -8
- metadata +13 -10
data/lib/flor/pcore/do_return.rb
CHANGED
data/lib/flor/pcore/each.rb
CHANGED
data/lib/flor/pcore/echo.rb
CHANGED
data/lib/flor/pcore/empty.rb
CHANGED
data/lib/flor/pcore/fail.rb
CHANGED
data/lib/flor/pcore/filter.rb
CHANGED
data/lib/flor/pcore/find.rb
CHANGED
data/lib/flor/pcore/flatten.rb
CHANGED
data/lib/flor/pcore/for_each.rb
CHANGED
data/lib/flor/pcore/if.rb
CHANGED
data/lib/flor/pcore/includes.rb
CHANGED
data/lib/flor/pcore/inject.rb
CHANGED
data/lib/flor/pcore/iterator.rb
CHANGED
data/lib/flor/pcore/keys.rb
CHANGED
data/lib/flor/pcore/length.rb
CHANGED
data/lib/flor/pcore/loop.rb
CHANGED
data/lib/flor/pcore/map.rb
CHANGED
data/lib/flor/pcore/match.rb
CHANGED
data/lib/flor/pcore/matchr.rb
CHANGED
data/lib/flor/pcore/max.rb
CHANGED
data/lib/flor/pcore/merge.rb
CHANGED
data/lib/flor/pcore/move.rb
CHANGED
data/lib/flor/pcore/noeval.rb
CHANGED
data/lib/flor/pcore/noret.rb
CHANGED
data/lib/flor/pcore/not.rb
CHANGED
data/lib/flor/pcore/on.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
class Flor::Pro::On < Flor::Macro
|
3
4
|
#
|
@@ -125,13 +126,13 @@ class Flor::Pro::On < Flor::Macro
|
|
125
126
|
if att = find_catch # 22
|
126
127
|
rewrite_as_catch_tree(att)
|
127
128
|
else
|
128
|
-
|
129
|
+
rewrite_as_signal_trap_tree
|
129
130
|
end
|
130
131
|
end
|
131
132
|
|
132
133
|
protected
|
133
134
|
|
134
|
-
CATCHES = %w[ error cancel timeout ]
|
135
|
+
CATCHES = %w[ error cancel timeout ].freeze
|
135
136
|
|
136
137
|
def find_catch
|
137
138
|
|
@@ -165,7 +166,7 @@ class Flor::Pro::On < Flor::Macro
|
|
165
166
|
th
|
166
167
|
end
|
167
168
|
|
168
|
-
def
|
169
|
+
def rewrite_as_signal_trap_tree
|
169
170
|
|
170
171
|
atts = att_children
|
171
172
|
signame_i = atts.index { |at| at[1].size == 1 }
|
data/lib/flor/pcore/on_cancel.rb
CHANGED
data/lib/flor/pcore/on_error.rb
CHANGED
data/lib/flor/pcore/push.rb
CHANGED
data/lib/flor/pcore/rand.rb
CHANGED
data/lib/flor/pcore/range.rb
CHANGED
data/lib/flor/pcore/reduce.rb
CHANGED
data/lib/flor/pcore/return.rb
CHANGED
data/lib/flor/pcore/reverse.rb
CHANGED
data/lib/flor/pcore/select.rb
CHANGED
data/lib/flor/pcore/sequence.rb
CHANGED
data/lib/flor/pcore/set.rb
CHANGED
data/lib/flor/pcore/shuffle.rb
CHANGED
data/lib/flor/pcore/slice.rb
CHANGED
data/lib/flor/pcore/sort.rb
CHANGED
data/lib/flor/pcore/sort_by.rb
CHANGED
data/lib/flor/pcore/split.rb
CHANGED
data/lib/flor/pcore/stall.rb
CHANGED
data/lib/flor/pcore/strings.rb
CHANGED
data/lib/flor/pcore/timestamp.rb
CHANGED
data/lib/flor/pcore/to_array.rb
CHANGED
data/lib/flor/pcore/twig.rb
CHANGED
data/lib/flor/pcore/type_of.rb
CHANGED
data/lib/flor/pcore/until.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Flor::Pro::Abort < Flor::Procedure
|
4
|
+
#
|
5
|
+
# Cancels the current execution.
|
6
|
+
#
|
7
|
+
# Cancels all the root nodes at once. Is usually the equivalent of
|
8
|
+
# `cancel '0'` but sometimes the root nodes are gone...
|
9
|
+
#
|
10
|
+
# "kabort" is like "abort" but the cancel flavour is 'kill', so that
|
11
|
+
# cancel handlers are ignored.
|
12
|
+
#
|
13
|
+
# ```
|
14
|
+
# # ...
|
15
|
+
# cursor
|
16
|
+
# task 'prepare mandate'
|
17
|
+
# abort _ if f.outcome == 'reject'
|
18
|
+
# task 'sign mandate'
|
19
|
+
# # ...
|
20
|
+
# ```
|
21
|
+
#
|
22
|
+
# ## see also
|
23
|
+
#
|
24
|
+
# Cancel, kill
|
25
|
+
|
26
|
+
name 'abort', 'kabort'
|
27
|
+
|
28
|
+
def receive_last
|
29
|
+
|
30
|
+
fla = heap == 'kabort' ? 'kill' : 'cancel'
|
31
|
+
|
32
|
+
nodes = @execution['nodes']
|
33
|
+
nids = nodes.keys.dup
|
34
|
+
|
35
|
+
@execution['nodes'].values.each do |n|
|
36
|
+
|
37
|
+
#p n.select { |k, v| %w[ nid can parent cnodes ].include?(k) }
|
38
|
+
nid = n['nid']
|
39
|
+
pa = nodes[n['parent']]
|
40
|
+
|
41
|
+
nids.delete(nid) if pa && pa['cnodes'].include?(nid)
|
42
|
+
end
|
43
|
+
#p nids
|
44
|
+
|
45
|
+
wrap_cancel_nodes(nids, { 'flavour' => fla })
|
46
|
+
.each { |m| m['from'] = '9' }
|
47
|
+
# since '9' isn't the parent of any node
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
data/lib/flor/punit/c_collect.rb
CHANGED
data/lib/flor/punit/c_each.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
class Flor::Pro::Ceach < Flor::Macro::Iterator
|
4
|
+
#
|
5
|
+
# Concurrent "each".
|
6
|
+
#
|
7
|
+
# ```
|
8
|
+
# ceach [ alice bob charly ]
|
9
|
+
# task elt "prepare monthly report"
|
10
|
+
# ```
|
11
|
+
# which is equivalent to
|
12
|
+
# ```
|
13
|
+
# concurrence
|
14
|
+
# task 'alice' "prepare monthly report"
|
15
|
+
# task 'bob' "prepare monthly report"
|
16
|
+
# task 'charly' "prepare monthly report"
|
17
|
+
# ```
|
18
|
+
#
|
19
|
+
# ## see also
|
20
|
+
#
|
21
|
+
# For-each, c-map, and c-for-each.
|
3
22
|
|
4
23
|
names %w[ ceach c-each ]
|
5
24
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
require 'flor/punit/c_iterator'
|
3
4
|
|
@@ -27,7 +28,7 @@ class Flor::Pro::CforEach < Flor::Pro::ConcurrentIterator
|
|
27
28
|
#
|
28
29
|
# ## see also
|
29
30
|
#
|
30
|
-
# For-each,
|
31
|
+
# For-each, c-map, and c-each.
|
31
32
|
|
32
33
|
name 'c-for-each'
|
33
34
|
|
data/lib/flor/punit/c_map.rb
CHANGED
data/lib/flor/punit/cancel.rb
CHANGED
data/lib/flor/punit/cron.rb
CHANGED
data/lib/flor/punit/do_trap.rb
CHANGED