Skip to content

Commit

Permalink
fix(Runner): Fixed the TaskExecutor to evaluate export.as against t…
Browse files Browse the repository at this point in the history
…he task transformed output instead of context data

Signed-off-by: Charles d'Avernas <[email protected]>
  • Loading branch information
cdavernas committed Sep 11, 2024
1 parent 3dd559e commit c4e3600
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runner/Synapse.Runner/Services/TaskExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,15 @@ public virtual async Task SetResultAsync(object? result, string? then = FlowDire
else if (this.Task.Definition.Output?.As != null) output = await this.Task.Workflow.Expressions.EvaluateAsync<object>(this.Task.Definition.Output.As, output ?? new(), arguments, cancellationToken).ConfigureAwait(false);
if (this.Task.Definition.Export?.As is string toExpression)
{
var context = (await this.Task.Workflow.Expressions.EvaluateAsync<IDictionary<string, object>>(toExpression, this.Task.ContextData, arguments, cancellationToken).ConfigureAwait(false))!;
var context = (await this.Task.Workflow.Expressions.EvaluateAsync<IDictionary<string, object>>(toExpression, output ?? new(), arguments, cancellationToken).ConfigureAwait(false))!;
await this.Task.SetContextDataAsync(context, cancellationToken).ConfigureAwait(false);
}
else if (this.Task.Definition.Export?.As != null)
{
var context = (await this.Task.Workflow.Expressions.EvaluateAsync<IDictionary<string, object>>(this.Task.Definition.Export.As, this.Task.ContextData, arguments, cancellationToken).ConfigureAwait(false))!;
var context = (await this.Task.Workflow.Expressions.EvaluateAsync<IDictionary<string, object>>(this.Task.Definition.Export.As, output ?? new(), arguments, cancellationToken).ConfigureAwait(false))!;
await this.Task.SetContextDataAsync(context, cancellationToken).ConfigureAwait(false);
}
await this.AfterExecuteAsync(cancellationToken).ConfigureAwait(false); //todo: act upon last directive
await this.AfterExecuteAsync(cancellationToken).ConfigureAwait(false);
await this.DoSetResultAsync(output, then, cancellationToken).ConfigureAwait(false);
await this.Task.SetResultAsync(output, then, cancellationToken).ConfigureAwait(false);
this.Subject.OnNext(new TaskLifeCycleEvent(TaskLifeCycleEventType.Completed));
Expand Down

0 comments on commit c4e3600

Please sign in to comment.