processi

about processes and engines

Archive for the ‘rubyonrails’ Category

Ruote presentation at Stockholm University

I was invited to talk about Ruote at the Information Labs of the Stockholm University (syslab).

My presentation covered the general concepts of Ruote (OpenWFEru) over a few slides. As always, it’s difficult to select the subjects for a rather unknown target audience.

(This time, I was happy to notice that only one person fell asleep. Well, after reflection, I think it was mostly due to the fact it was a lunch presentation, people were eating)

Many thanks to Petia and to the Professor Johannesson for inviting me.

Read the rest of this entry »

Written by John Mettraux

October 15, 2008 at 7:06 am

ruote on rails 2.0

update (2010/04/06) : this is an old post (2008), if you’re looking for ruote on rails, look at http://github.com/tosch/ruote-on-rails (rails3 branch is at http://github.com/tosch/ruote-on-rails/tree/rails3)

 

Two years ago I started writing Ruote, an open source workflow (incidentally BPM) engine written in Ruby. The immediate reaction was “how do I integrate that with Rails ? Please send me the code”. So I started writing an example Rails web application, it was initially nicknamed ‘densha’ and then renamed to ‘ruote-web’. There is a visible instance of this web application on a demo server.

But I’m not very good at web development and this was almost my first Ruby on Rails application. Time passed, I worked a lot on Ruote-Rest, a Ruby web application based on Rack (not Rails). Ruote-rest is meant to be consumed by HTTP clients that are not browsers, you could say it’s a RESTful webservice.

It is time for a second take at Ruote-Web. I started with a Rails plugin for easy integration of Ruote into a Rails application, it’s simply called ruote_plugin. It provides at first migration generation (workitem storage mainly, but also engine persistence via ActiveRecord instead of the filesystem if necessary) and then helper scripts for installing the engine and its dependencies under vendor/plugins/ or as gem.

The next step was building ruote-web2 on top of the ruote_plugin. Let’s note that the initial implementation of a “ruote plugin” was done by Tomaso Tosolini (who also wrote the rdbms based persistence for the process engine, Thanks a ton Tomaso !).

Ruote-web2 is way simpler than ruote-web, and it adheres to the resource structure laid by ruote-rest. It adds user and group resources though. For the user resource I didn’t look very far, I used the ultra-classic restful-authentication.

This will be an interesting packaging of Ruote for people of want to “just replace the Ruote logo and place theirs” to benefit immediately from a simple and robust open source workflow engine/suite (I’m quoting someone in the community for the “just replace the logo” thing).

Ruote process definitions can be expressed as XML, Ruby and now even JSON (or YAML if you push). I plan to integrate process definition tinkering into ruote-web2 (as I did in ruote-rest) and maybe more. That should mean edition of process definitions in the process portfolio and edition of definitions of processes in-flight (already implemented in ruote-rest).

The hardest part part of this implementation work is the QA, not only the classical QA but also the QA triggered by this goal : I’d like to have the same (RESTful) interface for ruote-rest and ruote-web2. The “connectedness” aspect deserves a big share of the design (and then QA) work.

Ruote-web2 is more perhaps “ruote-rest on Rails” than “ruote-web take 2”. There is a consequent amount of work left, but I’ll probably be done in three or four weeks.

It’s open source after all, so here are some links to the source of these tools :

http://github.com/jmettraux/ruote_plugin
http://github.com/jmettraux/ruote-web2

http://github.com/jmettraux/ruote

And finally to the mailing list :

http://groups.google.com/group/openwferu-users

Written by John Mettraux

September 29, 2008 at 1:38 pm

the scheduler and the active_record

update :

I have had issues with ActiveRecord > 2.2, a bunch of jobs scheduled where “missing the train” (MySQL gone).

I placed

  ActiveRecord::Base.verify_active_connections!

at the beginning of my scheduled blocks and the issue seem to have vanished. Rails does that connection verification for each request, not for things outside of requests, have to do it by oneself.


The rufus-scheduler cares about scheduling, it’s written in Ruby. Some people use it in a RubyOnRails environment. I’ve seen people having trouble with ActiveRecord connections and the scheduler. The last instance of that was with Jim.

My initial reaction was “the rufus-scheduler has nothing to do with ActiveRecord’s connection management, it’s a dumb ruby library, why do you post that here ?”, but I didn’t word that reaction and I simply pointed at the ‘connection management’ issue. That paid well, since Jim came up with a solution, closing the connection at the end of each of scheduled job (ActiveRecord was implicitely opening a new connection for the job).

One of the great things with Ruby and Open Source is that you can look at the source. So I glanced at how ActiveRecord does the connection management and learnt a thing or two. (And with Ruby there is far less code to scan before reaching the objective)

The rufus-scheduler has one thread for the scheduling and then one thread for each job it triggers. One thread per job so that the scheduling thread doesn’t get blocked by the job executions. In its “thread safe” mode, ActiveRecord stores its database connections in a hash whose key is the current Thread object_id. So if you have lots of job that do business with ActiveRecord, you’ll have lots of threads and a[n open] connection for each of those threads.

