Skip to content
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

Orchestrator: Manage Cleaning Request State and Data #427

Closed
4 tasks done
nicoprow opened this issue Sep 1, 2023 · 9 comments
Closed
4 tasks done

Orchestrator: Manage Cleaning Request State and Data #427

nicoprow opened this issue Sep 1, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request golden record Issues relating to the Golden Record process

Comments

@nicoprow
Copy link
Contributor

nicoprow commented Sep 1, 2023

The BPDM Orchestrator should manage the life cycle of a cleaning request. By this it needs to implement a state machine, describing logic when the cleaning request moves from one state to another.

---
title: Cleaning Task Transition Logic
---
stateDiagram-v2
    
    state "Queued" as GenericCleaningQueued
    state "Reserved" as GenericCleaningReserved

    state "Queued" as BpnProcessingQueued
    state "Reserved" as BpnProcessingReserved

    state "Queued" as GoldenRecordUpdateQueued
    state "Reserved" as GoldenRecordUpdateReserved

    [*] --> Pending

    state Pending{
         
         [*] --> GenericCleaning: Mode - UpdateFromSharingMember

        state GenericCleaning{
            [*] --> GenericCleaningQueued
            GenericCleaningQueued --> GenericCleaningReserved
            GenericCleaningReserved --> [*]
        }

        GenericCleaning --> BpnProcessing

        state BpnProcessing{
            [*] --> BpnProcessingQueued
            BpnProcessingQueued --> BpnProcessingReserved
            BpnProcessingReserved --> [*]
        }

        BpnProcessing --> [*]

        [*] --> GoldenRecordUpdate: Mode - UpdateFromPool
        
        state GoldenRecordUpdate{
            [*] --> GoldenRecordUpdateQueued
            GoldenRecordUpdateQueued --> GoldenRecordUpdateReserved
            GoldenRecordUpdateReserved --> [*]
        }

        GoldenRecordUpdate --> [*]

    }

    Pending --> Success: if finished
    Pending --> Error: if disrupted by error

    Success --> [*]
    Error --> [*]

Loading
---
title: Cleaning Task Composition
---
classDiagram
    
   class CleaningTask{
        Task Identifier: String
        Generic Business Partner: Object
        Legal Entity: Object
        Site: Object
        Address: Object
   }

   class TaskState{
        Result State: ResultStateEnum
        CreatedAt: Timestamp
        ModifiedAt: Timestamp 
   }

   class ResultState{
        <<enum>>
        Pending
        Success
        Error
   }

   class StepState{
        CreatedAt: Timestamp
   }

   class CleaningStep{
        <<enum>>
        GenericCleaning
        BpnProcessing
        GoldenRecordUpdate
   }

   class ReservationState{
        <<enum>>
        Queued
        Reserved
   }

    StepState "1" --> "1" CleaningStep: CleaningStep
    StepState "1" --> "1" ReservationState: ReservationState

    TaskState "1" --> "*" StepState: StepHistory
    TaskState "1" --> "1" ResultState: ResultState

    CleaningTask "1" --> "1" TaskState: State

Loading

Note: The naming of the fields and classes are just proposals and can be decided by the implementor

Tasks

  • Create cleaning task class model
  • Create service logic to save business partner data and perform state transition
  • Create service logic to query cleaning tasks based on state
  • Connect service logic with Orchestrator endpoints

Dependencies
#426
#425
#388
#392
#377

@martinfkaeser
Copy link
Contributor

martinfkaeser commented Sep 12, 2023

Proposition:
When creating a new cleaning task the Gate sets the TaskMode, e.g. UpdateFromSharingMember or UpdateFromPool.
On the basis of the mode the Orchestrator determines the necessary steps, e.g.

  • UpdateFromSharingMember -> FullCleaning, PoolUpdate
  • UpdateFromPool -> LightCleaning (or EcoCleaning ;-) )

For each step the Orchestrator goes through the states Queued and Processing. After all steps have finished it goes to state Finished. After the task output has been retrieved the task is completely removed.

