2010-05-25 01:01:42 utc |
jmettraux |
weyus: hello, welcome to #ruote |
2010-05-25 01:01:48 utc |
weyus |
Thanks |
2010-05-25 01:01:57 utc |
weyus |
I just realized I shouldn't have posted my pastie here |
2010-05-25 01:02:06 utc |
jmettraux |
? which pastie ? |
2010-05-25 01:02:12 utc |
weyus |
Exactly |
2010-05-25 01:02:14 utc |
weyus |
:) |
2010-05-25 01:02:35 utc |
weyus |
I'm trying to get my first wf working with ruote. |
2010-05-25 01:02:52 utc |
jmettraux |
ok, if I can be of any help |
2010-05-25 01:05:23 utc |
weyus |
Here's what I have - I've verified that all of the objects appear to be instantiated correct but when I call process on the wfid I get nil back |
2010-05-25 01:05:24 utc |
weyus |
http://pastie.org/975268 |
2010-05-25 01:06:00 utc |
jmettraux |
place something like "sleep 0.350" right after the launch |
2010-05-25 01:06:23 utc |
jmettraux |
ruote is asynchronous, it's not happening in the same thread where you launch |
2010-05-25 01:06:53 utc |
jmettraux |
it could even happen in another process, even another machine |
2010-05-25 01:07:02 utc |
weyus |
That makes sense |
2010-05-25 01:10:15 utc |
weyus |
If I do this: |
2010-05-25 01:10:16 utc |
weyus |
#Start the workflow engine |
2010-05-25 01:10:16 utc |
weyus |
wfid = engine.launch(pdef, :x => 3) |
2010-05-25 01:10:17 utc |
weyus |
sleep 5 |
2010-05-25 01:10:17 utc |
weyus |
puts "WFID: #{wfid}" |
2010-05-25 01:10:17 utc |
weyus |
ps = engine.process(wfid) |
2010-05-25 01:10:38 utc |
weyus |
I get this: |
2010-05-25 01:10:40 utc |
weyus |
WFID: 20100525-nijisuse |
2010-05-25 01:10:40 utc |
weyus |
./xmpp-bot.rb:34: undefined method `errors' for nil:NilClass (NoMethodError) |
2010-05-25 01:10:59 utc |
jmettraux |
look at line 34 of your xmpp-bot.rb |
2010-05-25 01:11:51 utc |
jmettraux |
(regarding your previous questions, "rufus" means "red" in Latin and "ruote" is the italian for "wheels") |
2010-05-25 01:12:32 utc |
weyus |
(thx re: previous question) Isn't engine.process supposed to return something? |
2010-05-25 01:12:48 utc |
jmettraux |
yes |
2010-05-25 01:13:55 utc |
jmettraux |
sorry, but I don't have the code for xmpp-bot.rb, I can only tell you to look at its line 34 since the error is there |
2010-05-25 01:14:10 utc |
weyus |
Is there a debug flag or logging that I can use that's built in to debug further? |
2010-05-25 01:14:17 utc |
weyus |
The pastie is basically it |
2010-05-25 01:14:24 utc |
jmettraux |
yes, you can run with "-d" |
2010-05-25 01:14:32 utc |
jmettraux |
the pastie has no line 34 |
2010-05-25 01:15:29 utc |
jmettraux |
if you want to know exactly what the engine is doing, you can place a "engine.context.logger.noisy = true" before the launch |
2010-05-25 01:15:45 utc |
jmettraux |
it will spit the engine's worker activity to STDOUT |
2010-05-25 01:16:01 utc |
jmettraux |
"-d" will only manifest itself when an error occurs |
2010-05-25 01:16:33 utc |
weyus |
== worker intercepted error == |
2010-05-25 01:16:33 utc |
weyus |
# |
2010-05-25 01:16:41 utc |
jmettraux |
ah |
2010-05-25 01:16:49 utc |
jmettraux |
on which ruby and OS are you running ? |
2010-05-25 01:17:24 utc |
weyus |
gandalf-2:lib weyus$ ruby --version |
2010-05-25 01:17:24 utc |
weyus |
ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0] |
2010-05-25 01:17:31 utc |
jmettraux |
ok |
2010-05-25 01:17:38 utc |
weyus |
OS X 10.6.3 |
2010-05-25 01:17:39 utc |
jmettraux |
the latest json gem is borked |
2010-05-25 01:17:48 utc |
weyus |
Cool |
2010-05-25 01:17:57 utc |
weyus |
Damn, I think I saw a ref to that somewhere |
2010-05-25 01:18:00 utc |
jmettraux |
you can either downgrade it, either do "gem install yajl-ruby" |
2010-05-25 01:18:13 utc |
jmettraux |
I recommend yajl |
2010-05-25 01:18:19 utc |
jmettraux |
it's fast |
2010-05-25 01:18:31 utc |
weyus |
Is yajl a replacement for json gem? |
2010-05-25 01:18:40 utc |
jmettraux |
yes |
2010-05-25 01:18:49 utc |
weyus |
How do I tell ruote to use it? |
2010-05-25 01:19:09 utc |
jmettraux |
ruote picks it automatically if present |
2010-05-25 01:19:14 utc |
weyus |
Sweet! |
2010-05-25 01:19:43 utc |
weyus |
Much better |
2010-05-25 01:19:45 utc |
weyus |
WFID: 20100525-bitojeruna |
2010-05-25 01:19:45 utc |
weyus |
errors for 20100525-bitojeruna ? false |
2010-05-25 01:19:45 utc |
weyus |
Currently running process instances: |
2010-05-25 01:19:46 utc |
weyus |
- 20100525-bitojeruna |
2010-05-25 01:19:49 utc |
jmettraux |
great |
2010-05-25 01:19:51 utc |
weyus |
Many thanks Jamie is it? |
2010-05-25 01:19:55 utc |
jmettraux |
John |
2010-05-25 01:19:59 utc |
jmettraux |
you're welcome |
2010-05-25 01:20:00 utc |
weyus |
John |
2010-05-25 01:20:02 utc |
weyus |
Many thanks. |
2010-05-25 01:20:13 utc |
weyus |
My client was freaking out - we really need a decent workflow engine. |
2010-05-25 01:20:19 utc |
jmettraux |
sorry for this problem, It's a bit out of my scope |
2010-05-25 01:20:20 utc |
weyus |
I quite like what I've seen from your docs. |
2010-05-25 01:20:20 utc |
jmettraux |
OK |
2010-05-25 14:45:43 utc |
tosch_le |
anb_: http://github.com/tosch/ruote-kit/commit/8af0193b6db939cda181bf697f4c814381d90a21 |
2010-05-25 16:40:47 utc |
weyus |
Checking my understanding of how to register participants... |
2010-05-25 16:42:10 utc |
weyus |
The ability to register participants with the engine via regular expressions provides value when you need to send the same workitem to several participants at the same time, correct? |
2010-05-25 23:18:57 utc |
jmettraux |
lbt: welcome to #ruote |
2010-05-25 23:19:23 utc |
jmettraux |
weyus: hello |
2010-05-25 23:19:31 utc |
jmettraux |
about the regex registration of participants |
2010-05-25 23:19:57 utc |
jmettraux |
when you do engine.register_participant 'user\_.+', MyParticipantImpl |
2010-05-25 23:20:07 utc |
weyus |
jmettraux: I think I understand now. The regex allows you to batch up several registrations if they are all for the same type? |
2010-05-25 23:20:15 utc |
jmettraux |
exactly |
2010-05-25 23:21:47 utc |
weyus |
What's a little confusing is then you have to extract the participants of interest from the participant list that gets returned from the call to Engine.register_participant |
2010-05-25 23:21:58 utc |
weyus |
When you want to deal with them separately |
2010-05-25 23:23:06 utc |
jmettraux |
in the ruote-kit context, you end up with 1 storage participant, accessible via RuoteKit.storage_participant |
2010-05-25 23:23:39 utc |
jmettraux |
for the rest, it's more a game of "pushing workitems to the participants" |
2010-05-25 23:24:00 utc |
jmettraux |
the things happen not at the point of registration, but when and where the workitems get delivered |
2010-05-25 23:24:25 utc |
weyus |
Right |
2010-05-25 23:24:37 utc |
weyus |
At that point, I may need to filter. |
2010-05-25 23:26:20 utc |
weyus |
Is it true that the only handle I have to the participants is through the return value from Engine.register_participant? |
2010-05-25 23:27:19 utc |
jmettraux |
you can also do engine.context.plist.lookup(participant_name) |
2010-05-25 23:27:22 utc |
jmettraux |
but |
2010-05-25 23:28:01 utc |
jmettraux |
the preferred way of using participants is when they are instantiated on use |
2010-05-25 23:28:33 utc |
jmettraux |
if the participant is instantiated at registration time it can only be used by the worker inside the engine you registered the participant in |
2010-05-25 23:29:29 utc |
jmettraux |
maybe you are more interested in the workitems than in the participants |
2010-05-25 23:29:49 utc |
jmettraux |
getting a handle on a participant is only useful in the case of a storage participant |
2010-05-25 23:30:03 utc |
jmettraux |
and this is about fetching the workitems stored in there |
2010-05-25 23:30:19 utc |
jmettraux |
for the other participants, they receive workitems do something about them and then it's over |
2010-05-25 23:30:39 utc |
jmettraux |
now, if you have a concrete case, I may help |
2010-05-25 23:34:18 utc |
weyus |
Actually, you are correct. I am interested in workitems |
2010-05-25 23:34:26 utc |
weyus |
I think I get it - I'm very close to having a nice demo |
2010-05-25 23:34:45 utc |
jmettraux |
:) |
2010-05-25 23:35:36 utc |
weyus |
So is it a good practice to just reuse a workitem if you're doing a cursor - type workflow? |
2010-05-25 23:35:50 utc |
jmettraux |
well |
2010-05-25 23:35:53 utc |
weyus |
I have a workitem that has a 'user' and a 'message' |
2010-05-25 23:36:05 utc |
weyus |
And these will change as the workflow continues. |
2010-05-25 23:36:13 utc |
jmettraux |
good |
2010-05-25 23:36:26 utc |
weyus |
This is just a smart Jabber bot |
2010-05-25 23:36:44 utc |
weyus |
And I'm going to put a Rufus::Decision guy in there to determine the outgoing messages from the bot. |
2010-05-25 23:36:52 utc |
jmettraux |
nice |
2010-05-25 23:37:04 utc |
weyus |
I'll send it along once I have it working. |
2010-05-25 23:37:13 utc |
jmettraux |
:) |
2010-05-25 23:38:33 utc |
weyus |
If I register a participant as a Rufus::Decision::Participant, and then register '.+' as a StorageParticipant, will the 2nd registration override the first? |
2010-05-25 23:39:13 utc |
jmettraux |
no, they are checked in the registration order |
2010-05-25 23:39:25 utc |
weyus |
Cool |
2010-05-25 23:39:40 utc |
weyus |
Because I can't remember how to write the regex to say "not this whole word" :) |
2010-05-25 23:39:55 utc |
weyus |
So this: |
2010-05-25 23:39:56 utc |
weyus |
@rules_engine = @engine.register_participant 'rules_engine', Rufus::Decision::Participant |
2010-05-25 23:39:56 utc |
weyus |
@participants = @engine.register_participant '.+', Ruote::StorageParticipant |
2010-05-25 23:40:23 utc |
weyus |
Gives me a rules_engine participant that's a Rufus::Decision and two others that are Storage, correct? |
2010-05-25 23:40:31 utc |
jmettraux |
yes |
2010-05-25 23:40:32 utc |
jmettraux |
but |
2010-05-25 23:40:42 utc |
jmettraux |
@rules_engine will hold nothing |
2010-05-25 23:40:43 utc |
jmettraux |
nil |
2010-05-25 23:40:49 utc |
jmettraux |
remember |
2010-05-25 23:41:15 utc |
jmettraux |
it will create an instance of Rufus::Decision::Participant for each "delivery" |
2010-05-25 23:41:37 utc |
jmettraux |
and since it's a "decision participant", it's meant to decide on the fly |
2010-05-25 23:41:44 utc |
jmettraux |
having a handle on it has no sense |
2010-05-25 23:42:39 utc |
weyus |
That makes sense |
2010-05-25 23:43:12 utc |
weyus |
But I do need the handle on @participants so that I can do: @participants.get_by_wfid(wfid)[0] #assume a valid wfid |
2010-05-25 23:43:15 utc |
weyus |
right? |
2010-05-25 23:43:23 utc |
jmettraux |
Right |
2010-05-25 23:47:55 utc |
weyus |
How do I tell the current participant to "let go" of the item - that's a "reply" correct? |
2010-05-25 23:48:02 utc |
jmettraux |
yes |
2010-05-25 23:52:36 utc |
weyus |
This is totally fun |
2010-05-25 23:53:06 utc |
weyus |
I know, that's pathetic, but it's true ;) |
2010-05-25 23:53:14 utc |
weyus |
Not pathetic, just unusual |
2010-05-25 23:53:17 utc |
weyus |
:) |
2010-05-25 23:53:27 utc |
jmettraux |
glad you like it |
2010-05-25 23:55:13 utc |
weyus |
I do. |
2010-05-25 23:55:21 utc |
weyus |
I think I can do some really cool things with it. |
2010-05-25 23:55:27 utc |
jmettraux |
:) |
2010-05-25 23:55:30 utc |
weyus |
Later, I'd like to understand scaling best practices. |
2010-05-25 23:55:40 utc |
jmettraux |
ok |
2010-05-25 23:55:55 utc |
weyus |
I saw the EngineParticipant class and that looks key |
2010-05-25 23:56:04 utc |
jmettraux |
well |
2010-05-25 23:56:35 utc |
jmettraux |
that's more about distribution, but you are right, it can help with scaling obviously |
2010-05-25 23:57:13 utc |
jmettraux |
workers are meant to be first in line for scaling |
2010-05-25 23:57:33 utc |
jmettraux |
glad you saw EngineParticipant |
2010-05-25 23:57:59 utc |
jmettraux |
somehow, you could have multiple engines |
2010-05-25 23:58:13 utc |
jmettraux |
and have processes that communicate but that are not aware of each other |
2010-05-25 23:58:19 utc |
weyus |
Right |
2010-05-25 23:58:37 utc |
jmettraux |
a participant, upon receiving a workitem, can launch another process on another engine |
2010-05-25 23:58:43 utc |
weyus |
Thanks for the help - I really appreciate it. |
2010-05-25 23:58:52 utc |
jmettraux |
thanks for the feedback |
2010-05-25 23:59:01 utc |
jmettraux |
I will try to improve the documentation |
2010-05-26 00:03:58 utc |
weyus |
If my workitems have a 'message' key, and I want to emit the same message no matter what I get in in a Rufus::Decision::Participant, is this a valid decision table? |
2010-05-26 00:04:00 utc |
weyus |
@engine.register_participant :rules_engine, Rufus::Decision::Participant, |
2010-05-26 00:04:00 utc |
weyus |
:table => %{ |
2010-05-26 00:04:01 utc |
weyus |
in:message,out:message |
2010-05-26 00:04:01 utc |
weyus |
,"Here's a random number between 1 and 15: #{rand(15)}" |
2010-05-26 00:04:01 utc |
weyus |
} |
2010-05-26 00:04:33 utc |
jmettraux |
yes it is |
2010-05-26 00:04:34 utc |
weyus |
in and out are the same, and I want to effectively overwrite the message key. |
2010-05-26 00:04:37 utc |
weyus |
For now ;) |
2010-05-26 00:04:52 utc |
weyus |
Obviously, this isn't very interesting for the person on the other end of the conversation. |
2010-05-26 00:04:56 utc |
weyus |
Proving concept etc. |
2010-05-26 00:05:11 utc |
jmettraux |
understood |
2010-05-26 00:05:26 utc |
weyus |
many thanks - will test in AM - I hope to have a working Jabber bot backed by decision table and ruote tomorrow. |
2010-05-26 00:05:36 utc |
weyus |
Then it gets interesting. |
2010-05-26 00:05:37 utc |
jmettraux |
enjoy ! |
2010-05-26 00:05:40 utc |
weyus |
Cheers. |