Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Storage History Behavior
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Doug Bryant  
View profile  
 More options Mar 26 2012, 1:53 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 10:53:27 -0700 (PDT)
Local: Mon, Mar 26 2012 1:53 pm
Subject: Storage History Behavior

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.

>           ce'])\\n  workitem.fields[\\"case_result\\"] = \\"Completed

>                      (right here) ------^

> :

The process definition looks like this:

>   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?  

Thanks, Doug


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 26 2012, 3:36 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Tue, 27 Mar 2012 04:36:14 +0900
Local: Mon, Mar 26 2012 3:36 pm
Subject: Re: [ruote:3474] Storage History Behavior

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.

Thanks in advance,

--
John Mettraux - http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 26 2012, 4:12 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 15:12:07 -0500
Local: Mon, Mar 26 2012 4:12 pm
Subject: Re: [ruote:3474] Storage History Behavior
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.3.0] vía RVM on Lion.

For json, we are using YAJL;  Rufus::Json.backend = :yajl

Will update our code from the gist to reflect message rather than expression (thanks for that feedback).  

Since you indicated looking at the json parser, I tried the json one also.  Here are the results from each

YAJL:

> 2012-03-26 14:58:58] INFO  WEBrick 1.3.1
> [2012-03-26 14:58:58] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin11.3.0]
> [2012-03-26 14:58:58] INFO  WEBrick::HTTPServer#start: pid=46914 port=9292
> Rufus::Json::ParserError - lexical error: invalid char in json text.
>           ce'])\\n  workitem.fields[\\"case_result\\"] = \\"Completed
>                      (right here) ------^
> :
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:185:in `rescue in decode'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:182:in `decode'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `block in get_many'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `collect'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `get_many'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-2.3.0/l ib/ruote/log/storage_history.rb:79:in `by_process'
>    /Users/doug/devroot/apps/bpm_reference/lib/ruote_history_ext.rb:6:in `steps_by_process'

JSON

> Rufus::Json::ParserError - 399: unexpected token at '{"on_workitem":"proc do |workitem|\\n  Case.run_stage3(workitem.fields['reference'])\\n  workitem.fields[\\"case_result\\"] = \\"Completed Stage 3\\"\\nend"}],"workitem":{"fields":{"reference":"81","case_result":"Complet ed Stage 2","params":{"ref":"stage3"}},"wf_name":null,"wf_revision":null,"fei":{"eng ine_id":"engine","wfid":"20120326-2003-kabaroma-gijiruno","subid":"2e810d14 1687fef23c228ea005607b7a","expid":"0_0_2"},"participant_name":"stage3","re_ dispatch_count":0},"type":"history","_id":"47068!70119173172880!2012-03-26! 1332792219.243796!018!0_0_2!2e810d141687fef23c228ea005607b7a!20120326-2003- kabaroma-gijiruno","action":"dispatch","put_at":"2012-03-26 20:03:39.347652 UTC","original_id":"47068!70119173172880!2012-03-26!1332792219.243796!018", "original_put_at":"2012-03-26 20:03:39.244019 UTC","_rev":1}]':
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:185:in `rescue in decode'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:182:in `decode'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `block in get_many'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `collect'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `get_many'
>    /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-2.3.0/l ib/ruote/log/storage_history.rb:79:in `by_process'
>    /Users/doug/devroot/apps/bpm_reference/lib/ruote_history_ext.rb:6:in `steps_by_process'

The process completes successfully, it just errors out when accessing the history

Doug

On Mar 26, 2012, at 2:36 PM, John Mettraux wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 26 2012, 4:25 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Tue, 27 Mar 2012 05:25:12 +0900
Local: Mon, Mar 26 2012 4:25 pm
Subject: Re: [ruote:3474] Storage History Behavior
2012/3/27 John Mettraux <jmettr...@gmail.com>:

> 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...

  https://github.com/jmettraux/ruote/commit/c04d7ee7d9f8703cd00fa6f4536...

I hope it can useful to someone.

Best regards,

--
John Mettraux   -   http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 26 2012, 4:43 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Tue, 27 Mar 2012 05:43:52 +0900
Local: Mon, Mar 26 2012 4:43 pm
Subject: Re: [ruote:3475] Storage History Behavior

On Mon, Mar 26, 2012 at 03:12:07PM -0500, Doug Bryant wrote:

> >       /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:185:in `rescue in decode'
> >       /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/rufus-json-1. 0.1/lib/rufus/json.rb:182:in `decode'
> >       /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `block in get_many'
> >       /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `collect'
> >       /Users/doug/devroot/apps/bpm_reference/vendor/ruby/1.9.1/gems/ruote-sequel- 2.2.0/lib/ruote/sequel/storage.rb:180:in `get_many'

Hello Doug,

thanks for the detailed information. I see that you're using ruote-sequel :
What database are you using?

I'm trying to set up a test case.

Thanks in advance,

--
John Mettraux - http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 26 2012, 5:02 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 16:02:30 -0500
Local: Mon, Mar 26 2012 5:02 pm
Subject: Re: [ruote:3477] Storage History Behavior
We're using postgresql as the backend  to route-sequel.

I'm also trying to setup a test to be able to show off the described behavior.  

Doug

On Mar 26, 2012, at 3:43 PM, John Mettraux wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 26 2012, 5:44 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 14:44:17 -0700 (PDT)
Local: Mon, Mar 26 2012 5:44 pm
Subject: Re: [ruote:3475] Storage History Behavior

This gist demonstrates the behavior we are seeing.
 https://gist.github.com/2209952

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).

Thanks for taking a look at this.

Doug


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 26 2012, 5:55 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Tue, 27 Mar 2012 06:55:51 +0900
Local: Mon, Mar 26 2012 5:55 pm
Subject: Re: [ruote:3480] Storage History Behavior

On Mon, Mar 26, 2012 at 02:44:17PM -0700, Doug Bryant wrote:

> This gist demonstrates the behavior we are seeing.
>  https://gist.github.com/2209952

> 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).

Sorry, what does the Gemfile[.lock] look like?

--
John Mettraux - http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 26 2012, 6:01 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 17:01:11 -0500
Local: Mon, Mar 26 2012 6:01 pm
Subject: Re: [ruote:3476] Storage History Behavior

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.

https://gist.github.com/2210082

Doug

On Mar 26, 2012, at 3:25 PM, John Mettraux wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 26 2012, 6:10 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Tue, 27 Mar 2012 07:10:07 +0900
Local: Mon, Mar 26 2012 6:10 pm
Subject: Re: [ruote:3481] Storage History Behavior

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.

> https://gist.github.com/2210082

Hello Doug,

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.

I'll try by myself in a few hours.

Thanks again,

--
John Mettraux - http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 26 2012, 7:00 pm
From: Doug Bryant <d...@netinlet.com>
Date: Mon, 26 Mar 2012 18:00:08 -0500
Local: Mon, Mar 26 2012 7:00 pm
Subject: Re: [ruote:3482] Storage History Behavior
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.  

Doug

On Mar 26, 2012, at 5:10 PM, John Mettraux wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Mettraux  
View profile  
 More options Mar 27 2012, 5:15 pm
From: John Mettraux <jmettr...@gmail.com>
Date: Wed, 28 Mar 2012 06:15:32 +0900
Local: Tues, Mar 27 2012 5:15 pm
Subject: Re: [ruote:3483] Storage History Behavior

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.

Hello Doug,

I reworked your gist, trimming it:

  https://gist.github.com/2219926

I couldn't reproduce the error.

May I suggest you try this gist in your environment (you'd have to adapt the
sequel connection bit) and tell me how it goes?

You should also compare the gist's Gemfile.lock with your Gemfile.lock.

Best regards,

--
John Mettraux - http://lambda.io/processi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Bryant  
View profile  
 More options Mar 27 2012, 6:06 pm
From: Doug Bryant <d...@netinlet.com>
Date: Tue, 27 Mar 2012 17:06:42 -0500
Local: Tues, Mar 27 2012 6:06 pm
Subject: Re: [ruote:3486] Storage History Behavior
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.

Doug

On Mar 27, 2012, at 4:15 PM, John Mettraux wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »