dataflo.ws icon indicating copy to clipboard operation
dataflo.ws copied to clipboard

Flow Reuse !?

Open behrad opened this issue 12 years ago • 4 comments

How can I define & reuse a workflow, in etc/project?

behrad avatar May 01 '13 11:05 behrad

You can use file includes via the <> notation. Included files must be located in the etc directory of your project. You can include anywhere in the JSON.

    "workflows": [{
        "path": "read.json",
        "tasks": "<entity/read>"
    }]

katspaugh avatar May 05 '13 10:05 katspaugh

with

"workflows": [{
    "path": "read.json",
    "tasks": "<flows/main>"
}]

I got

Error: { [Error: ENOENT, open '/data/workspace/opxi2flowy/etc/flows/main']

it seems it uses tasks param to resolve file name!! Can you provide me please with a working example with also the read.json file contents !?

behrad avatar May 06 '13 08:05 behrad

Here's an example: https://github.com/apla/dataflo.ws/blob/master/example/yql/etc/project#L27 The included file: https://github.com/apla/dataflo.ws/blob/master/example/yql/etc/entity/test

katspaugh avatar May 07 '13 13:05 katspaugh

@katspaugh That works as an include mechanism only! I got it now! but I wish I could mix included tasks with inline ones. This means to be able to write extended flows with reusable, mini tasks. I mean something like this:

                          {
                                  "path":"test",
                                  "tasks": [{
                                      "include": "<entity/read>",
                                 },{
                                      "$function": "console.print",
                                      "$args": [ "Fetched Entity", "{$entity}" ]
                                 },{
                                      "include": "<entity/play>"
                                 }]
                          }

behrad avatar May 08 '13 06:05 behrad