CompuMaster.TaskManagement 2024.11.12.102

dotnet add package CompuMaster.TaskManagement --version 2024.11.12.102                
NuGet\Install-Package CompuMaster.TaskManagement -Version 2024.11.12.102                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CompuMaster.TaskManagement" Version="2024.11.12.102" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CompuMaster.TaskManagement --version 2024.11.12.102                
#r "nuget: CompuMaster.TaskManagement, 2024.11.12.102"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CompuMaster.TaskManagement as a Cake Addin
#addin nuget:?package=CompuMaster.TaskManagement&version=2024.11.12.102

// Install CompuMaster.TaskManagement as a Cake Tool
#tool nuget:?package=CompuMaster.TaskManagement&version=2024.11.12.102                

CompuMaster.TaskManagement

Github Release NuGet CompuMaster.TaskManagement

Purpose

Run (long-running) Tasks and optionally visualize them

  • and control what happens on failure or Task cancellation by user
    • before the point of no-turn-back (e.g. roll-back-actions)
    • after the point of no-turn-back (e.g. some fix-actions)
  • display estimated remaining duration of tasks to complete
  • allow cancellation
  • show a nice Windows-Forms UI window of the Tasks and control start/stop

Model

TaskBundles, TaskItems, TaskSteps

  • There are TaskBundles which can be started independently in parallel, e.g. cooking coffee or cooking tea
  • Each TaskBundle contains 1 or more TaskItems, e.g. fill up all containers, prepare machine, run the machine, cleanup
  • Each TaskItem contains 1 or more TaskSteps, e.g. fill up water, fill up milk
  • A Task step is an atomic step like running a command on a database

