ElGraph.Executor (ElGraph v0.3.0)

Copy Markdown View Source

Superstep(Pregel/BSP) 실행 루프 (SPEC §3.4).

한 superstep = 활성 항목 실행 → 쓰기 수집 → reducer 병합 → 다음 항목 결정. 순수 함수형 재귀 루프이며 부수효과는 telemetry와 이벤트 방출뿐이다.

활성 항목은 {key, node, input}:send의 동적 fan-out으로 같은 노드가 한 superstep에 여러 번 등장할 수 있어 노드 이름이 아닌 key로 구분한다. pending writes(SPEC §3.5)는 쓰기와 함께 제어 지시(goto/sends)도 보존해 재개 시 라우팅까지 복원된다.

체크포인트 영속 시점은 :durability 모드로 조절한다 (SPEC §3.5):

  • :sync (기본) — 매 superstep 동기 영속. 강한 보장.
  • :async — 순서 보장 writer 프로세스에 비동기 적재, 반환 전 flush. 마지막 step 유실 가능.
  • :exit — 매 step 저장 생략, 완료·인터럽트만 영속. 가장 빠름(중간 크래시 복구 불가).

Summary

Functions

마지막 체크포인트에서 실행을 이어간다 (SPEC §3.5).

주어진 체크포인트 상태에서 실행을 시작한다 (ElTrace time-travel 재개의 진입점).

Types

result()

@type result() :: {:ok, map()} | {:error, term()} | {:interrupted, map()}

Functions

resume(graph, opts)

@spec resume(
  ElGraph.Graph.t(),
  keyword()
) :: result()

마지막 체크포인트에서 실행을 이어간다 (SPEC §3.5).

완료된 thread(next: [])는 노드 재실행 없이 최종 상태를 반환한다. 부분 실패한 superstep의 pending writes는 run_superstep/5가 읽어 완료된 노드를 건너뛴다.

resume_from(graph, checkpoint, opts)

@spec resume_from(ElGraph.Graph.t(), ElGraph.Checkpoint.t(), keyword()) :: result()

주어진 체크포인트 상태에서 실행을 시작한다 (ElTrace time-travel 재개의 진입점).

resume/2가 thread의 최신 체크포인트를 쓰는 반면, 이건 임의 체크포인트(과거 step)를 받아 그 상태/활성 노드부터 실행한다. opts:thread_id로 분기(fork)할 새 thread를 지정하면 원래 thread는 보존된다.

run(graph, input, opts \\ [])

@spec run(ElGraph.Graph.t(), map(), keyword()) :: result()