floraison / flor Goto Github PK
View Code? Open in Web Editor NEWa workflow engine
Home Page: https://github.com/floraison/flor#readme
License: MIT License
a workflow engine
Home Page: https://github.com/floraison/flor#readme
License: MIT License
As reported by @Subtletree
ENV['FLOR_DEBUG'] = 'dbg,stdout'
STDOUT.sync = true
require 'pp'
require 'flor/unit'
FLOR = Flor::Unit.new(loader: Flor::HashLoader, sto_uri: 'sqlite:/')
FLOR.storage.delete_tables
FLOR.storage.migrate
FLOR.start
class AliceTasker < Flor::BasicTasker
def on_task
p [ 'task!', nid ]
p taskname
end
def on_cancel
p [ 'cancel!', nid ]
reply('cancelled' => true)
end
end
FLOR.add_tasker(:alice, AliceTasker)
exid =
FLOR.launch(%q{
cursor
alice 'do this' on_cancel: (def \ break 'cancelled')
alice 'dont do this'
alice 'do this if cancelled' if f.ret == 'cancelled'
alice 'do this after'
})
FLOR.wait(exid, 'end')
FLOR.cancel(exid, '0_0_0')
r = FLOR.wait(exid, 'terminated')
pp r
out:
+---
| 1
| 2 cursor
| 3 alice 'do this' on_cancel: (def \ break 'cancelled')
| 4 alice 'dont do this'
| 5 alice 'do this if cancelled' if f.ret == 'cancelled'
| 6 alice 'do this after'
| 7
.
+---
| 0 sequence L0
| 0_0 cursor L2
| 0_0_0 alice L3
| 0_0_0_0 _att L3
| 0_0_0_0_0 _sqs do this L3
| 0_0_0_1 _att L3
| 0_0_0_1_0 on_cancel L3
| 0_0_0_1_1 def L3
| 0_0_0_1_1_0 break L3
| 0_0_0_1_1_0_0 _att L3
| 0_0_0_1_1_0_0_0 _sqs cancelled L3
| 0_0_1 alice L4
| 0_0_1_0 _att L4
| 0_0_1_0_0 _sqs dont do this L4
| 0_1 _if L5
| 0_1_0 "==" L5
| 0_1_0_0 _ref L5
| 0_1_0_0_0 _sqs f L5
| 0_1_0_0_1 _sqs ret L5
| 0_1_0_1 _sqs cancelled L5
| 0_1_1 alice L5
| 0_1_1_0 _att L5
| 0_1_1_0_0 _sqs do this if cancelled L5
| 0_2 alice L6
| 0_2_0 _att L6
| 0_2_0_0 _sqs do this after L6
.
/--- run starts Flor::UnitExecutor 70099387749800 domain0-u0-20190417.0213.chafugewaba
| { thread: 70099387699220 }
| { counters: {}, nodes: 0, execution_size: 0.00k }
waba 0 exe [sequence L0] [cursor,[[alice,[[_att,[[_sqs,"do this",3]],3],[... m1s_ f.ret null vars:
waba 0_0 exe [cursor L2] [alice,[[_att,[[_sqs,"do this",3]],3],[_att,[[on... m2s1r1>1 from 0 f.ret null vars:break,continue,move
waba 0_0_0 exe [task L3] [_att,[[_sqs,alice,3]],3],[_att,[[_sqs,"do this"... m3s2r1>1 from 0_0 f.ret null
waba 0_0_0_0 exe [_att L3] [_sqs,alice,3] m4s3r1>1 from 0_0_0 f.ret null
waba 0_0_0_0_0 exe [_sqs L3] alice m5s4r1>1 from 0_0_0_0 f.ret alice
waba 0_0_0_0 rec [_att L3] hp:_att m6s5r1>1 from 0_0_0_0_0 f.ret alice
waba 0_0_0 rec [task L3] hp:task m7s6r1>1 from 0_0_0_0 f.ret alice
waba 0_0_0_1 exe [_att L3] [_sqs,"do this",3] m8s7r1>1 from 0_0_0 f.ret alice
waba 0_0_0_1_0 exe [_sqs L3] "do this" m9s8r1>1 from 0_0_0_1 f.ret "do this"
waba 0_0_0_1 rec [_att L3] hp:_att m10s9r1>1 from 0_0_0_1_0 f.ret "do this"
waba 0_0_0 rec [task L3] hp:task m11s10r1>1 from 0_0_0_1 f.ret "do this"
waba 0_0_0_2 exe [_att L3] [on_cancel,[],3],[def,[[break,[[_att,[[_sqs,canc... m12s11r1>1 from 0_0_0 f.ret "do this"
waba 0_0_0_2_0 exe [on_cancel L3] [] hp:_val m13s12r1>1 from 0_0_0_2 f.ret [_proc,{proc:on_cancel},-1]
waba 0_0_0_2 rec [_att L3] hp:_att m14s13r1>1 from 0_0_0_2_0 f.ret [_proc,{proc:on_cancel},-1]
waba 0_0_0_2_1 exe [def L3] [break,[[_att,[[_sqs,cancelled,3]],3]],3] m15s14r1>1 from 0_0_0_2 f.ret [_proc,{proc:on_cancel},-1]
waba 0_0_0_2 rec [_att L3] hp:_att m16s15r1>1 from 0_0_0_2_1 f.ret [_func,{nid:0_0_0_2_1,tree:[def, [[... (ln120)
waba 0_0_0 rec [task L3] hp:task m17s16r1>1 from 0_0_0_2 f.ret [_func,{nid:0_0_0_2_1,tree:[def, [[... (ln120)
["task!", "0_0_0"]
"do this"
waba 0_0_0 tas [task L3] hp:task m18s17r1>1 from 0_0_0 f.ret [_func,{nid:0_0_0_2_1,tree:[def, [[... (ln120)
| run ends Flor::Logger 70099394495860 domain0-u0-20190417.0213.chafugewaba
| { started: "2019-04-17T02:13:05.478034Z", took: 0.01287 }
| { thread: 70099387699220, consumed: 18, traps: 0 }
| { counters: { runs: 1, msgs: 18, omsgs: 0, funs: 1 }, nodes: 3, execution_size: 0.68k }
\--- .
/--- run starts Flor::UnitExecutor 70099403109000 domain0-u0-20190417.0213.chafugewaba
| { thread: 70099387041660 }
| { counters: { runs: 1, msgs: 18, omsgs: 0, funs: 1 }, nodes: 3, execution_size: 0.68k }
[:dc, "0_0_0", ["_tasker", {"tasker"=>"alice"}, -1]]
[false, false]
waba 0_0_0 can closed: [task L3] hp:task m19s_ <ca:0_0_0:m19 f.ret null
["cancel!", "0_0_0"]
waba 0_0_0 det closed: [task L3] hp:task m20s19r2>2 from 0_0_0 <ca:0_0_0:m19 f.ret null
| run ends Flor::Logger 70099394495860 domain0-u0-20190417.0213.chafugewaba
| { started: "2019-04-17T02:13:05.784338Z", took: 0.004204 }
| { thread: 70099387041660, consumed: 2, traps: 0 }
| { counters: { runs: 2, msgs: 20, omsgs: 0, funs: 1, subs: 1 }, nodes: 3, execution_size: 0.82k }
\--- .
/--- run starts Flor::UnitExecutor 70099389036920 domain0-u0-20190417.0213.chafugewaba
| { thread: 70099389003800 }
| { counters: { runs: 2, msgs: 20, omsgs: 0, funs: 1, subs: 1 }, nodes: 3, execution_size: 0.82k }
waba 0_0_0 ret closed: [task L3] hp:task m21s_ f.ret null
waba 0_0_0 rec [task L3] hp:task m22s_r3>3 f.ret null
waba 0_0_0_2_1-1 exe [_apply L3] [break,[[_att,[[_sqs,cancelled,3]],3]],3] m23s19r3>3 from 0_0_0 <ca:0_0_0:m19 f.ret null vars:arguments,msg,err
waba 0_0_0_2_1_0-1 exe [break L3] [_att,[[_sqs,cancelled,3]],3] m24s23r3>3 from 0_0_0_2_1-1 <ca:0_0_0:m19 f.ret null
waba 0_0_0_2_1_0_0-1 exe [_att L3] [_sqs,cancelled,3] m25s24r3>3 from 0_0_0_2_1_0-1 <ca:0_0_0:m19 f.ret null
waba 0_0_0_2_1_0_0_0-1 exe [_sqs L3] cancelled m26s25r3>3 from 0_0_0_2_1_0_0-1 <ca:0_0_0:m19 f.ret cancelled
waba 0_0_0_2_1_0_0-1 rec [_att L3] hp:_att m27s26r3>3 from 0_0_0_2_1_0_0_0-1 <ca:0_0_0:m19 f.ret cancelled
waba 0_0_0_2_1_0-1 rec [break L3] hp:break m28s27r3>3 from 0_0_0_2_1_0_0-1 <ca:0_0_0:m19 f.ret cancelled
[:dc, "0_0", ["_proc", {"proc"=>"cursor"}, -1]]
[false, false]
waba 0_0 can break closed:break [cursor L2] hp:cursor m29s28r3>3 from 0_0_0_2_1_0-1 <ca:0_0:m29<ca:0_0_0:m19 f.ret cancelled vars:break,continue,move
[:dc, "0_0_0", ["_tasker", {"tasker"=>"alice"}, -1]]
[false, false]
waba 0_0_0 can closed: [task L3] hp:task m30s29r3>3 from 0_0 <ca:0_0_0:m30<ca:0_0:m29<ca:0_0_0:m19 f.ret cancelled
["cancel!", "0_0_0"]
waba 0_0_0 det closed: [task L3] hp:task m31s30r3>3 from 0_0_0 <ca:0_0_0:m30<ca:0_0:m29<ca:0_0_0:m19 f.ret cancelled
| run ends Flor::Logger 70099394495860 domain0-u0-20190417.0213.chafugewaba
| { started: "2019-04-17T02:13:06.081950Z", took: 0.007561 }
| { thread: 70099389003800, consumed: 11, traps: 0 }
| { counters: { runs: 3, msgs: 31, omsgs: 0, funs: 1, subs: 2 }, nodes: 5, execution_size: 1.00k }
\--- .
/--- run starts Flor::UnitExecutor 70099388461200 domain0-u0-20190417.0213.chafugewaba
| { thread: 70099388425000 }
| { counters: { runs: 3, msgs: 31, omsgs: 0, funs: 1, subs: 2 }, nodes: 5, execution_size: 1.00k }
waba 0_0_0 ret closed: [task L3] hp:task m32s_ f.ret null
waba 0_0_0 rec closed: [task L3] hp:task m33s_r4>4 f.ret null
waba 0_0 rec closed:break [cursor L2] hp:cursor m34s33r4>4 from 0_0_0 f.ret null vars:break,continue,move
[:dc, "0_0_0_2_1-1", ["_proc", {"proc"=>"_apply"}, -1]]
[false, false]
waba 0_0_0_2_1-1 can closed: [_apply L3] hp:_apply m35s34r4>4 from 0_0_0 <ca:0_0_0_2_1-1:m35 f.ret null vars:arguments,msg,err
waba 0 rec [sequence L0] hp:sequence m36s34r4>4 from 0_0 f.ret null vars:
[:dc, "0_0_0_2_1_0-1", ["_proc", {"proc"=>"break", "nid"=>"0_0"}, 2]]
[false, false]
waba 0_0_0_2_1_0-1 can closed: [break L3] hp:break m37s35r4>4 from 0_0_0_2_1-1 <ca:0_0_0_2_1_0-1:m37<ca:0_0_0_2_1-1:m35 f.ret null
waba 0_1 exe [_if L5] ["==",[[_ref,[[_sqs,f,5],[_sqs,ret,5]],5],[_sqs,... m38s36r4>4 from 0 f.ret null
waba 0_0_0_2_1-1 rec closed: [_apply L3] hp:_apply m39s37r4>4 from 0_0_0_2_1_0-1 <ca:0_0_0_2_1_0-1:m37<ca:0_0_0_2_1-1:m35 f.ret null vars:arguments,msg,err
waba 0_1_0 exe ["==" L5] [_ref,[[_sqs,f,5],[_sqs,ret,5]],5],[_sqs,cancell... m40s38r4>4 from 0_1 f.ret null
waba 0_0_0 rec [task L3] m41s39r4>4 from 0_0_0_2_1-1 <ca:0_0_0_2_1_0-1:m37<ca:0_0_0_2_1-1:m35 f.ret null
waba 0_1_0_0 exe [_ref L5] [_sqs,f,5],[_sqs,ret,5] m42s40r4>4 from 0_1_0 f.ret null
waba 0_1_0_0_0 exe [_sqs L5] f m43s42r4>4 from 0_1_0_0 f.ret f
waba 0_1_0_0 rec [_ref L5] hp:_ref m44s43r4>4 from 0_1_0_0_0 f.ret f
waba 0_1_0_0_1 exe [_sqs L5] ret m45s44r4>4 from 0_1_0_0 f.ret ret
waba 0_1_0_0 rec [_ref L5] hp:_ref m46s45r4>4 from 0_1_0_0_1 f.ret null
waba 0_1_0 rec ["==" L5] hp:== m47s46r4>4 from 0_1_0_0 f.ret null
waba 0_1_0_1 exe [_sqs L5] cancelled m48s47r4>4 from 0_1_0 f.ret cancelled
waba 0_1_0 rec ["==" L5] hp:== m49s48r4>4 from 0_1_0_1 f.ret false
waba 0_1 rec [_if L5] hp:_if m50s49r4>4 from 0_1_0 f.ret false
waba 0 rec [sequence L0] hp:sequence m51s50r4>4 from 0_1 f.ret null vars:
waba 0_2 exe [task L6] [_att,[[_sqs,alice,6]],6],[_att,[[_sqs,"do this ... m52s51r4>4 from 0 f.ret null
waba 0_2_0 exe [_att L6] [_sqs,alice,6] m53s52r4>4 from 0_2 f.ret null
waba 0_2_0_0 exe [_sqs L6] alice m54s53r4>4 from 0_2_0 f.ret alice
waba 0_2_0 rec [_att L6] hp:_att m55s54r4>4 from 0_2_0_0 f.ret alice
waba 0_2 rec [task L6] hp:task m56s55r4>4 from 0_2_0 f.ret alice
waba 0_2_1 exe [_att L6] [_sqs,"do this after",6] m57s56r4>4 from 0_2 f.ret alice
waba 0_2_1_0 exe [_sqs L6] "do this after" m58s57r4>4 from 0_2_1 f.ret "do this after"
waba 0_2_1 rec [_att L6] hp:_att m59s58r4>4 from 0_2_1_0 f.ret "do this after"
waba 0_2 rec [task L6] hp:task m60s59r4>4 from 0_2_1 f.ret "do this after"
["task!", "0_2"]
"do this after"
waba 0_2 tas [task L6] hp:task m61s60r4>4 from 0_2 f.ret "do this after"
| run ends Flor::Logger 70099394495860 domain0-u0-20190417.0213.chafugewaba
| { started: "2019-04-17T02:13:06.382603Z", took: 0.016631 }
| { thread: 70099388425000, consumed: 30, traps: 0 }
| { counters: { runs: 4, msgs: 61, omsgs: 0, funs: 1, subs: 2 }, nodes: 3, execution_size: 0.75k }
\--- .
"do this if cancelled" does not appear :-(
Hi,
I used to use ruote (Thanks a lot, btw), and now I am checking flor. Unfortunately I hit an issue right away. Figured I report it now in case I can't dig deeper.
irb(main):024> payload: { log: [ "started at #{Time.now}" ] })
=> "domain0-u0-20231219.0706.jibowesoba"
irb(main):025> r = flor.wait(exid)
/home/emogul/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/flor-1.6.2/lib/flor/unit/waiter.rb:109:in `block in wait': timeout for #<Flor::Waiter:0x000074c7149646f0{:exid=>"domain0-u0-20231219.0706.jibowesoba", :timeout=>5}>, msg_waiter? true, row_waiter? false (RuntimeError)
{
"env": "quickstart",
"domain": "quickstart",
"log_out": "var/log",
"flor_debug": "stdout, dbg",
"sto_uri": "(if == ruby_platform 'java'\n\"jdbc:sqlite://$(root)/var/flor.db\"\n\"sqlite://$(root)/var/flor.db\")",
"sto_migration_check": false,
"sto_sync": true,
"sto_connection_validation": false
}
This is correct?
15-Mar-2017 10:10:23.723 INFO [Ruby-0-Thread-6:
C:/Apps/apache-tomcat-8.0.27/webapps/ROOT/WEB-INF/gems/gems/flor-0.10.0/lib/flor/unit/scheduler.rb:157]
org.apache.catalina.core.ApplicationContext.log flor :
||| 070 sto t3770 ERROR Java::JavaSql::SQLException: Incorrect syntax near ')'.: SELECT TOP (1) count(([STATUS] = N'created')) AS [COUNT] FROM [FLOR_MESSAGES]
15-Mar-2017 10:10:23.723 INFO [Ruby-0-Thread-6:
C:/Apps/apache-tomcat-8.0.27/webapps/ROOT/WEB-INF/gems/gems/flor-0.10.0/lib/flor/unit/scheduler.rb:157]
org.apache.catalina.core.ApplicationContext.log flor :
||| 071 2017-03-15T02:10:23.723000Z sch-u0-i127.0.0.1-p14440-o2ns WARN W5453 Flor::Storage#any_message?() Java::JavaSql::SQLException: Incorrect syntax near ')'. (returning false)
SEQUEL DEPRECATION WARNING: Setting a model class dataset to an invalid dataset is deprecated and will be removed in Sequel 5. Either use a valid dataset or set require_valid_table = false for the model class.
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:1008:in `rescue in check_non_connection_error'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:1001:in `check_non_connection_error'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:1123:in `block in get_db_schema'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:1156:in `call'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:1156:in `get_db_schema'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:893:in `set_dataset'
/home/travis/build/floraison/flor/vendor/bundle/ruby/2.2.0/gems/sequel-4.49.0/lib/sequel/model/base.rb:311:in `dataset='
/home/travis/build/floraison/flor/lib/flor/unit/models.rb:68:in `block (3 levels) in <class:Storage>'
/home/travis/build/floraison/flor/lib/flor/unit/models.rb:67:in `initialize'
/home/travis/build/floraison/flor/lib/flor/unit/models.rb:67:in `new'
require 'ftt/taskers/email'
class: 'EmailTasker'
triggers repeated:
<Flor.msg_to_detail_s>
{"exid"=>"org.example-u0-20190305.0030.koyashiwabi",
"nid"=>"0",
"tree"=>["email", [["_att", [["_sqs", "send application form", 2]], 2]], 2],
"payload"=>{},
"point"=>"failed",
"fpoint"=>"failed",
"error"=>
{"kla"=>"Flor::ParseError",
"msg"=>"syntax error at line 1 column 1",
"trc"=>
["/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/parser.rb:15:in `parse'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core.rb:31:in `make_launch_msg'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/texecutor.rb:109:in `launch'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/texecutor.rb:238:in `interpret'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/loader.rb:170:in `eval'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/loader.rb:76:in `tasker'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/ganger.rb:34:in `has_tasker?'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/scheduler.rb:99:in `has_tasker?'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:488:in `lookup_dvar_container'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:440:in `lookup_var_container'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:471:in `lookup_var_container'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:396:in `lookup_var'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:193:in `lookup_value'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/node.rb:216:in `deref'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/executor.rb:195:in `determine_heat'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/executor.rb:451:in `process'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:70:in `block in do_run'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:58:in `times'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:58:in `do_run'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:36:in `block in run'"],
"cwd"=>"/Users/jmettraux/w/flor_tasker_test"},
"_detail_msg_flag"=>true}
payload:
{}
tree:
+---
| 0 email L2
| 0_0 _att L2
| 0_0_0 _sqs send application form L2
.
node:
{"nid"=>"0",
"parent"=>nil,
"payload"=>{},
"status"=>
[{"status"=>nil,
"point"=>"execute",
"ctime"=>"2019-03-05T00:30:40.225767Z"}],
"ctime"=>"2019-03-05T00:30:40.225767Z",
"mtime"=>"2019-03-05T00:30:40.225767Z",
"vars"=>{},
"tree"=>["email", [["_att", [["_sqs", "send application form", 2]], 2]], 2],
"heat0"=>"email"}
nodes:
0 [email,[[_att,[[_sqs,"send application for... vars: <---msg['nid']
1 node.
</Flor.msg_to_detail_s>
as in
27-Apr-2017 10:32:19.861 INFO
[Ruby-0-Thread-15: C:/Apps/apache-tomcat-8.0.27/webapps/ROOT/WEB-INF/gems/gems/flor-0.13.0/lib/flor/unit/executor.rb:37]
org.apache.catalina.core.ApplicationContext.log
flor: ||| 376 sto t5028 INFO (0.000000s)
UPDATE [FLOR_EXECUTIONS] SET
[CONTENT] = 0x789...,
[STATUS] = N'active',
[MTIME] = N'2017-04-27T02:32:19.846000Z',
[MUNIT] = N'sch-u0-i127.0.0.1-p9900-o2nu'
WHERE ([ID] = 10002)
Using flor master.
Running into a strange issue with the below process. Is there a syntax error there I'm missing?
ENV['FLOR_DEBUG'] = 'dbg,stdout'
STDOUT.sync = true
require 'pp'
require 'flor/unit'
FLOR = Flor::Unit.new(loader: Flor::HashLoader, sto_uri: 'sqlite:/')
FLOR.storage.delete_tables
FLOR.storage.migrate
FLOR.start
class AliceTasker < Flor::BasicTasker
def task
p '=================================================='
p taskname
reply
end
end
FLOR.add_tasker(:alice, AliceTasker)
exid =
FLOR.launch(%q{
define one
trace _
define two
trace _
define three
trace _
define four
trace _
define five
trace _
define six
trace _
define seven
trace _
define eight
trace _
define nine
trace _
define ten
trace _ # Error goes away with any of the below changes....
define eleven # works removing any function, one to eleven
trace _
#define twelve # works adding a new function
# trace _
set some_var true # works removing the set
on 'some_trap' count: 1 # works removing this trap or even just the count
alice 'baz'
concurrence
sequence # works removing the sequence
alice 'this one breaks' unless f.some_prop # works removing the unless
#task 'alice' 'foo' unless f.some_prop # works using `task 'alice' 'foo'` syntax instead of `alice 'foo'`
alice 'working branch' # works removing the other concurrent branch
})
r = FLOR.wait(exid, 'terminated')
pp r
alice 'this one breaks'
is interpreted as:
Tasker: 'this one breaks'
Task name: 'nil'
instead of
Tasker: 'alice'
Task name: 'this one breaks'
You can change pretty much anything about the process and the problem will go away ๐ณ๐ค
The workaround is just to use the full task syntax: task 'alice' 'this one doesn't break'
{"exid"=>"domain0-u0-20190920.0313.bolaladiba",
"from"=>"0_13_0_0_1",
"nid"=>"0_13_0_0_1",
"sm"=>85,
"payload"=>{"ret"=>"this one breaks"},
"point"=>"failed",
"fpoint"=>"task",
"error"=>
{"kla"=>"ArgumentError",
"msg"=>"tasker \"this one breaks\" not found",
"trc"=>
["/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/ganger.rb:57:in `task'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/executor.rb:150:in `task'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/core/executor.rb:455:in `process'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/executor.rb:75:in `block in do_run'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/executor.rb:63:in `times'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/executor.rb:63:in `do_run'",
"/Users/ryanscott/.rvm/gems/ruby-2.6.3/gems/flor-0.18.0/lib/flor/unit/executor.rb:36:in `block in run'"],
"cwd"=>"/Users/ryanscott/projects/flor_testing"},
"_detail_msg_flag"=>true}
payload:
{"ret"=>
"this one breaks"}
tree:
| 0_13_0_0_1 alice L33
| 0_13_0_0_1_0 _att L33
| 0_13_0_0_1_0_0 _sqs this one breaks L33
node:
{"nid"=>"0_13_0_0_1",
"parent"=>"0_13_0_0",
"payload"=>{"ret"=>nil},
"status"=>
[{"status"=>nil,
"point"=>"execute",
"ctime"=>"2019-09-20T03:13:04.875140Z"}],
"ctime"=>"2019-09-20T03:13:04.875140Z",
"mtime"=>"2019-09-20T03:13:04.886536Z",
"heat0"=>"alice",
"heat"=>["_tasker", {"tasker"=>"alice"}, -1],
"heap"=>"task",
"atts"=>[[nil, "this one breaks"]],
"cnodes"=>[],
"message"=>
{"point"=>"receive",
"exid"=>"domain0-u0-20190920.0313.bolaladiba",
"from"=>"0_13_0_0_1_0",
"nid"=>"0_13_0_0_1",
"sm"=>84,
"payload"=>{"ret"=>"this one breaks"},
"er"=>2,
"m"=>85,
"pr"=>2,
"consumed"=>"2019-09-20T03:13:04.887466Z"},
"task"=>{"tasker"=>"this one breaks", "name"=>nil}}
nodes:
0 [sequence,[[define,[[_att,[[one,[],2]],2],... vars:one,two,three,four,five,six,seven,eight,nine,ten,eleven,some_var
0_12 [trap,[[_att,[[point,[],28],[_sqs,signal,2... vars:
0_13 [concurrence,[[sequence,[[_unless,[[_ref,[...
0_13_0 [sequence,[[_unless,[[_ref,[[_sqs,f,33],[_...
0_13_0_0 [_unless,[[_ref,[[_sqs,f,33],[_sqs,some_pr...
0_13_0_0_1 [alice,[[_att,[[_sqs,"this one breaks",33]... <---msg['nid']
0_13_1 [task,[[_att,[[_sqs,alice,35]],35],[_att,[...
7 nodes.
case
'aaa'; do_this _
'bbb'; do_that _
'ccc'; do_that_crazy_thing _
should be equivalent to
case f.ret
'aaa'; do_this _
'bbb'; do_that _
'ccc'; do_that_crazy_thing _
When setting variable names that start with a procedure name, flor treats it as the procedure e.g
set original_value 'test' # starts the 'or' procedure
set andvariablename 'test' # starts the 'and' procedure
test case
ENV['FLOR_DEBUG'] = 'dbg,stdout'
STDOUT.sync = true
require 'pp'
require 'flor/unit'
FLOR = Flor::Unit.new(loader: Flor::HashLoader, sto_uri: 'sqlite:/')
FLOR.storage.delete_tables
FLOR.storage.migrate
FLOR.start
class AliceTasker < Flor::BasicTasker
def task
p '=================================================='
p taskname
reply
end
end
FLOR.add_tasker(:alice, AliceTasker)
# Fails
exid =
FLOR.launch(%q{
alice '1'
set original_value 'test'
alice original_value
})
# Works
# exid =
# FLOR.launch(%q{
# alice '1'
# set iginal_value 'test'
# alice iginal_value
# })
# FLOR.wait(exid, 'idle')
r = FLOR.wait(exid, 'terminated')
pp r
/--- run starts Flor::UnitExecutor 70361854847820 domain0-u0-20190905.2338.ketsohekuba
| { thread: 70361854895520 }
| { counters: { runs: 1, msgs: 11, omsgs: 0 }, nodes: 2, execution_size: 0.53k }
kuba 0_0 ret [task L2] hp:task m12s_ f.ret "1"
kuba 0_0 rec [task L2] hp:task m13s_r2>2 f.ret "1"
kuba 0 rec [sequence L0] hp:sequence m14s13r2>2 from 0_0 f.ret "1" vars:
kuba 0_1 exe [_head L3] [_sqs,"set original_value",3],[or,[[set,[],3],[i... m15s14r2>2 from 0 f.ret "1"
kuba 0_1_1 exe [or L3] [set,[],3],[iginal_value,[],3] m16s15r2>2 from 0_1 f.ret false
kuba 0_1_1_0 exe [set L3] [] hp:_val m17s16r2>2 from 0_1_1 f.ret [_proc,{proc:set},-1]
kuba 0_1_1 rec [or L3] hp:or m18s17r2>2 from 0_1_1_0 f.ret [_proc,{proc:set},-1]
kuba 0_1 rec [_head L3] hp:_head m19s18r2>2 from 0_1_1 f.ret [_proc,{proc:set},-1]
kuba 0_1_2 exe [__head L3] [_att,[[_sqs,test,3]],3] hp:set m20s19r2>2 from 0_1 f.ret [_proc,{proc:set,ref:__head},-1]
kuba 0_1_2_0 exe [_sqs L3] test m21s20r2>2 from 0_1_2 f.ret test
kuba 0_1_2 rec [__head L3] hp:set m22s21r2>2 from 0_1_2_0 f.ret [_proc,{proc:set,ref:__head},-1]
kuba 0_1 rec [_head L3] hp:_head m23s22r2>2 from 0_1_2 f.ret [_proc,{proc:set,ref:__head},-1]
kuba 0 rec [sequence L0] hp:sequence m24s23r2>2 from 0_1 f.ret [_proc,{proc:set,ref:__head},-1] vars:
kuba 0_2 exe [or L4] [alice,[],4],[iginal_value,[],4] m25s24r2>2 from 0 f.ret false
kuba 0_2_0 exe [alice L4] [] hp:_val m26s25r2>2 from 0_2 f.ret [_tasker,{tasker:alice},-1]
kuba 0_2 rec [or L4] hp:or m27s26r2>2 from 0_2_0 f.ret [_tasker,{tasker:alice},-1]
kuba 0 rec [sequence L0] hp:sequence m28s27r2>2 from 0_2 f.ret [_tasker,{tasker:alice},-1] vars:
kuba rec m29s28r2>2 from 0 f.ret [_tasker,{tasker:alice},-1]
kuba ter m30s29r2>2 from 0 f.ret [_tasker,{tasker:alice},-1]
.
in https://github.com/jmettraux/flor_tasker_test
when the tasker conf is set to:
require: 'ftt/taskers/email'
class: 'EmailTasker'
it fails with cannot load such file -- /Users/jmettraux/w/flor_tasker_test/flor/lib/taskers/org.example/ftt/taskers/email
the require is off
<Flor.msg_to_detail_s>
{"exid"=>"org.example-u0-20190305.0050.kunekochubi",
"from"=>"0",
"nid"=>"0",
"sm"=>9,
"payload"=>{"ret"=>"send application form"},
"point"=>"failed",
"fpoint"=>"task",
"error"=>
{"kla"=>"LoadError",
"msg"=>
"cannot load such file -- /Users/jmettraux/w/flor_tasker_test/flor/lib/taskers/org.example/ftt/taskers/email",
"trc"=>
["/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/caller.rb:50:in `require'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/caller.rb:50:in `block in ruby_call'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/caller.rb:48:in `each'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/caller.rb:48:in `ruby_call'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/caller.rb:20:in `call'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/ganger.rb:71:in `task'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:141:in `task'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/core/executor.rb:456:in `process'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:70:in `block in do_run'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:58:in `times'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:58:in `do_run'",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib/flor/unit/executor.rb:36:in `block in run'"],
"cwd"=>"/Users/jmettraux/w/flor_tasker_test",
"rlp"=>
["/Users/jmettraux/.gem/ruby/2.5.1/gems/bundler-1.16.2/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/pg-1.1.4/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/extensions/x86_64-darwin-17/2.5.0-static/pg-1.1.4",
"/Users/jmettraux/.gem/ruby/2.5.1/bundler/gems/flor-3265252ad583/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/sequel-5.18.0/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/munemo-1.0.1/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/fugit-1.1.8/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/et-orbi-1.1.7/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/tzinfo-2.0.0/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/dense-1.1.6/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/raabro-1.1.6/lib",
"/Users/jmettraux/.gem/ruby/2.5.1/gems/concurrent-ruby-1.1.4/lib",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/x86_64-darwin17",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/site_ruby",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/vendor_ruby/2.5.0",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/vendor_ruby/2.5.0/x86_64-darwin17",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/vendor_ruby",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/2.5.0",
"/Users/jmettraux/.rubies/ruby-2.5.1/lib/ruby/2.5.0/x86_64-darwin17",
"lib"]},
"_detail_msg_flag"=>true}
payload:
{"ret"=>
"send application form"}
tree:
+---
| 0 task L2
| 0_0 _att L2
| 0_0_0 _sqs email L2
| 0_1 _att L2
| 0_1_0 _sqs send application form L2
.
node:
{"nid"=>"0",
"parent"=>nil,
"payload"=>{},
"status"=>
[{"status"=>nil,
"point"=>"execute",
"ctime"=>"2019-03-05T00:50:37.844321Z"}],
"ctime"=>"2019-03-05T00:50:37.844321Z",
"mtime"=>"2019-03-05T00:50:37.855822Z",
"vars"=>{},
"tree"=>
["task",
[["_att", [["_sqs", "email", 2]], 2],
["_att", [["_sqs", "send application form", 2]], 2]],
2],
"heat0"=>"email",
"heat"=>["_tasker", {"tasker"=>"email"}, -1],
"heap"=>"task",
"atts"=>[[nil, "email"], [nil, "send application form"]],
"cnodes"=>[],
"task"=>{"tasker"=>"email", "name"=>"send application form"}}
nodes:
0 [task,[[_att,[[_sqs,email,2]],2],[_att,[[_... vars: <---msg['nid']
1 node.
</Flor.msg_to_detail_s>
As seen with @northox and @jfrioux https://gitter.im/floraison/flor?at=5fbfb55f846eed6b67ae2bf2
Reproduced in https://github.com/jmettraux/issue_flor_hook_20201126
It seems hooks with point: return
are not triggered.
The workaround is to write point: "return"
or point: 'return'
.
[
{ point: execute, consumed: true, nid: '0', require: 'pollen/pollen.rb', class: 'LaunchedPollenHook' },
{ point: return, consumed: true, require: 'pollen/pollen.rb', class: 'ReturnedPollenHook' },
{ point: terminated, consumed: true, require: 'pollen/pollen.rb', class: 'TerminatedPollenHook' },
{ point: failed, consumed: true, require: 'pollen/pollen.rb', class: 'FailedPollenHook' },
]
Probably the point gets evaluated to an empty string (and never matches).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.