quickstart

The simple.rb quickstart is probably too simple.

The flickr quickstart polls users about random pictures found on Flickr.

The mini todo tool quickstart uses a workitem to store a todo list and iterates until the list is entirely checked (1 participant involved). Warning : this quickstart is a bit rough.

the flickr quickstart

Here is a tiny process that fetches picture info from http://flickr.com and submit it to three user, working concurrently on choosing their favourite photo.

Three human participants and two automated participants are involved (though for the sake of brevity, our human participants are represented by a random number generator)

This example is inspired by Amazon’s mechanical turk, where one example of workflow uses human participants to tell whether a set of pictures contains the photo of a tree or an animal, etc…

To run this example, you have at first to install the ruote gem (and the atom-tools one) :

sudo gem install ruote atom-tools

Then, to download and run the quickstart (Ruby 1.8.6 at least) :

curl http://gist.github.com/raw/35914/d7bf829870c1a24eac7ac78be41d71535f8c8f48 > qs.rb
ruby qs.rb

That should generate an output like :

 users selected those images : 

 - user-charly :: http://www.flickr.com/photos/ssami/3105506108/
 - user-bob :: http://www.flickr.com/photos/30211958@N00/3106452587/
 - user-alice :: http://www.flickr.com/photos/mynamemeanseyes/3098673543/

If not, you’ll find some help on the user’s mailing list or on the #ruote channel on freenode.net

Here is the source of the quickstart :

 

the mini todo tool quickstart

Warning : this process is a bit rough, but it may probably help some of you understand Ruote. It’s in fact a special case (1 participant, 1 loop).

This quickstart was initially mentioned in this blog post

The whole quickstart can be found at http://gist.github.com/35894

The process definition boils down to :

1 class MyTodoProcess < OpenWFE::ProcessDefinition
2   cursor do
3     perform_task
4     continue :unless => "${f:over}"
5   end
6 end

It’s a cursor that gets rewound until the todos are all checked.

The unique participant is named ‘perform_task’. It simply presents the user on the console with a list of tasks to perform, accepts new tasks, marks tasks as checked. At the end of each of his run, the participant determines whether all tasks have been performed and sets the value of the field ‘over’ accordingly.

Ruote is meant to be stoppable and restartable, the tricky part of this example is that, since it’s a console example, each time the Ruby runtime gets stopped, the process is stuck in a suspended state. At restart, the process instance has to get re-ignited via a ‘replay_at_error’ call. (That’s something very advanced, you shouldn’t have to care about that unless you’re building a similar console-driven process).