digraph G {

bgcolor=transparent;
overlap=compress;
rankdir=TB;

node[
  fontname=Monaco,
  penwidth=1,
  fontsize=20,
  margin=.1,
  shape=box,
  ordering=out
]

run [
  label="canary run [options] [pathspec ...]",
  shape="plaintext",
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/commands/run.py?ref_type=heads#L26"
]

plug_test_run [
  label="Plugins:\ntest_prelaunch\ntest_finish",
  shape="cds",
  orientation=180,
  fontsize=10,
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/plugin.py?ref_type=heads#L70"
]
plug_test_run_b1 [
  label="Plugins:\ntest_prelaunch\ntest_finish",
  shape="cds",
  orientation=180,
  fontsize=10,
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/plugin.py?ref_type=heads#L70"
]
init [
  label="Initialize\nCreate test session\ndirectory, database, etc.",
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/session.py?ref_type=heads#L90"
]
search [
  label="Search\nFind test files and\ninstantiate TestGenerator\nobjects for each",
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/finder.py?ref_type=heads"
]
lock [
  label="Lock\nExpand parameters and\ncreate concrete test cases\nfrom each generator",
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/finder.py?ref_type=heads#L161"
]
setup [
  label="Setup\ncreate execution\ndirectories for test cases\nand copy/link resources",
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/test/case.py?ref_type=heads#L806"
]
finish [label="Finish"]
done [label="Done"]

plug_session_init [
  label="Plugin:\nsession_initialize",
  shape="cds",
  orientation=180,
  fontsize=10,
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/session.py?ref_type=heads#L175",
]
plug_session_discovery [
  label="Plugin:\nsession_discovery",
  shape="cds",
  orientation=180,
  fontsize=10,
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/session.py?ref_type=heads#L402",
]
plug_session_finish [
  label="Plugin:\nsession_finish",
  shape="cds"
  orientation=180,
  fontsize=10,
]
plug_test_setup [
  label="Plugin:\ntest_setup",
  shape="cds",
  orientation=180,
  fontsize=10,
  href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/test/case.py?ref_type=heads#L818"
]

  queue [
    label="Put test cases in\nResourceQueue",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/queues.py?ref_type=heads#L203"
  ]
  batch_queue [
    label="Put test cases in\nBatchResourceQueue",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/queues.py?ref_type=heads#L264"
  ]

  batched [
    label="Batched?",
    fixedsize="true",
    width="3",
    height="1",
    shape="diamond",
    style="filled",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/test/batch.py?ref_type=heads"
  ]
  batch_cases [
    label="Batch test cases\nusing tiling\nalgorithm",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/partition.py?ref_type=heads#L53"

  ]
  run_batch [
    label="Run batch",
  ]

  scheduled [
    label="Scheduled?",
    fixedsize="true",
    width="3",
    height="1",
    shape="diamond",
    style="filled"
  ]
  run_batched_sched [
    label="Run batches\nasynchronously\nthrough scheduler",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/runners.py?ref_type=heads#L116"
  ]
  run_async_b1 [
    label="Run tests in\nbatch asynchronously",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/runners.py?ref_type=heads#L26"
  ]

  run_batched_no_sched [
    label="Run batches\nasynchronously",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/runners.py?ref_type=heads#L116"
  ]

  run_async [
    label="Run tests\nasynchronously",
    href="https://cee-gitlab.sandia.gov/ascic-test-infra/canary/-/blob/main/src/_canary/runners.py?ref_type=heads#L26"
  ]

  nothing1 [style="invis" label="          "]
  nothing2 [style="invis" label="          "]

  batched -> batch_queue [label="Yes"]
  batch_queue -> batch_cases -> scheduled
  scheduled -> run_batched_sched [label="Yes"]
  run_batched_sched -> run_batch
  run_batch -> run_async_b1 //nothing1 [style="invis"]
  plug_test_run_b1 -> run_async_b1 [arrowhead="none"]

  scheduled -> run_batched_no_sched [label="No"]
  run_batched_no_sched -> run_batch

  batched -> queue [label="No"]
  queue -> run_async
  run_async -> plug_test_run [arrowhead="none"]
  run_async -> finish

  run -> init
  init -> plug_session_init [arrowhead="none"]
  init -> search
  search -> plug_session_discovery [arrowhead="none"]
  search -> lock -> setup
  setup -> plug_test_setup [arrowhead="none"]
  setup -> batched

  run_async_b1 -> finish

  finish -> plug_session_finish [arrowhead="none"]
  finish -> done

  {rank="same"; init; plug_session_init;}
  {rank="same"; search; plug_session_discovery;}
  {rank="same"; setup; plug_test_setup;}
  {rank="same"; batch_queue; queue;}
  {rank="same"; finish; plug_session_finish;}
  {rank="same"; /*plug_test_run_b1;*/ run_async_b1; run_async; plug_test_run}
  {rank="same"; run_batched_no_sched; run_batched_sched}

}
