-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] WorkflowStep Execution Improvements #210
Comments
Can you clarify what the And I think this method returns a future, right? |
Previous Node inputs are already given to the process node here. This is provided by the user via the template and it denotes what inputs are coming from previous nodes in the graph. We can then just pass this in when executing a
Yes that's right, I have corrected the issue description |
Interface looks good. To avoid doing the validation again for previousNodeInputs, for immediate solution we can have the map of previousNodeInputs being passed in the interface and fetch the value and key associated from it. |
|
Map is required to store the |
Will implement a util method as part of this issue:
Originally posted by @owaiskazi19 in #211 (comment) |
@owaiskazi19 I've drafted the following util method to address this comment. WDYT? /**
* Processes inputs from either a template or output from a previous node.
* @param requiredInputKeys
* @param currentNodeInputs Input params and content for this node, from workflow parsing
* @param outputs WorkflowData content of previous steps.
* @param previousNodeInputs Input params for this node that come from previous steps
* @return A map containing the requiredInputKeys with their corresponding values,
* and optionalInputKeys with their corresponding values if present.
* Throws a {@link FlowFrameworkException} if a required key is not present.
*/
public static Map<String, Object> getInputsFromPreviousSteps(
Set<String> requiredInputKeys,
Set<String> optionalInputKeys,
WorkflowData currentNodeInputs,
Map<String, WorkflowData> outputs,
Map<String, String> previousNodeInputs
) {
// Evaluates steps in order for each key
// On match, remove from set and put to output map with value
//
// Priority 1: specifically named prior step inputs
// ... parse the previousNodeInputs map and fill in the specified keys
//
// Priority 2: inputs specified in template
// ... fetch from currentNodeInputs
//
// Priority 3: other inputs explicit match
// ... iterate outputs.entryset
// ... look for key by itself
//
// Priority 4: other inputs substitution
// ... check if the key is of the form ${{foo.bar}}
// ... look for key in outputs.get(foo).get(bar)
//
// After iterating is complete, throw exception if requiredInputKeys is not empty
return <the generated map>;
} |
@dbwiddis if we go with the route of substitution
It will fail our validation process here. That's why we thought of keeping
and fetch the values from there. |
As I implemented it I realized the comment was wrong. I was referring to the value, not the key. The validation you mention will match the "priority 1" choice and never get to that step unless where you have "tools" is a substitution. See PR #234. |
Is your feature request related to a problem?
Currently,
WorkflowStep
s are each given aList<WorkflowData>
which is populated by its own user inputs, and outputs from predecessor nodes. From this data, aWorkflowStep
then retrieves values from this list, based on a unique field name for the expected inputs.There is a case in which there could be multiple entries of data with the same field name, which runs the risk of having a
WorkflowStep
consume the incorrect data.What solution would you like?
It is necessary to modify the
WorkflowStep::execute
method to provide additional data, forgoing aList<WorkflowData>
and instead providing aMap<String workflowStepID, WorkflowData output>
which would allow us to provide multiple entries of the same type of data, uniquely identified by the workflow step ID that produced the output.Additionally, given a
Map<String workflowStepID, String fieldName>
aWorkflowStep
can then refer to this mapping to ascertain which keys to look for in the output map and the specific field to search for within that entriesWorkflowData
. The full definition is as follows :The text was updated successfully, but these errors were encountered: