Skip to content

Commit

Permalink
add farmware execution rpc debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth authored and ConnorRigby committed Jul 11, 2019
1 parent 94b0b22 commit 810f04e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions farmbot_os/lib/farmbot_os/sys_calls/execute_script.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ defmodule FarmbotOS.SysCalls.ExecuteScript do
:ok

{:step_complete, ^ref, :ok} ->
Logger.debug("ok for #{label}")
response = %AST{kind: :rpc_ok, args: %{label: label}, body: []}
true = FarmwareRuntime.rpc_processed(runtime, response)
loop(farmware_name, runtime, monitor, {nil, nil})

{:step_complete, ^ref, {:error, reason}} ->
explaination = %AST{kind: :explaination, args: %{message: reason}}
response = %AST{kind: :rpc_error, args: %{label: label}, body: [explaination]}
Logger.debug("error for #{label}")
explanation = %AST{kind: :explanation, args: %{message: reason}}
response = %AST{kind: :rpc_error, args: %{label: label}, body: [explanation]}
true = FarmwareRuntime.rpc_processed(runtime, response)
loop(farmware_name, runtime, monitor, {nil, nil})

Expand All @@ -51,6 +53,7 @@ defmodule FarmbotOS.SysCalls.ExecuteScript do
case FarmwareRuntime.process_rpc(runtime) do
{:ok, %{args: %{label: label}} = rpc} ->
ref = make_ref()
Logger.debug("executing rpc: #{inspect(rpc)}")
_pid = spawn(FarmbotCeleryScript, :execute, [rpc, ref])
loop(farmware_name, runtime, monitor, {ref, label})

Expand Down

0 comments on commit 810f04e

Please sign in to comment.