From 61ace1a874498f8d37eb2ab79470517ab3b7a08c Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Fri, 13 Sep 2024 13:52:36 +0200 Subject: [PATCH 1/2] Replace deprecated github action --- .github/workflows/build-and-test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 26cc887..81bc6da 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -36,7 +36,7 @@ jobs: run: ./Build.ps1 -Build -Pack - name: Upload package artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: packages path: artifacts/Packages/ @@ -58,7 +58,7 @@ jobs: run: ./Build.ps1 -UnitTests - name: Upload test results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: test-results path: artifacts/Tests/ @@ -75,7 +75,7 @@ jobs: run: ./Build.ps1 -GenerateDocs - name: Upload documentation results - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: documentation path: artifacts/Documentation/ @@ -94,7 +94,7 @@ jobs: dotnet-version: ${{ env.dotnet_sdk_version }} - name: Download package artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: packages path: artifacts/Packages/ From 1f8a5b686547d8704ce06475b7de6aec6cdff126 Mon Sep 17 00:00:00 2001 From: Marcel Vielhaus Date: Fri, 29 Nov 2024 14:31:42 +0100 Subject: [PATCH 2/2] Add `UnknownActivityAborted` session The new type is a session-wrapper for activities that should be aborted, but for which the session is unknown for a cell. It can be created and uses a new session context. --- .../Activities/ActivityClassification.cs | 7 ++++- .../Cells/ActivityCompleted.cs | 3 --- src/Moryx.ControlSystem/Cells/Session.cs | 14 ++++++++++ .../Cells/UnknownActivityAborted.cs | 26 +++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 src/Moryx.ControlSystem/Cells/UnknownActivityAborted.cs diff --git a/src/Moryx.ControlSystem/Activities/ActivityClassification.cs b/src/Moryx.ControlSystem/Activities/ActivityClassification.cs index 7548c64..17f721d 100644 --- a/src/Moryx.ControlSystem/Activities/ActivityClassification.cs +++ b/src/Moryx.ControlSystem/Activities/ActivityClassification.cs @@ -15,6 +15,11 @@ namespace Moryx.ControlSystem.Activities [Flags] public enum ActivityClassification { + /// + /// Use in case the activity classification is unkown + /// + Unknown = 0x00, + /// /// Default classification is production /// @@ -33,6 +38,6 @@ public enum ActivityClassification /// /// Activity performs a preparation, for example for a activity /// - Preparation = 0x08 + Preparation = 0x08, } } diff --git a/src/Moryx.ControlSystem/Cells/ActivityCompleted.cs b/src/Moryx.ControlSystem/Cells/ActivityCompleted.cs index 5d315fe..4ad1466 100644 --- a/src/Moryx.ControlSystem/Cells/ActivityCompleted.cs +++ b/src/Moryx.ControlSystem/Cells/ActivityCompleted.cs @@ -10,9 +10,6 @@ namespace Moryx.ControlSystem.Cells /// public class ActivityCompleted : Session, ICompletableSession { - /// - /// Initialize a new resource request for a certain resource - /// internal ActivityCompleted(IActivity completed, Session currentSession) : base(currentSession) { diff --git a/src/Moryx.ControlSystem/Cells/Session.cs b/src/Moryx.ControlSystem/Cells/Session.cs index 19574b7..9301530 100644 --- a/src/Moryx.ControlSystem/Cells/Session.cs +++ b/src/Moryx.ControlSystem/Cells/Session.cs @@ -125,6 +125,20 @@ public static ReadyToWork StartSession(ActivityClassification classification, Re return CreateSession(classification, type, ProcessReference.InstanceIdentity(identity), constraints); } + + /// + /// Creates a new for the activity + /// with a new session context and marks the activity as failed. + /// + /// + public static UnknownActivityAborted WrapUnknownActivity(IActivity unknown) + { + unknown.Fail(); + var wrapper = StartSession(ActivityClassification.Unknown, ReadyToWorkType.Unset, unknown.Process.Id) + .CompleteSequence(null, false, new long[] { }); + return new UnknownActivityAborted(unknown, wrapper); + } + private static ReadyToWork CreateSession(ActivityClassification classification, ReadyToWorkType type, ProcessReference reference, IConstraint[] constraints) { if (constraints == null) diff --git a/src/Moryx.ControlSystem/Cells/UnknownActivityAborted.cs b/src/Moryx.ControlSystem/Cells/UnknownActivityAborted.cs new file mode 100644 index 0000000..33a79ef --- /dev/null +++ b/src/Moryx.ControlSystem/Cells/UnknownActivityAborted.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2024, Phoenix Contact GmbH & Co. KG +// Licensed under the Apache License, Version 2.0 + +using Moryx.AbstractionLayer; + +namespace Moryx.ControlSystem.Cells +{ + /// + /// Message send by the resource managment when it aborted an activity for an + /// unkown session. + /// + public class UnknownActivityAborted : ActivityCompleted + { + internal UnknownActivityAborted(IActivity aborted, Session wrapper) + : base(aborted, wrapper) + { + aborted.Fail(); + AbortedActivity = aborted; + } + + /// + /// Activity that was aborted + /// + public IActivity AbortedActivity { get; } + } +}