8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/igniter/contracts/execution/runtime.rb', line 8
def execute(compiled_graph, inputs:, profile:)
validate_profile!(compiled_graph, profile: profile)
normalized_inputs = NamedValues.new(inputs)
state = MutableNamedValues.new
outputs = MutableNamedValues.new
compiled_graph.operations.each do |operation|
handler = profile.runtime_handler(operation.kind)
value = handler.call(operation: operation, state: state, outputs: outputs, inputs: normalized_inputs,
profile: profile)
state.write(operation.name, value) unless operation.output?
outputs.write(operation.name, value) if operation.output?
end
ExecutionResult.new(
state: state.snapshot,
outputs: outputs.snapshot,
profile_fingerprint: profile.fingerprint,
compiled_graph: compiled_graph
)
end
|