Forum OpenACS Development: Heads-up: New Workflow Package

Posted by Lars Pind on
It looks like we'll get a chance to implement a new and improved light-weight workflow package starting in January.

I've already started writing the spec, and even though it's not quite finished, I figured I'd dump the URL now, so you can start thinking and we can get some preliminary feedback on the current state of it.

I'll post again when it's completed.

Posted by Dan Wickstrom on
Lars, I like the idea of replacing petri nets with a FSM, but I wonder about the idea of dumping graphviz and replacing it with a task-list UI.  It's true that graphviz rendered the workflows with curved lines, but overall I thought it still gave a pretty good overview of the workflow structure - especially for complicated workflows.  If you switch to using tasks lists will the user still be able to to get a good overview of the workflow structure?  I found it hard to compile graphviz, so if you can replace it, I think that's a good thing, but I would still like to see something that is equivalent for graphically representing workflows.
Posted by Lars Pind on

You're right that a graphical representation would be nice. I don't think we have funds to make that happen this time, but we can always add it later, especially if we can find an easier to install tool than graphviz.


Posted by Tilmann Singer on
I would also like to add a comment in favor of the graphical representation, although it might not really be relevant: I found that people were amazed by the automatically generated workflow diagrams of graphviz and it was easy to convince them that the workflow package is an extremely powerful tool, although they didn't fully understand its functionality. So this might be more interesting for marketing than for its actual usefulness ...

Also I didn't find graphviz that hard to install - only the lack of a friendly message 'You haven't installed graphviz, here are some hints what to do ...' but an error page instead was a bit ugly.

I found your idea on the openacs social in amsterdam quite interesting, to generate a copy of a workflow when a new process starts and to store that separately from the original workflow, so that they can be changed without having an influence on already active processes, and also that workflows for active processes can be changed individually. Is this somehow part of your new plans?

And a final minor note against ad_form/ad_page_contract style for defining workflows in tcl: I don't like them for the simple reason that it's hard to add commments in the code.

Posted by Dan Wickstrom on
I'm looking at something right now that has comments in ad_form, and it seems to work fine. How is it a problem to use comments in ad_form?
Posted by Tilmann Singer on
Dan, the only way I can think of is to create the form definition list dynamically, like this:
set form_def {
        {value $index_p}}

# here is a comment on an element
lappend form_def {

ad_form -form $form_def
Which seems a bit awkward to me, but propably that's just matter of taste. How does the code you're looking at do that?
Posted by Mark Aufflick on
Lars, I love the sound of a new workflow package. I had one project where I was planning to use the old wf package, and I had a sigh of relief when it was canned, because it scared me! (But maybe I'm just soft... or maybe I never actually investigated it enough)

While browsing a recent Linux Journel I noticed an article on JStateMachine which is an interesting Java class which basically builds a Java app using a FSM to define the processes.

They use an XML definition format, and they have a description and worked example of how to systematically convert a state chart into XML:

The also have a (well commented) formal DTD defining the format:

Note that as a great example of why java web servers arent quite there yet I had to force reload the pages a few times each to get the whole content ;)

The XML source is a whole lot uglier, but in a decent XML editor it will look not dissimiler to the ad_page_contract style you suggest.

Also, holding the definition in a separate XML file means that you could easily add simple web-based editing.

For the record, I would be interested in this wf package to run the escalation processes of a network monitoring package I am writing, so I would be happy to be involved in testing or outsourcing a chunk of feature coding.

Posted by Dan Wickstrom on

Below is a sample form which uses comments throughout. The form is used to register a news feed soap service.

ad_form -name register-service -form {

    # primary key for news feed

    # fully qualified url of news instance on remote server
    {news_instance_url:text(text) {label "Remote News Instance URL (e.g."} {html {size 40}}}

    # soap service url on remote server
    {service_url:text(text) {label "Remote Web Service URL"} {html {size 40}}}

    # authentication token
    {token:text(text) {label "Registration Token"} {html {size 40}}}

# create option list for news instances on this server

set options [db_list_of_lists get_options {
        select '--' as url, null::integer as object_id, 1 as orderby
        select site_node__url(n.node_id) as url, n.object_id, 2 as orderby
          from apm_packages p, site_nodes n 
         where p.package_id = n.object_id     
           and p.package_key = 'news'
      order by orderby

# add widget for selecting news instance to be used as the destination 
# for the news feed

ad_form -extend -name register-service -form [list \
    [list package_id:text(select) [list options $options] {label {Select News Destination}}] \
                    ] -validate {

    # make sure the user select a news instance source                    
    {package_id {![string equal $package_id ""]}
     "A Valid News Instance Destination on this Server must be Selected"

    # make sure the news instance url is a fully qualified url
    {news_instance_url {[string match http://* $news_instance_url]}
     "The remote news instance URL must be a fully qualified URL that starts with http://"

    # make sure that the soap service url is fully qualified
    {service_url {[string match http://* $service_url]}
     "The remote Web Service URL must be a fully qualified URL that starts with http://"

} -new_data {

    # convert the news instance url to a fully qualified url
    db_1row get_dest "select 'http://[ad_host][ad_port]' || site_node__url(node_id) as dest_url from site_nodes where object_id = :package_id"

    if ![string equal [string index $news_instance_url end] "/"] {
        append news_instance_url "/"

    # get the service locator
    set nfs [nsjava::new]

    # get the news service client stub and invoke registration on remote server
    set url [nsjava::new { String} $service_url]
    set stub [$nfs {getNewsFeed} $url]

    set result f
    nsjava::try {

        # soap call to register the news feed
        set result [$stub {enableRemoteNewsFeed String String String String} $news_instance_url $dest_url $token [ns_conn peeraddr]]

    } catch {java.rmi.RemoteException e} {

        # if registration fails, we will retry later
        ns_log Notice "registration failed: [$e toString]"

    } finally {

        set person_id [ad_conn user_id]

        # save registration info.  If registration fails, we will retry later.
        db_dml set_feed_frominfo {

            insert into news_feed_from 
            (news_feed_from_id, package_id, service_url, news_instance_url, token, registered_p, person_id) 
            (:news_feed_id, :package_id, :service_url, :news_instance_url, :token, :result, :person_id)

    ad_returnredirect index

Posted by Dan Wickstrom on
My bad.  A while back, I modified my own version of ad_form to allow comments in the -form and -validate sections but I forgot to check it in.  I've just checked iin the changes on the main branch.
Posted by Don Baccus on
Cool, Dan, it's a pity it takes a sledge-hammer approach to get rid of them but it's really nice to be able to use comments in this way!
Posted by Roberto Mello on

By "main branch" you mean 4.6 or HEAD?



Posted by John Sequeira on
Lars and Dan,

I understand that it might be out of scope for this release,  but I would like to suggest that you look into the XML dialect for scalable vector graphics (SVG) as an output format for workflow renderings.  If graphviz-like libraries exist to that assist in the creation of SVG directed graphs (I'm not sure about this),  it would be very cool to have the option to publish either interactive/plugin-enabled versions of the workflow ,  with zoom, pan, expand/collapse etc. or a static jpg rendering with a server-side SVG->JPG conversion library (which does exists, AFAIK).

Also,  if you want an example of a workflow that could have benefited from hierarchy and did use parallel routing,  you can check out my incomplete peer-review module writeup:

13: svg followup (response to 12)
Posted by John Sequeira on
I posted before I googled.  I just saw that graphviz supports svg (I didn't when I last used it):

I guess that means there's not much point in replacing the graphviz dependencies with something else.

14: Re: svg followup (response to 13)
Posted by Andrei Popov on
yeah, but my reading is that graphviz can *produce* an SVG, not that it can *read* it.  thought your original idea was to define a wf in a way that can be (more or less) easily translated in to an SVG.
Posted by Lars Pind on
Please note that the workflow specification is changing rapidly these days, so if you haven't checked it lately, now may be a good time to do so.

In particular, the issues of service contract-based callbacks, assignments, and notifications have been designed.

Still to come is how it integrates with the form, what the user interface will look like, and internationalizing pretty-names.


Posted by Andrew Piskorski on
Has anybody looked at this wftk: Open-source workflow toolkit stuff? I just stumbled across it.
Posted by Lars Pind on
Yeah, I checked it out back when I did old acs-workflow. Back then, at least, I didn't find much of any use, but I'll take a look again.

Let me know if you find or set up a demo server.