..
    @startuml images/01_activity.png
    title Image 1: Audit Job Controller
    (*) -down-> "Establish HZ"
    -down-> "Get Nodes from HZ Config"
    -down-> "Get DataONE Machine IPS from D1 Config"
    -down-> "Save Configured Cluster Node Properties"
    -down-> "Set Active Node State" 
    
    -down-> "Initialize Static Data Structures"

    -left->  "Initialize Listeners and Singletons"
    note top: Find the master node\nand set it in the\nStatic State Service
    -down-> if "Am I the Active Node?" then
       -down->[Yes] "Loop"
       -down-> if "all HZ nodes in Cluster?" then
          -down->[yes] if "Audit Job Running?" as AJR then 
             -left->[yes] "Stop Audit Job"
             -up-> "Loop"
           else
             partition "Audit Job"
             -down->[no] "Run Audit Job"
             end partition
          
      -down-> if "Are All Pids Processed?" then
      		      -down->[yes] "Evict SystemMetadata from Storage Cluster"
                      -down-> "Send End Audit Signal"
                      -down-> ===STOP_ACTIVE_NODE===
                    else
                      -left->[no] "spacer"
                      -left-> "Determine Cause of Failure"
                      -up-> "Determine and Set correct Active Node State"
                      -up-> "Reset Passive Node Audit Jobs"
                      -up-> "Loop"
                    endif
            endif
       else
         -up->[no] "Loop"
       endif
    else
        -down->[no]===STOP_ACTIVE_NODE===
    endif

    ===STOP_ACTIVE_NODE=== --> (*)


    @enduml