Skip to content
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

Fixed the TaskExecutor to evaluate export.as against the task transformed output instead of context data #402

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading