BB.Inference.Test.FakeRuntime (bb_inference v0.1.0)

Copy Markdown View Source

A runtime that loads nothing and doubles every input it runs.

With the :gate option, each load/2 waits for the test to decide how it ends: it sends {:fake_runtime, :load, gate, loader_pid} to the pid stored at {BB.Inference.Test.FakeRuntime, gate} in :persistent_term, and waits for {:fake_runtime, :load_result, result}. With no pid stored, it loads.

:outputs replaces the output the description reports, for testing codecs that don't fit. Each unload/1 is reported as {:fake_runtime, :unload, gate}.

Summary

Functions

Answer a waiting load.

Make every load through gate wait for the calling process to answer.

Let loads through gate proceed without asking.

Functions

answer(loader, result)

@spec answer(pid(), :ok | {:error, term()}) :: :ok

Answer a waiting load.

hold(gate)

@spec hold(atom()) :: :ok

Make every load through gate wait for the calling process to answer.

release(gate)

@spec release(atom()) :: :ok

Let loads through gate proceed without asking.