@startuml title Execute sequence (*) --> "Get sequence from shs" --> if "Sequence status is OBSERVABLE" --> [Yes] "Compute countdown to execution (in jd)" --> "Advance execution date if possible" --> if "Countdown is greater than MAX_WAIT" --> [Yes] "Start scheduling" --> (*) else --> [No] "Configure telescope" --> "Start telescope movement" --> "Create plan execution tasks for all cameras" --> "Set sequence and shs status to EXECUTING" --> "Wait for all plans to be finished" --> if "A plan was aborted" --> [Yes] "Set sequence and shs status to CANCELLED" --> (*) else --> [No] "Set sequence and shs status to EXECUTED" --> (*) endif endif else --> [No] (*) endif @enduml