-
Notifications
You must be signed in to change notification settings - Fork 17
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
Event driven script orchestrator #1058
Conversation
# Conflicts: # source/Octopus.Tentacle.Client/Scripts/KubernetesScriptServiceV1AlphaOrchestrator.cs # source/Octopus.Tentacle.Client/Scripts/ScriptOrchestratorFactory.cs # source/Octopus.Tentacle.Client/TentacleClient.cs
|
||
namespace Octopus.Tentacle.Client.EventDriven | ||
{ | ||
public class CommandContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider documenting what this class is for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done
{ | ||
public interface IScriptExecutor | ||
{ | ||
Task<ScriptOperationExecutionResult> StartScript(ExecuteScriptCommand command, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to document that the resulting CommandContext should be used for the next call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
StartScriptIsBeingReAttempted startScriptIsBeingReAttempted, | ||
CancellationToken scriptExecutionCancellationToken); | ||
|
||
Task<ScriptOperationExecutionResult> GetStatus(CommandContext commandContext, CancellationToken scriptExecutionCancellationToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think I actually preferred the tuple because the responses where not something that are really coupled AND I think it improved readability. ie it was clear each method was returning a CommandContext
which might be enough to hint to the user to use that CommandContext
for the next call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think I actually preferred the tuple because the responses where not something that are really coupled
🤔 I feel that the fact we return both implies that they are related.
I think it improved readability. ie it was clear each method was returning a CommandContext which might be enough to hint to the user to use that CommandContext for the next call.
🤔 I would have thought the property named ContextForNextCommand would be good enough. Plus, adding the documentation from the previous comment should be more than enough.
I personally don't like tuples at all, and feel this is much easier to understand. For now, let's leave it the way it is, and if we find it unhelpful we can address it then.
@@ -1,6 +1,7 @@ | |||
namespace Octopus.Tentacle.Client.Scripts | |||
{ | |||
record ScriptServiceVersion(string Value) | |||
// TODO should not be public. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we will address this in a future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be addressed as part of the work to use a serialized version of command context.
But yes, we shouldn't be leaving these TODOs.
|
||
namespace Octopus.Tentacle.Client.Scripts | ||
{ | ||
public class UnsafeStartAttemptException : Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is used we should document what it is about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -183,6 +183,7 @@ | |||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean> | |||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean> | |||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean> | |||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just dotnet things
[sc-101635]
Background
Currently we only allow calling into tentacle client to run a script via the TentacleClient.ExecuteScript method. Although extremely simple it is not re-entrant. When we talk about re-entrancy we are considering the case the client gets turned off and on and wants to continue on. The deficiencies are:
Results
This PR was a continuation of the spike started here
In summary the changes are:
ScriptExecutor