ruote-activerecord in progress

11 views
Skip to first unread message

Kenneth Kalmer

unread,
Aug 23, 2009, 3:49:34 PM8/23/09
to openwferu-users
Hi everyone

I took as much time as I could over the weekend to mirror John's ruote-dm [1] project in a new ruote-activerecord [2] project. I've promised this to John on earlier occasions and last week in #ruote to Dennis. I have to note that this is being built and tested against ruote 2.0, and no support for the 0.9 series is even considered.

Progress is solid, albeit I haven't pushed to Github yet. The ActiveRecord backed expression store and participant are both in and working, I just need to support all of John's additional features in ruote-dm. The documentation will also take an evening to sort out since it is a deceptively large piece of code.

Hopefully I've worked around all the nastiness that is ActiveRecord, but I'll be relying on everyone's feedback to make sure all angles are covered.

Expect the working code by Monday evening (GMT) and the docs by Tuesday evening.

Best

1 - http://github.com/jmettraux/ruote-dm
2 - http://github.com/kennethkalmer/ruote-activerecord (not yet there)

--
Kenneth Kalmer
kenneth...@gmail.com
http://opensourcery.co.za
@kennethkalmer

John Mettraux

unread,
Aug 23, 2009, 8:36:12 PM8/23/09
to openwfe...@googlegroups.com
On Mon, Aug 24, 2009 at 4:49 AM, Kenneth Kalmer<kenneth...@gmail.com> wrote:
> Hi everyone
>
> I took as much time as I could over the weekend to mirror John's ruote-dm
> [1] project in a new ruote-activerecord [2] project. I've promised this to
> John on earlier occasions and last week in #ruote to Dennis. I have to note
> that this is being built and tested against ruote 2.0, and no support for
> the 0.9 series is even considered.
>
> Progress is solid, albeit I haven't pushed to Github yet. The ActiveRecord
> backed expression store and participant are both in and working, I just need
> to support all of John's additional features in ruote-dm. The documentation
> will also take an evening to sort out since it is a deceptively large piece
> of code.

Wow, that's a serious piece of news :) Great ! (John performs little dance).

Most of the pain I had with active-record >= 2.2.x was about queries
outside of the rails http request "cycle". Was fighting hard to get an
open and valid db connection when there was no GET/POST/... involved
:( Hence the ugly singlecon.rb and co.

Please tell me if I could help in any way. Maybe your work will have
an impact on ruote-dm (features suggestions, ...). Just tell me.

BTW, there is a convention you'd perhaps want to follow, it's about
this piece of code :

http://github.com/jmettraux/ruote/blob/470594686ee5c4d7110199b86fa9adb6828977c0/test/functional/engine_helper.rb#L96-118

It 'detects' adjacent engine persistence implementations. For
instance, when the ruote/ dir is next to ruote-dm/, it allows me to
run the functional tests with

ruby19 test/functional/test.rb --dm

I.e. with Ruote::Dm::DmPersistedEngine instead of Ruote::Engine (the
default) or Ruote::FsPersistedEngine (--fs).

In your case, it will expect the adjacent dir ruote-activerecord/ to
contain a *_engine.rb and it will make it available via the
--activerecord switch. It's quite important to test the engine
persistence extensively.

Note that the -C switch disables the expression caching of the engine
persistence. The engine gets a bit slower but always hits the
persistence. This mode is quite important for multi-process installs
(passenger, mongrel packs, ...).

Many thanks !!

Coffee ?

--
John Mettraux - http://jmettraux.wordpress.com

Kenneth Kalmer

unread,
Aug 24, 2009, 3:05:03 AM8/24/09
to openwfe...@googlegroups.com
On Mon, Aug 24, 2009 at 2:36 AM, John Mettraux <jmet...@openwfe.org> wrote:

On Mon, Aug 24, 2009 at 4:49 AM, Kenneth Kalmer<kenneth...@gmail.com> wrote:
> Hi everyone
>
> I took as much time as I could over the weekend to mirror John's ruote-dm
> [1] project in a new ruote-activerecord [2] project. I've promised this to
> John on earlier occasions and last week in #ruote to Dennis. I have to note
> that this is being built and tested against ruote 2.0, and no support for
> the 0.9 series is even considered.
>
> Progress is solid, albeit I haven't pushed to Github yet. The ActiveRecord
> backed expression store and participant are both in and working, I just need
> to support all of John's additional features in ruote-dm. The documentation
> will also take an evening to sort out since it is a deceptively large piece
> of code.

Wow, that's a serious piece of news :) Great ! (John performs little dance).

Where was my spycam when I needed it :)
 
Most of the pain I had with active-record >= 2.2.x was about queries
outside of the rails http request "cycle". Was fighting hard to get an
open and valid db connection when there was no GET/POST/... involved
:( Hence the ugly singlecon.rb and co.

I spend most of my day job "fighting" with ActiveRecord & Rails, but I also use ActiveRecord a lot outside of Rails, so I'm used to doing everything manually that usually happens in the background with ActionPack. Still, I'm no authority on AR, and will work hard to address any issues that pop up.
 
Please tell me if I could help in any way. Maybe your work will have
an impact on ruote-dm (features suggestions, ...). Just tell me.

Thanks, let me first mirror the functionality you've already got in :) I'm sure with ruote-kit I'll start adding more features, if required.
 
BTW, there is a convention you'd perhaps want to follow, it's about
this piece of code :

 http://github.com/jmettraux/ruote/blob/470594686ee5c4d7110199b86fa9adb6828977c0/test/functional/engine_helper.rb#L96-118

It 'detects' adjacent engine persistence implementations. For
instance, when the ruote/ dir is next to ruote-dm/, it allows me to
run the functional tests with

 ruby19 test/functional/test.rb --dm

I.e. with Ruote::Dm::DmPersistedEngine instead of Ruote::Engine (the
default) or Ruote::FsPersistedEngine (--fs).

In your case, it will expect the adjacent dir ruote-activerecord/ to
contain a *_engine.rb and it will make it available via the
--activerecord switch. It's quite important to test the engine
persistence extensively.

Note that the -C switch disables the expression caching of the engine
persistence. The engine gets a bit slower but always hits the
persistence. This mode is quite important for multi-process installs
(passenger, mongrel packs, ...).

Thanks, this helps a lot. I've also made sure that no queries inside ruote-activerecord uses ActiveRecord's built-in query cache. I'm also supporting ActiveRecord 2.3.3 and later only, and still have to make sure all the queries leverage the thread safety mechanisms provided.
 
Many thanks !!

Coffee ?

Ristretto please :)

Ciao

John Mettraux

unread,
Aug 26, 2009, 10:41:53 AM8/26/09
to openwfe...@googlegroups.com
On Mon, Aug 24, 2009 at 4:05 PM, Kenneth Kalmer<kenneth...@gmail.com> wrote:
> On Mon, Aug 24, 2009 at 2:36 AM, John Mettraux <jmet...@openwfe.org>
> wrote:
>>
>> On Mon, Aug 24, 2009 at 4:49 AM, Kenneth Kalmer<kenneth...@gmail.com>
>> wrote:
>> > Hi everyone
>> >
>> > I took as much time as I could over the weekend to mirror John's
>> > ruote-dm
>> > [1] project in a new ruote-activerecord [2] project.

Hi Kenneth,

I've just noticed you went on with ruote-activerecord. It's excellent,
keep up the good work ! I'm learning a lot [about ActiveRecord and
Rspec] by reading your code.

There is a small thing that bothers me. What do you think of switching
from "WorkItem" to "Workitem". I use "Workitem" in ruote 2.0 (and
ruote-dm). What about following in ruote-activerecord ?


BTW, I've just pushed a "ticket" branch for ruote-dm. It's the new
name of the 'lock' thing I showed you yesterday. 'ticket' is a better
name, it's not really a lock.

http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48e2885269a43d4/test/ut_2_ticket.rb
http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48e2885269a43d4/lib/ruote/dm/ticket.rb

Maybe that could find its way into ruote-activerecord as well. I still
have to adapt the 'concurrence' expression to use it though. Maybe I
could do the "port" by myself with you as the reviewer/committer. I
still have to prove it works for ruote-dm / concurrence, hence the
branch.


And well done with your presentation :
http://www.opensourcery.co.za/2009/08/25/ruote-in-20-minutes-video/ !

Cheers,

Kenneth Kalmer

unread,
Aug 26, 2009, 11:10:35 AM8/26/09
to openwfe...@googlegroups.com
On Wed, Aug 26, 2009 at 4:41 PM, John Mettraux <jmet...@openwfe.org> wrote:

On Mon, Aug 24, 2009 at 4:05 PM, Kenneth Kalmer<kenneth...@gmail.com> wrote:
> On Mon, Aug 24, 2009 at 2:36 AM, John Mettraux <jmet...@openwfe.org>
> wrote:
>>
>> On Mon, Aug 24, 2009 at 4:49 AM, Kenneth Kalmer<kenneth...@gmail.com>
>> wrote:
>> > Hi everyone
>> >
>> > I took as much time as I could over the weekend to mirror John's
>> > ruote-dm
>> > [1] project in a new ruote-activerecord [2] project.

Hi Kenneth,

I've just noticed you went on with ruote-activerecord. It's excellent,
keep up the good work ! I'm learning a lot [about ActiveRecord and
Rspec] by reading your code.

Thanks, it is progressing a lot slower than I wanted to, but so is life... Glad you're enjoying it !
 
There is a small thing that bothers me. What do you think of switching
from "WorkItem" to "Workitem". I use "Workitem" in ruote 2.0 (and
ruote-dm). What about following in ruote-activerecord ?

Workitem ftw, I dunno why I did WorkItem in the first place. Will apply some 'rpl' to the code to get this normalized.

BTW, I've just pushed a "ticket" branch for ruote-dm. It's the new
name of the 'lock' thing I showed you yesterday. 'ticket' is a better
name, it's not really a lock.

 http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48e2885269a43d4/test/ut_2_ticket.rb
 http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48e2885269a43d4/lib/ruote/dm/ticket.rb

Maybe that could find its way into ruote-activerecord as well. I still
have to adapt the 'concurrence' expression to use it though. Maybe I
could do the "port" by myself with you as the reviewer/committer. I
still have to prove it works for ruote-dm / concurrence, hence the
branch.

Ideally I would like to have these two projects mirror each other in functionality, making switching easy. I've kept the "public methods" the same for this reason. I'll watch this branch progress a little but, and play some devil's advocate for you first :)
 

Thanks !

Best

Gonzalo

unread,
Aug 27, 2009, 4:43:53 AM8/27/09
to Ruote (OpenWFEru) users
Hi Kenneth and all,

It seems that ActiveRecord, when used in a non-rails app, doesn't
manage the db connection pool automatically. (http://
coderrr.wordpress.com/2009/05/05/activerecords-with_connection-is-now-
useful/)

Nando and me did also some tests and wrote about the results in
openwferu user list (http://www.mail-archive.com/openwferu-
us...@googlegroups.com/msg01322.html) Sorry, I could not find the link
to the original post in google groups app. :(

Hope this can help...

Best regards.
Gonzalo.






On Aug 26, 5:10 pm, Kenneth Kalmer <kenneth.kal...@gmail.com> wrote:
> On Wed, Aug 26, 2009 at 4:41 PM, John Mettraux <jmettr...@openwfe.org>wrote:
>
>
>
>
>
> > On Mon, Aug 24, 2009 at 4:05 PM, Kenneth Kalmer<kenneth.kal...@gmail.com>
> > wrote:
> > > On Mon, Aug 24, 2009 at 2:36 AM, John Mettraux <jmettr...@openwfe.org>
> > > wrote:
>
> > >> On Mon, Aug 24, 2009 at 4:49 AM, Kenneth Kalmer<
> > kenneth.kal...@gmail.com>
> > >> wrote:
> > >> > Hi everyone
>
> > >> > I took as much time as I could over the weekend to mirror John's
> > >> > ruote-dm
> > >> > [1] project in a new ruote-activerecord [2] project.
>
> > Hi Kenneth,
>
> > I've just noticed you went on with ruote-activerecord. It's excellent,
> > keep up the good work ! I'm learning a lot [about ActiveRecord and
> > Rspec] by reading your code.
>
> Thanks, it is progressing a lot slower than I wanted to, but so is life...
> Glad you're enjoying it !
>
> > There is a small thing that bothers me. What do you think of switching
> > from "WorkItem" to "Workitem". I use "Workitem" in ruote 2.0 (and
> > ruote-dm). What about following in ruote-activerecord ?
>
> Workitem ftw, I dunno why I did WorkItem in the first place. Will apply some
> 'rpl' to the code to get this normalized.
>
> BTW, I've just pushed a "ticket" branch for ruote-dm. It's the new
>
> > name of the 'lock' thing I showed you yesterday. 'ticket' is a better
> > name, it's not really a lock.
>
> >http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48...
>
> >http://github.com/jmettraux/ruote-dm/blob/663de25ee361bb1b632dd3d6c48...
>
> > Maybe that could find its way into ruote-activerecord as well. I still
> > have to adapt the 'concurrence' expression to use it though. Maybe I
> > could do the "port" by myself with you as the reviewer/committer. I
> > still have to prove it works for ruote-dm / concurrence, hence the
> > branch.
>
> Ideally I would like to have these two projects mirror each other in
> functionality, making switching easy. I've kept the "public methods" the
> same for this reason. I'll watch this branch progress a little but, and play
> some devil's advocate for you first :)
>
> > And well done with your presentation :
> >http://www.opensourcery.co.za/2009/08/25/ruote-in-20-minutes-video/!
>
> Thanks !
>
> Best
>
> --
> Kenneth Kalmer
> kenneth.kal...@gmail.comhttp://opensourcery.co.za
> @kennethkalmer