Thanks to Jim for triggering this little active_record study and for sharing his solution.

Know thyself (and your tools).I ha

Written by John Mettraux

September 14, 2008 at 6:15 am

Rails and OpenWFEru in Amsterdam (job)

From time to time I intercept a job offer and “republish” it here.

This time, it comes from Arjan :

The BiD Network Foundation operates the world’s largest international investor matchmaking and business plan competition for SMEs in developing countries.

(…)

We are currently creating a workflow system to manage the business plan assessment (based on Rails and OpenWFEru), and a Management Information System (MIS).

Check the full offer : Software engineer / system integrator for “a better world”

Written by John Mettraux

May 20, 2008 at 11:58 pm

taskr – restful scheduler – by Matt Zukowski

Matt just announced he developed Taskr a RESTful cron / scheduler daemon written in Ruby.

A cron / scheduler managed via REST, that’s neat. PUT a task for execution in 5 days or every day at 6 am. There are facilities for the tasks to interact with other RESTful services.

taskr_screenshot

It’s based on Camping and on the OpenWFEru scheduler. For the Ruby on Rails aficionados, there is a Taskr Rails plugin.

I like the idea, it’s very focused, with a big potential. Congrats to Matt !

Written by John Mettraux

January 4, 2008 at 4:09 pm

restful workflow engine

update : the work announced here has been renamed “ruote-kit”, you can find it at http://github.com/tosch/ruote-kit


I’ve been working on this vaporous thing / project for a while, now it’s here, in its first iteration. It’s called Kisha (steam train).

The short designation is “RESTful workflow engine”, the long one is “RESTful Rails® enveloppe for an OpenWFEru engine [and a worklist]”.

Kisha is leveraging Ruby on Rails 2.0.2 to present a RESTful interface to the OpenWFEru workflow engine.

This first iteration implements 2 core use cases via 2 resources.

The use cases are :

  • launching a new instance of a process
  • editing and then proceeding/saving a workitem

quick wiki quote :

A business process or business method is a collection of interrelated tasks, which solve a particular issue

The 2 resources are “processes” and “workitems”. Thus, RESTfully yours, these paths are available :

  • /processes the list of processes currently running in the workflow engine
  • /processes/{process_instance_id} accessing a particular process instance
  • /workitems all the workitems awaiting manipulation/proceeding from an external participant (you)
  • /workitems/{workitem_id} a particular workitem

Launching a process is done by POSTing a process/launchitem representation to /processes, while modifying/proceeding a workitem is by PUTting an updated representation of that workitem at /workitems/{workitem_id}.

(there is a working draft enumerating those resources at kisha.txt)

That’s for the theory.

Kisha is available in its first iteration as a zip download or via the source (see this piece of documentation).

For documentation and test purposes, I took care of providing a well-connected set of HTML representations of the resources, here are a few screenshots :

Kisha screenshot

What’s in this first iteration :

  • well connected HTML representations (learn the interface by playing around)
  • Rails ActiveResource JSON and XML representations
  • Atom representations as well
  • Possibility to post resources (/processes for now) via AtomPub
  • limited Authentication scheme (127.0.0.1 is trusted as well as the canonical “user” user, via basic http authentication)
  • binary Authorization (once you’re authentified, you can do everything)
  • a chart representation for workitems and processes (it’s taken out of densha)
  • a plain model for participants : there is one ‘catch-all’ participant (an expressions with a typo could be mistaken for a participant)

I’ve tried hard to accept a large set of variants for the process/workitem input (json, xml, yaml, atom entries, …), Kisha should be able to accomodate them all, this has proven the most time consuming aspect for now.

What will be in further iterations :

  • more authentication schemes (Pat is petitioning me about them)
  • a better authorization system (who can launch, who can proceed, who can pause)
  • more resources (process errors, process variables, maybe process definitions, …)
  • why not a /participants resource ?
  • more efficient usage of the resources (etag & co)
  • polishing the AtomPub interactions
  • activity [atom] feed
  • more documentation

Over for now.

Feedback is welcome on the OpenWFEru mailing lists.

Written by John Mettraux

December 20, 2007 at 5:52 am

rails and periodic tasks

I came across this post by Joseph Pearson : “Scheduling periodic tasks in a Rails application”, it features a nice combination of the OpenWFEru scheduler with the Daemons gem. Joseph’s company, Inventive Labs, is using it into its BluePrint CMS.

The introducing remark on OpenWFEru made me laugh :

OpenWFEru is a Workflow Engine, which sounds impressively enterprisey. I don’t know much about that, but it comes with a pretty good scheduler

True enough, “workflow” and “bpm” do sound ‘enterprisey’. That started me into a thread of reflection, somehow, I’m really hoping to make workflow (business process) management less enterprisey by providing OpenWFEru (Rufus). Business processes can be found in each of the application we, developers, create (modify) every day, a BPMS solution simply tries hard to make them “1st class” citizens, readily available for examination and manipulation (management).

This scheduler is used by more and more people, that’s great.

Written by John Mettraux

November 21, 2007 at 1:28 pm