Skip to content

Commit

Permalink
ContinueAsNew fixes and test updates (Azure#258)
Browse files Browse the repository at this point in the history
* Updated package versions
* Fixed issues with fast ContinueAsNew
* Updated test framework dependencies
* Changed fix for task orchestration lifetime to something more correct.
  • Loading branch information
cgillum authored Mar 4, 2019
1 parent de90dd8 commit 2f9febd
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.1" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.11" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.11" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Newtonsoft.Json" version="7.0.1" />
<PackageReference Include="WindowsAzure.Storage" version="7.2.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<FileVersion>1.4.2</FileVersion>
<FileVersion>1.5.0</FileVersion>
<AssemblyVersion>$(FileVersion)</AssemblyVersion>
<Version>$(FileVersion)</Version>
<IncludeSymbols>true</IncludeSymbols>
Expand Down
28 changes: 22 additions & 6 deletions src/DurableTask.Core/TaskOrchestrationDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
ExecutionStartedEvent continueAsNewExecutionStarted = null;
TaskMessage continuedAsNewMessage = null;
IList<HistoryEvent> carryOverEvents = null;
string carryOverStatus = null;

OrchestrationRuntimeState runtimeState = workItem.OrchestrationRuntimeState;

Expand Down Expand Up @@ -346,7 +347,7 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
}

// finish up processing of the work item
if (!continuedAsNew)
if (!continuedAsNew && runtimeState.Events.Last().EventType != EventType.OrchestratorCompleted)
{
runtimeState.AddEvent(new OrchestratorCompletedEvent(-1));
}
Expand All @@ -361,7 +362,6 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
}
else
{

if (continuedAsNew)
{
TraceHelper.TraceSession(
Expand All @@ -373,6 +373,8 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
runtimeState = new OrchestrationRuntimeState();
runtimeState.AddEvent(new OrchestratorStartedEvent(-1));
runtimeState.AddEvent(continueAsNewExecutionStarted);
runtimeState.Status = workItem.OrchestrationRuntimeState.Status ?? carryOverStatus;
carryOverStatus = workItem.OrchestrationRuntimeState.Status;

if (carryOverEvents != null)
{
Expand All @@ -385,20 +387,34 @@ protected async Task<bool> OnProcessWorkItemAsync(TaskOrchestrationWorkItem work
runtimeState.AddEvent(new OrchestratorCompletedEvent(-1));
workItem.OrchestrationRuntimeState = runtimeState;

TaskOrchestration orchestration = this.objectManager.GetObject(runtimeState.Name, continueAsNewExecutionStarted.Version);
TaskOrchestration newOrchestration = this.objectManager.GetObject(
runtimeState.Name,
continueAsNewExecutionStarted.Version);

workItem.Cursor = new OrchestrationExecutionCursor(
runtimeState,
newOrchestration,
new TaskOrchestrationExecutor(
runtimeState,
newOrchestration,
orchestrationService.EventBehaviourForContinueAsNew),
latestDecisions: null);

workItem.Cursor = new OrchestrationExecutionCursor(runtimeState, orchestration, new TaskOrchestrationExecutor(runtimeState, workItem.Cursor.TaskOrchestration, orchestrationService.EventBehaviourForContinueAsNew), null);
await orchestrationService.RenewTaskOrchestrationWorkItemLockAsync(workItem);
if (workItem.LockedUntilUtc < DateTime.UtcNow.AddMinutes(1))
{
await orchestrationService.RenewTaskOrchestrationWorkItemLockAsync(workItem);
}
}

instanceState = Utils.BuildOrchestrationState(runtimeState);
}
} while (continuedAsNew);

}

workItem.OrchestrationRuntimeState = originalOrchestrationRuntimeState;

runtimeState.Status = runtimeState.Status ?? carryOverStatus;

await this.orchestrationService.CompleteTaskOrchestrationWorkItemAsync(
workItem,
runtimeState,
Expand Down
6 changes: 3 additions & 3 deletions test/DurableTask.Core.Tests/DurableTask.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

<ItemGroup>
<PackageReference Include="EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer" Version="2.0.1406.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.11" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Newtonsoft.Json" version="7.0.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.11" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.11" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<PackageReference Include="Microsoft.Data.Edm" version="5.6.4" />
<PackageReference Include="Microsoft.Data.OData" version="5.6.4" />
<PackageReference Include="Microsoft.Data.Services.Client" version="5.6.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.Tpl.Dataflow" version="4.5.24" />
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.11" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.11" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="Newtonsoft.Json" version="7.0.1" />
<PackageReference Include="System.Spatial" version="5.6.4" />
<PackageReference Include="WindowsAzure.ServiceBus" version="4.1.3" />
Expand Down
8 changes: 4 additions & 4 deletions tools/DurableTask.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@
<!-- Nuget Package Settings -->
<PropertyGroup>
<PackageOutputPath>..\..\build_output\packages</PackageOutputPath>
<AssemblyVersion>2.0.11</AssemblyVersion>
<FileVersion>2.0.11</FileVersion>
<Version>2.0.11</Version>
<AssemblyVersion>2.1.0</AssemblyVersion>
<FileVersion>2.1.0</FileVersion>
<Version>2.1.0</Version>
<Company>Microsoft</Company>
<Authors>Microsoft</Authors>
<Product>Durable Task Framework</Product>
<Description>This package provides a C# based durable task framework for writing long running applications.</Description>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageProjectUrl>https://github.com/Azure/durabletask/</PackageProjectUrl>
<RepositoryUrl>https://github.com/Azure/durabletask/</RepositoryUrl>
Expand Down

0 comments on commit 2f9febd

Please sign in to comment.