Kenneth Kalmer

unread,
Aug 27, 2009, 9:41:24 AM8/27/09
to openwfe...@googlegroups.com
On Thu, Aug 27, 2009 at 10:43 AM, Gonzalo <gonzalo....@gmail.com> wrote:

Hi Kenneth and all,

It seems that ActiveRecord, when used in a non-rails app, doesn't
manage the db connection pool automatically. (http://
coderrr.wordpress.com/2009/05/05/activerecords-with_connection-is-now-
useful/
)

Nando and me did also some tests and wrote about the results in
openwferu user list (http://www.mail-archive.com/openwferu-
us...@googlegroups.com/msg01322.html) Sorry, I could not find the link
to the original post in google groups app. :(

Hope this can help...

Thanks for the headsup on this one, really appreciate it!

Kenneth Kalmer

unread,
Sep 27, 2009, 10:41:50 AM9/27/09
to openwfe...@googlegroups.com
On Thu, Aug 27, 2009 at 3:41 PM, Kenneth Kalmer <kenneth...@gmail.com> wrote:

Thanks for the headsup on this one, really appreciate it!

Thanks again to Gonzalo for the ActiveRecord pointers.

I've updated ruote-activerecord and pushed the updates to my repo [1]. All the integration tests with ruote 2.0 now pass on master. I still need to do docs, and then add support for tracking errors and history, albeit I'll first have to dive into the internals to see how I'll go about that.

Best

John Mettraux

unread,
Sep 27, 2009, 9:36:58 PM9/27/09
to openwfe...@googlegroups.com
On Sun, Sep 27, 2009 at 11:41 PM, Kenneth Kalmer

<kenneth...@gmail.com> wrote:
> On Thu, Aug 27, 2009 at 3:41 PM, Kenneth Kalmer <kenneth...@gmail.com>
> wrote:
>>
>> Thanks for the headsup on this one, really appreciate it!
>
> Thanks again to Gonzalo for the ActiveRecord pointers.
>
> I've updated ruote-activerecord and pushed the updates to my repo [1]. All
> the integration tests with ruote 2.0 now pass on master. I still need to do
> docs, and then add support for tracking errors and history, albeit I'll
> first have to dive into the internals to see how I'll go about that.

Hello Kenneth,

great news. I will work on ruote-dm's history and error tracking as
well. I'd be interested in feedback about history. Maybe I'll include
some stuff to ease process audits and things like that.

Enrico Bianco

unread,
Oct 29, 2009, 11:23:42 AM10/29/09
to ruote
Hey,

I'm interested in joining ruote-activerecord development. I want to
switch the current project I'm on to ruote 2.0 but we're currently
using the ActiveRecord-persisted engine and ruote-activerecord would
be the equivalent for ruote 2.0.

What's the best way to get started?

Thanks,
Enrico Bianco

John Mettraux

unread,
Oct 30, 2009, 12:35:07 AM10/30/09
to openwfe...@googlegroups.com

Hello,

Kenneth, the author or ruote-activerecord is currently doing an Italy
trip, he'll be back home (ZA) next week.

I'd suggest forking http://github.com/kennethkalmer/ruote-activerecord
and then trying to run the specs against along with the latest ruote
2.0.

ruote-activerecord is aligned on ruote-dm
(http://github.com/jmettraux/ruote-dm), IIRC ruote-ar is quite
complete. The next step for ruote-dm is the implementation of history
storage, this will then have to be ported to ruote-activerecord (if
needed).

Running the specs of ruote-activerecord is important, but there is
another "angle of attack" for testing : running ruote functional test
suite with ruote-activerecord. It's quite easy, from ruote 2.0 (and
assuming that ruote-activerecord/ is at the same level as ruote/
(2.0)), you can do

ruby test/functional/test.rb --activerecord

This will use the activerecord expression storage for all the
functional tests (fingers crossed).

I'll ping Kenneth about you volunteering.


Thanks for the help, cheers,


P.S. what is the thing about sequence { sequence { x } } getting
wobbly on ruote 0.9.x ?

Enrico Bianco

unread,
Oct 30, 2009, 4:18:59 PM10/30/09
to ruote

> P.S. what is the thing about sequence { sequence { x } } getting
> wobbly on ruote 0.9.x ?
>
> --
> John Mettraux   -  http://jmettraux.wordpress.com

Don't worry about it. There seems to be another problem. I just tried
sequence { sequence { x } } in a simple process definition and it
works just fine.

I'll try and get started with running the ruote-activerecord tests as
soon as I can. As always, thanks! =D

- Enrico
Reply all
Reply to author
Forward
0 new messages