@nicoprow nicoprow added enhancement New feature or request golden record Issues relating to the Golden Record process Orchestrator labels Sep 13, 2023
@nicoprow nicoprow moved this to 🆕 New in BPDM Kanban Sep 14, 2023
@gerlitmcoding
Copy link
Contributor

Maybe you could call the "light cleaning" -> GrSync

@nicoprow
Copy link
Contributor Author

Proposition: When creating a new cleaning task the Gate sets the TaskMode, e.g. UpdateFromSharingMember or UpdateFromPool. On the basis of the mode the Orchestrator determines the necessary steps, e.g.

* `UpdateFromSharingMember` -> `FullCleaning`, `PoolUpdate`

* `UpdateFromPool` -> `LightCleaning` (or EcoCleaning ;-) )

For each step the Orchestrator goes through the states Queued and Processing. After all steps have finished it goes to state Finished. After the task output has been retrieved the task is completely removed.

I'm overtaking the idea for renaming the modes:

UpdateFromSharingMember and UpdateFromPool

The cleaning step names I'm undecided about

@nicoprow
Copy link
Contributor Author

How about
GenericCleaning -> 'CleanAndSync'
BpnProcessing -> 'PoolSync' (or GoldenRecordSync as proposed by @gerlitmcoding )
GoldenRecordUpdate -> 'Clean'

I think this fleshes out more the distinction between the cleaning steps, as in the 'CleanAndSync' record needs to be cleaned and also the record data may change the resulting golden record. In 'Clean' the record us just cleaned and no change to the golden record is done.

@gerlitmcoding
Copy link
Contributor

gerlitmcoding commented Sep 15, 2023

@nicoprow In which usecase/scenario would you use/need the only clean state?

@mknoopvw
Copy link

mknoopvw commented Sep 15, 2023

@gerlitmcoding I have no idea why you are asking me? Nor can I answer this question.

@gerlitmcoding
Copy link
Contributor

@gerlitmcoding I have no idea why you are asking me? Nor can I answer this question.

Sorry, that was a wrong autocompletion 🙈

@nicoprow
Copy link
Contributor Author

nicoprow commented Sep 15, 2023

@nicoprow In which usecase/scenario would you use/need the only clean state?

@gerlitmcoding
This the golden record process step for when there was an update on the Pool and the respective records in the Gate need to be adapted to the newest golden record.

Mode - UpdateFromPool

@martinfkaeser martinfkaeser moved this from 🆕 New to 📋 Backlog in BPDM Kanban Sep 19, 2023
@nicoprow nicoprow moved this from 📋 Backlog to 🔖 Ready in BPDM Kanban Sep 28, 2023
@martinfkaeser martinfkaeser self-assigned this Oct 4, 2023
@martinfkaeser martinfkaeser moved this from 🔖 Ready to 🏗 In progress in BPDM Kanban Oct 4, 2023
@martinfkaeser
Copy link
Contributor

Duration implementation some questions came up:

  1. For how long do we keep the business partners stored in the orchestrator?
    There is no resolve call from the Task Client that could be used to delete them.
    My idea would be that we define a taskStorageTimeout that starts ticking when the Task Client posts a BP.
    We could return this timeout in the response, similar to taskReservationTimeout.
    This is maybe not needed yet in the first version, but it makes sense to specify it.

  2. I'm thinking about extending the StepState.
    If an error occured during task processing or all went through okay, the specified states Queued and Reserved seem confusing and inadequate when retrieving task states.
    For clarification we might add states Success and Error.

  3. Do we need a StepHistory inside the Orchestrator although only one step and stepState is returned by the API?
    It might make sense for a later version of the API for keeping track of the time spent in the steps/states.
    In this case the suggested states Success and Error make even more sense: It might be interesting how long processing took (time between Reserved and Success).
    But I would suggest keeping the internal state aligned with the API and not managing a StepHistory for now.

@nicoprow What's your opinion?

@martinfkaeser martinfkaeser moved this from 🏗 In progress to 👀 In review in BPDM Kanban Oct 13, 2023
@nicoprow nicoprow moved this from 👀 In review to ✅ Done in BPDM Kanban Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request golden record Issues relating to the Golden Record process
Projects
Archived in project
Development

No branches or pull requests

4 participants