@startuml sync-job
!theme mars

title Sync Job Flow

participant User
participant Server
entity Job
participant "Execution\nPlatform"
participant Storage

User -> Server: Submit sync Job
activate Server

Server -> Server: Validate user request against the\nregistered process configuration

Server -> Job: Create a new Job with Job ID
activate Job
Job -> "Execution\nPlatform": Register Job
activate "Execution\nPlatform"



"Execution\nPlatform" -> Job: Notify Job running
... ...
"Execution\nPlatform" -> Job: Notify Job finished
deactivate "Execution\nPlatform"
note over Job: Job close routine starts

Job -> "Execution\nPlatform": Fetch Container logs
Job -> Storage: Write Container logs
note over Job, "Execution\nPlatform": Job is removed from Active Jobs store, results available
Job --> Server: Job Finished

Server -> Storage: Fetch results
Server --> User: Respond with results
deactivate Server

Job -> Storage: Write Metadata
Job -> Storage: Write logs (Container & Server)
deactivate Job

@enduml