Starting a new thread to reflect the current topic...
So for part of our evaluation of Ruote, we wanted to be able to look at the history. The below solution was provided and works great for tests, but *sometimes* errors out when asking outside the context of a test.
I added this code to the Ruote::StorageHistory in our app - it just adds a method to StorageHistory which filters on dispatched and returns the participant_name sorted by original_put_at. https://gist.github.com/2207156
So when we run this as part of tests, it works exactly like we expect it to - it returns an array of executed steps.
However, when we put it behind a url to ask what the steps for a given process are, I inconsistently get the following error - sometimes it works and sometimes it doesn't.
Rufus::Json::ParserError - lexical error: invalid char in json text.
> STAGES_PDEF = Ruote.define do > sequence do > stage1 > stage2 > stage3 > end > end
And the participant looks like this:
RuoteKit.engine.register_participant :stage1 do |workitem|
> Case.run_stage1(workitem.fields['reference']) > workitem.fields["case_result"] = "Completed Stage 1" > end
The process definition works fine and completes. It's only when asking about the history that it fails with this error. It fails on line 6 of the above pasted code: all_expressions = self.by_process(wfid)
Any ideas as to why this might occur? Is it breaking because the process has already completed by the time the history is requested?
On Friday, March 23, 2012 3:46:44 PM UTC-5, John Mettraux wrote:
> On Fri, Mar 23, 2012 at 09:38:11AM -0500, Doug Bryant wrote:
> > One other question. Is there a way to access the history of a workflow > > process. I saw Ruote::StorageHistory but not quite sure if that will > work. > > If on the previous example I append the two lines
> > It looks like the execution path through ruote, but includes lines such > as > > concurrence (blank line - no participant name). Looking more for a > result > > like %w{con1 con2 print_messages}
> Hello Doug,
> yes, this history implementation records every event in the engine.
On Mon, Mar 26, 2012 at 10:53:27AM -0700, Doug Bryant wrote:
> So for part of our evaluation of Ruote, we wanted to be able to look at the > history. The below solution was provided and works great for tests, but > *sometimes* errors out when asking outside the context of a test.
> I added this code to the Ruote::StorageHistory in our app - it just adds a > method to StorageHistory which filters on dispatched and returns the > participant_name sorted by original_put_at. https://gist.github.com/2207156
> So when we run this as part of tests, it works exactly like we expect it to > - it returns an array of executed steps.
> However, when we put it behind a url to ask what the steps for a given > process are, I inconsistently get the following error - sometimes it works > and sometimes it doesn't.
> Rufus::Json::ParserError - lexical error: invalid char in json text.
> > STAGES_PDEF = Ruote.define do > > sequence do > > stage1 > > stage2 > > stage3 > > end > > end
> And the participant looks like this:
> RuoteKit.engine.register_participant :stage1 do |workitem| > > Case.run_stage1(workitem.fields['reference']) > > workitem.fields["case_result"] = "Completed Stage 1" > > end
> The process definition works fine and completes. It's only when asking > about the history that it fails with this error. It fails on line 6 of the > above pasted code: all_expressions = self.by_process(wfid)
> Any ideas as to why this might occur? Is it breaking because the process > has already completed by the time the history is requested?
Hello Doug,
what version of Ruby (and patchlevel) on which platform? What JSON library are you using (YAJL, json or pure-json)? What does the Rufus::Json::ParserError backtrace look like?
Your gist looks good, a more economic alternative would be to do the filtering in the StorageParticipant#on_msg so that messages that don't interest you are discarded and don't take up storage space. I need to provide a hook to simplify such an approach...
In your gist: those aren't "expressions" but "messages", the history stores messages.
> On Mon, Mar 26, 2012 at 10:53:27AM -0700, Doug Bryant wrote:
>> So for part of our evaluation of Ruote, we wanted to be able to look at the >> history. The below solution was provided and works great for tests, but >> *sometimes* errors out when asking outside the context of a test.
>> I added this code to the Ruote::StorageHistory in our app - it just adds a >> method to StorageHistory which filters on dispatched and returns the >> participant_name sorted by original_put_at. https://gist.github.com/2207156
>> So when we run this as part of tests, it works exactly like we expect it to >> - it returns an array of executed steps.
>> However, when we put it behind a url to ask what the steps for a given >> process are, I inconsistently get the following error - sometimes it works >> and sometimes it doesn't.
>> Rufus::Json::ParserError - lexical error: invalid char in json text.
>>> STAGES_PDEF = Ruote.define do >>> sequence do >>> stage1 >>> stage2 >>> stage3 >>> end >>> end
>> And the participant looks like this:
>> RuoteKit.engine.register_participant :stage1 do |workitem| >>> Case.run_stage1(workitem.fields['reference']) >>> workitem.fields["case_result"] = "Completed Stage 1" >>> end
>> The process definition works fine and completes. It's only when asking >> about the history that it fails with this error. It fails on line 6 of the >> above pasted code: all_expressions = self.by_process(wfid)
>> Any ideas as to why this might occur? Is it breaking because the process >> has already completed by the time the history is requested?
> Hello Doug,
> what version of Ruby (and patchlevel) on which platform? > What JSON library are you using (YAJL, json or pure-json)? > What does the Rufus::Json::ParserError backtrace look like?
> Your gist looks good, a more economic alternative would be to do the > filtering in the StorageParticipant#on_msg so that messages that don't > interest you are discarded and don't take up storage space. I need to provide > a hook to simplify such an approach...
> In your gist: those aren't "expressions" but "messages", the history stores > messages.
> -- > you received this message because you are subscribed to the "ruote users" group. > to post : send email to openwferu-users@googlegroups.com > to unsubscribe : send email to openwferu-users+unsubscribe@googlegroups.com > more options : http://groups.google.com/group/openwferu-users?hl=en
> Your gist looks good, a more economic alternative would be to do the > filtering in the StorageParticipant#on_msg so that messages that don't > interest you are discarded and don't take up storage space. I need to provide > a hook to simplify such an approach...
> -- > you received this message because you are subscribed to the "ruote users" group. > to post : send email to openwferu-users@googlegroups.com > to unsubscribe : send email to openwferu-users+unsubscribe@googlegroups.com > more options : http://groups.google.com/group/openwferu-users?hl=en
It's a heavily modified version of the barley.rb in examples.
It's a little bit manual and thrown together in a hurry. You need to set the db connection variables and manually create the cases table (sql above Case object).
> It's a heavily modified version of the barley.rb in examples.
> It's a little bit manual and thrown together in a hurry. You need to set > the db connection variables and manually create the cases table (sql above > Case object).
Here is our Gemfile. We had to build a gem from the route repository last week and put it into our internal repo because we couldn't get the app deployed correctly with a bundler :git reference. Just remove the unnecessary bits like amqp and point route to the git repo.
>> Your gist looks good, a more economic alternative would be to do the >> filtering in the StorageParticipant#on_msg so that messages that don't >> interest you are discarded and don't take up storage space. I need to provide >> a hook to simplify such an approach...
> -- > you received this message because you are subscribed to the "ruote users" group. > to post : send email to openwferu-users@googlegroups.com > to unsubscribe : send email to openwferu-users+unsubscribe@googlegroups.com > more options : http://groups.google.com/group/openwferu-users?hl=en
On Mon, Mar 26, 2012 at 05:01:11PM -0500, Doug Bryant wrote:
> Here is our Gemfile. We had to build a gem from the route repository last week and put it into our internal repo because we couldn't get the app deployed correctly with a bundler :git reference. Just remove the unnecessary bits like amqp and point route to the git repo.
thanks, may I suggest using ruote-sequel from master? It has evolved since the 2.2.0 gem you seem to be using. ruote-sequel master is aligned on ruote master.
That wasn't it. The app experienced the same behavior.
The one thing I did notice is that if you remove the line(s) where the model is updated from the process definitions, i.e. "Case.update_case_stage(workitem.fields['reference'], "stage3")", the error goes away.
> On Mon, Mar 26, 2012 at 05:01:11PM -0500, Doug Bryant wrote:
>> Here is our Gemfile. We had to build a gem from the route repository last week and put it into our internal repo because we couldn't get the app deployed correctly with a bundler :git reference. Just remove the unnecessary bits like amqp and point route to the git repo.
> thanks, may I suggest using ruote-sequel from master? It has evolved since > the 2.2.0 gem you seem to be using. ruote-sequel master is aligned on ruote > master.
> -- > you received this message because you are subscribed to the "ruote users" group. > to post : send email to openwferu-users@googlegroups.com > to unsubscribe : send email to openwferu-users+unsubscribe@googlegroups.com > more options : http://groups.google.com/group/openwferu-users?hl=en
On Mon, Mar 26, 2012 at 06:00:08PM -0500, Doug Bryant wrote:
> That wasn't it. The app experienced the same behavior.
> The one thing I did notice is that if you remove the line(s) where the model is updated from the process definitions, i.e. "Case.update_case_stage(workitem.fields['reference'], "stage3")", the error goes away.
It must have been the specific versions of gems we were using. I updated your revised example to do the same thing as yesterday (connect to Active record model object & save data) and it works fine.
Thanks for the help with questions and implementing the StorageHistory#accept? method for filtering storage items.
> On Mon, Mar 26, 2012 at 06:00:08PM -0500, Doug Bryant wrote:
>> That wasn't it. The app experienced the same behavior.
>> The one thing I did notice is that if you remove the line(s) where the model is updated from the process definitions, i.e. "Case.update_case_stage(workitem.fields['reference'], "stage3")", the error goes away.
> -- > you received this message because you are subscribed to the "ruote users" group. > to post : send email to openwferu-users@googlegroups.com > to unsubscribe : send email to openwferu-users+unsubscribe@googlegroups.com > more options : http://groups.google.com/group/openwferu-users?hl=en