     Agent.get(state_agent, fn {_, config} -> config end)
   end
 
-  def log_command_received(node_id, command, status) do
-    # Logger.info "#{node_id} - at status: #{status} - received command #{command}"
-  end
-
-  def log_command_executed(node_id, command, status) do
-    # Logger.info "#{node_id} - at status: #{status} - executed command #{command}"
-  end
-
 end

  end

  def handle_call({:configure_and_run, config}, _, {:not_started, state_agent, node_id}) do
    log_command_received(node_id, :configure, :not_started)
    Agent.update(state_agent, fn {status, _} -> {status, config} end)
    spawn_algo_sup(config)
    log_command_executed(node_id, :configure, :not_started)

    next_status = :just_started
    set_status(node_id, state_agent, :not_started, next_status)


  def init([node_id, state_agent]) do

    status = Agent.get(state_agent, fn {status, _} -> status end)
    name = get_name(node_id)
    :yes = :global.register_name(name, self)
    {:ok, {status, state_agent, node_id}}
  end

  def handle_info({:EXIT, pid, reason}, {:pinging, state_agent, node_id}) do
    Logger.warn "AlgorithmSupervisor,  #{pid} crashed #{inspect reason}. Restarting..."
    config = Agent.get(state_agent, fn {_, config} -> config end)
    spawn_algo_sup(config)
    {:noreply, {:pinging, state_agent, node_id}}
