-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Get-TaskResult CmdLet for DF (#786)
Co-authored-by: Greg Roll <[email protected]>
- Loading branch information
1 parent
6dd32c3
commit d184e72
Showing
13 changed files
with
263 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
* Bug fix: Activity Functions can now use output bindings (https://github.com/Azure/azure-functions-powershell-worker/issues/646) | ||
* Bug fix: [Context.InstanceId can now be accessed](https://github.com/Azure/azure-functions-powershell-worker/issues/727) | ||
* Bug fix: [Data in External Events is now read and returned to orchestrator](https://github.com/Azure/azure-functions-powershell-worker/issues/68) | ||
* New feature (external contribution): [Get-TaskResult can now be used to obtain the result of an already-completed Durable Functions Task](https://github.com/Azure/azure-functions-powershell-worker/pull/786) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member 'member' | ||
|
||
namespace Microsoft.Azure.Functions.PowerShellWorker.Durable.Commands | ||
{ | ||
using System.Collections; | ||
using System.Management.Automation; | ||
using Microsoft.Azure.Functions.PowerShellWorker.Durable.Tasks; | ||
|
||
[Cmdlet("Get", "DurableTaskResult")] | ||
public class GetDurableTaskResultCommand : PSCmdlet | ||
{ | ||
[Parameter(Mandatory = true)] | ||
[ValidateNotNull] | ||
public DurableTask[] Task { get; set; } | ||
|
||
private readonly DurableTaskHandler _durableTaskHandler = new DurableTaskHandler(); | ||
|
||
protected override void EndProcessing() | ||
{ | ||
var privateData = (Hashtable)MyInvocation.MyCommand.Module.PrivateData; | ||
var context = (OrchestrationContext)privateData[SetFunctionInvocationContextCommand.ContextKey]; | ||
|
||
_durableTaskHandler.GetTaskResult(Task, context, WriteObject); | ||
} | ||
|
||
protected override void StopProcessing() | ||
{ | ||
_durableTaskHandler.Stop(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/E2E/TestFunctionApp/DurableOrchestratorGetTaskResult/function.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"name": "Context", | ||
"type": "orchestrationTrigger", | ||
"direction": "in" | ||
} | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
test/E2E/TestFunctionApp/DurableOrchestratorGetTaskResult/run.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
param($Context) | ||
|
||
$output = @() | ||
|
||
$task = Invoke-DurableActivity -FunctionName 'DurableActivity' -Input "world" -NoWait | ||
$firstTask = Wait-DurableTask -Task @($task) -Any | ||
$output += Get-DurableTaskResult -Task @($firstTask) | ||
$output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters