Skip to content

Sequence Diagram Pseudo Code

devsda edited this page May 15, 2019 · 3 revisions
title Execute Workflow

Client->Shepherd: Request to execute endpoint
Shepherd->Dao: Create state of given execution
Shepherd->RabbitMQ: Store node-message of root
Shepherd->Client: Returrn objectId, and ExecutionId
title Node Executor Workflow

NodeExecutor->RabbitMQ: Poll Queue for node-messages
NodeExecutor->Dao: Mark node state to PROCESSSING
NodeExecutor->MongoDB: Fectch Execution Document
NodeExecutor->ClientAPI: Call client API with Execution Document

alt Conditional workflow
    NodeExecutor->NodeExecutor: Find child Node to execute
    NodeExecutor->RabbitMQ: Push child node into primary queue
else UnConditional workflow
    NodeExecutor->NodeExecutor: Find Ready to execute, and not ready to execute nodes
    NodeExecutor->RabbitMQ: Push ready to execute nodes to primary queue
    NodeExecutor->RabbitMQ: Push not ready to execute nodes to secondary queue
end
title Node Tracker Workflow

NodeTracker->RabbitMQ: Poll node-messages from secondary Queue
NodeTracker->NodeTracker:  Check weather node is ready to executed ?


alt Node is ready to execute
    NodeTracker->RabbitMQ: Delete current node-message from secondary queue
    NodeTracker->RabbitMQ: Push  node-message into primary queue
else Not ready
    NodeTracker->RabbitMQ: Push node-message back to secondary queue
end
title Kill Workflow

Client->Shepherd: request to kill given execution
Shepherd->Dao: mark state to KILLED
Shepherd->Client: killed execution successfully
title restart workflow

Client->Shepherd: Request to restart given execution
Shepherd->Shepherd: kill current execution under given objectId
Shepherd->Shepherd: Execute new execution under given objectId
Shepherd->Client: response : objectId, new executionId
title resume workflow

Client->Shepherd: request to resume workflow
Shepherd->Dao: Fetch all the processing/failed/killed state nodes
Shepherd->RabbitMQ: Push above mentioned node-messages
Shepherd->Dao: Mark state of execution as PROCESSING
Shepherd->Client: response : objectId, ExecutionId