Successful or failing task execution

  • Task steps might complete successfully or they might run into exceptions and fail
    • ProgressingTaskFailFastStep: A task step which will fail fast (throw exception) if the step fails, e.g. if the water container is missing
    • ProgressingTaskStep: A task step with configurable fail action
      • Either log the exception, mark this step as failed (will lead to continue with next step in ProgressingTaskItem)
      • or log the exception, mark this step as failed, throw the exception (will lead to fail immediately, further task steps in list won't execute any more)
  • Task items
    • contain 3 different kinds of lists for steps
      • FirstStepsWhichCanBeRolledBack
      • SecondStepsWithoutRollbackOption
      • RollbackSteps
    • will run
      • only if previous task items completed without critical failures
      • or always
  • Task bundles
    • might run
      • successfull,
      • with warnings (e.g. a step failed, but rollback was successful)
      • or fail (e.g. step failed and rollback failed, too)
    • can be started
    • can be cancelled by user

Samples

Creating a task bundle with Rollback feature

C#
public static ProgressingTaskBundle DummyTaskBundleFailingWithRollbackFailingWithThrownException()
{
    var result = new ProgressingTaskBundle("Dummy Task Bundle with exception in 1st steps and failing again in rollback stopping rollback totally");

    var task1 = result.CreateAndAddNewTask("Dummy Task 1");
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.1", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.2", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.3", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.4", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.5", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.6 FAILING", () => throw new Exception("Failure-Test in Dummy"), TimeSpan.FromSeconds(1)));
    task1.FirstStepsWhichCanBeRolledBack.Add(new ProgressingTaskFailFastStep("Dummy Step 1.7", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1)));

    task1.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Step 2.1", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task1.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Step 2.2", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task1.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Step 2.3", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task1.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Step 2.4", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));

    task1.RollbackSteps.Add(new ProgressingTaskStep("Dummy Rollback Step 1", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task1.RollbackSteps.Add(new ProgressingTaskStep("Dummy Rollback Step 2", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task1.RollbackSteps.Add(new ProgressingTaskStep("Dummy Rollback Step 3", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.ThrowException));
    task1.RollbackSteps.Add(new ProgressingTaskStep("Dummy Rollback Step 4", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.ThrowException));

    var task2 = result.CreateAndAddNewTask("Dummy Task 2");
    task2.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Task 2 Step 1", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));
    task2.SecondStepsWithoutRollbackOption.Add(new ProgressingTaskStep("Dummy Task 2 Step 2", () => System.Threading.Thread.Sleep(1000), TimeSpan.FromSeconds(1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue));

    return result;
}
VB.NET
    Public Shared Function DummyTaskBundleFailingWithRollbackFailingWithThrownException() As ProgressingTaskBundle
        Dim Result As New ProgressingTaskBundle("Dummy Task Bundle with exception in 1st steps and failig again in rollback stopping rollback totally")
        Dim Task1 As ProgressingTaskItem = Result.CreateAndAddNewTask("Dummy Task 1")
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.1", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.2", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.3", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.4", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.5", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.6 FAILING", Sub() Throw New Exception("Failure-Test in Dummy"), New TimeSpan(0, 0, 1)))
        Task1.FirstStepsWhichCanBeRolledBack.Add(New ProgressingTaskFailFastStep("Dummy Step 1.7", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1)))
        Task1.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Step 2.1", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Step 2.2", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Step 2.3", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Step 2.4", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.RollbackSteps.Add(New ProgressingTaskStep("Dummy Rollback Step 1", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.RollbackSteps.Add(New ProgressingTaskStep("Dummy Rollback Step 2", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task1.RollbackSteps.Add(New ProgressingTaskStep("Dummy Rollback Step 3", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.ThrowException))
        Task1.RollbackSteps.Add(New ProgressingTaskStep("Dummy Rollback Step 4", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.ThrowException))
        Dim Task2 As ProgressingTaskItem = Result.CreateAndAddNewTask("Dummy Task 2")
        Task2.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Task 2 Step 1", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Task2.SecondStepsWithoutRollbackOption.Add(New ProgressingTaskStep("Dummy Task 2 Step 2", Sub() Threading.Thread.Sleep(1000), New TimeSpan(0, 0, 1), ProgressingTaskStep.ProgressingTaskStepFailAction.LogExceptionAndContinue))
        Return Result
    End Function

Dummy Task Bundles

Create form for multiple task bundles

C#
private void TestVonLongRunTaskBundlesButton_Click(object sender, EventArgs e)
{
    MultiTaskProgessForm f;
    f = new MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollback);
    f.Show();
    f = new MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollbackFailingWithThrownException);
    f.Show();
    f = new MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollbackFailingWithLoggedException);
    f.Show();
    f = new MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingInCriticalStepsWithoutRollbackPossibility);
    f.Show();
    f = new MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleSuccessful);
    f.Show();
}
VB.NET
Private Sub TestVonLongRunTaskBundlesButton_Click(sender As Object, e As EventArgs) Handles TestVonLongRunTaskBundlesButton.Click
    Dim f As MultiTaskProgessForm
    f = New MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollback)
    f.Show()
    f = New MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollbackFailingWithThrownException)
    f.Show()
    f = New MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingWithRollbackFailingWithLoggedException)
    f.Show()
    f = New MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleFailingInCriticalStepsWithoutRollbackPossibility)
    f.Show()
    f = New MultiTaskProgessForm(DummyTaskBundles.DummyTaskBundleSuccessful)
    f.Show()
End Sub

Example UI with Windows Forms

Running Tasks

Screenshot of samples for running tasks

Tasks completed

Screenshot of samples for finished tasks

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CompuMaster.TaskManagement:

Package Downloads
CompuMaster.TaskManagement.UI.WinForms

.NET UI library for Windows Forms with common methods for managing of (long-running) tasks/jobs with rollback/rollforward feature

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2024.11.12.102 91 11/12/2024
2024.11.12.101 74 11/12/2024
2024.11.12.100 77 11/12/2024
2024.11.8.100 76 11/8/2024
2024.11.7.100 73 11/8/2024