specification icon indicating copy to clipboard operation
specification copied to clipboard

Define output of an async task (started with `await: false`)

Open matthias-pichler opened this issue 1 year ago • 3 comments

What would you like to be added:

Something I missed in the PR #995 that introduced the await property is to define what the (raw) output of a task with await: false is.

We should document the output of a run task in general. Because what is the output of a run.container task?

Why is this needed:

Dicjment the output of an async task

matthias-pichler avatar Aug 30 '24 16:08 matthias-pichler

As far as I understand it, an async task should output its transformed input. IMHO, runtimes should ignore output transformations and export, as async task should not be able to output.

As for "standard" run task output, it's a discussion we had in the past with @ricardozanini and @JBBianchi. If I remember well, it should be the task's stdout, but we should probably provide a flag that indicates whether or not to deserialize it, in case it's JSON or YAML encoded. We should probably open another issue to address that specific concern, which might also be related to #998

cdavernas avatar Aug 30 '24 16:08 cdavernas

As for "standard" run task output, it's a discussion we had in the past with @ricardozanini and @JBBianchi. If I remember well, it should be the task's stdout, but we should probably provide a flag that indicates whether or not to deserialize it, in case it's JSON or YAML encoded. We should probably open another issue to address that specific concern, which might also be related to https://github.com/serverlessworkflow/specification/issues/998

I also thought about returning stdout, maybe it might even be worth it to return an object

{
  "stdout": "...",
  "stderr":  "..."
}

since some tools print a lot to stderr as well and it might be needed to detect errors. But in other cases some containers might be very noise and so authors might want to discard the output. Maybe the way to go is an output property similar to call: http?

document: {}
do:
  - runContainer:
      run:
        container:
          image: alpine:latest
          output: "stdout" # "stdout" | "stderr" | "all" | "none"

I am unsure if we should handle JSON/YAML deserialization since jq offers @json @html, ... see jq manual

Do we have to introduce the same thing for run.shell?

matthias-pichler avatar Sep 03 '24 19:09 matthias-pichler

@matthias-pichler Great idea! And yes, I would extend your proposal to all processes, not just shell!

cdavernas avatar Sep 03 '24 20:09 cdavernas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 22 '24 00:11 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 07 '25 00:01 github-actions[bot]