-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from microsoft/dev
merge dev into main
- Loading branch information
Showing
37 changed files
with
314 additions
and
19,277 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
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
57 changes: 57 additions & 0 deletions
57
src/TeamCloud.Orchestrator/Command/Activities/CommandStatusActivity.cs
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,57 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.WebJobs.Extensions.DurableTask; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Extensions.Logging; | ||
using TeamCloud.Serialization; | ||
|
||
namespace TeamCloud.Orchestrator.Command.Activities; | ||
|
||
public sealed class CommandStatusActivity | ||
{ | ||
[FunctionName(nameof(CommandStatusActivity))] | ||
public Task<DurableOrchestrationStatus> RunActivity( | ||
[ActivityTrigger] IDurableActivityContext activityContext, | ||
[DurableClient] IDurableClient orchestrationClient, | ||
ILogger log) | ||
{ | ||
if (activityContext is null) | ||
throw new ArgumentNullException(nameof(activityContext)); | ||
|
||
if (orchestrationClient is null) | ||
throw new ArgumentNullException(nameof(orchestrationClient)); | ||
|
||
if (log is null) | ||
throw new ArgumentNullException(nameof(log)); | ||
|
||
try | ||
{ | ||
var input = activityContext.GetInput<Input>(); | ||
|
||
return orchestrationClient | ||
.GetStatusAsync(input.CommandId.ToString(), showHistory: input.ShowHistory, showHistoryOutput: input.ShowHistoryOutput, showInput: input.ShowInput); | ||
} | ||
catch (Exception exc) | ||
{ | ||
log.LogError(exc, $"Failed to enqeueu command: {exc.Message}"); | ||
|
||
throw exc.AsSerializable(); | ||
} | ||
} | ||
|
||
internal struct Input | ||
{ | ||
public Guid CommandId { get; set; } | ||
|
||
public bool ShowHistory { get; set; } | ||
|
||
public bool ShowHistoryOutput { get; set; } | ||
|
||
public bool ShowInput { get; set; } | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/TeamCloud.Orchestrator/Command/Activities/CommandTerminateActivity.cs
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,54 @@ | ||
/** | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Azure.WebJobs.Extensions.DurableTask; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Threading.Tasks; | ||
using TeamCloud.Serialization; | ||
|
||
namespace TeamCloud.Orchestrator.Command.Activities; | ||
|
||
public sealed class CommandTerminateActivity | ||
{ | ||
[FunctionName(nameof(CommandTerminateActivity))] | ||
public async Task RunActivity( | ||
[ActivityTrigger] IDurableActivityContext activityContext, | ||
[DurableClient] IDurableClient orchestrationClient, | ||
ILogger log) | ||
{ | ||
if (activityContext is null) | ||
throw new ArgumentNullException(nameof(activityContext)); | ||
|
||
if (orchestrationClient is null) | ||
throw new ArgumentNullException(nameof(orchestrationClient)); | ||
|
||
if (log is null) | ||
throw new ArgumentNullException(nameof(log)); | ||
|
||
try | ||
{ | ||
var input = activityContext.GetInput<Input>(); | ||
|
||
await orchestrationClient | ||
.TerminateAsync(input.CommandId.ToString(), input.Reason ?? string.Empty) | ||
.ConfigureAwait(false); | ||
} | ||
catch (Exception exc) | ||
{ | ||
log.LogError(exc, $"Failed to enqeueu command: {exc.Message}"); | ||
|
||
throw exc.AsSerializable(); | ||
} | ||
} | ||
|
||
internal struct Input | ||
{ | ||
public Guid CommandId { get; set; } | ||
|
||
public string Reason { get; set; } | ||
} | ||
} |
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
Oops, something went wrong.