diff --git a/lib/explorer/remote.ex b/lib/explorer/remote.ex index af091777d..f3844ef52 100644 --- a/lib/explorer/remote.ex +++ b/lib/explorer/remote.ex @@ -41,13 +41,6 @@ defmodule Explorer.Remote do garbage collector. """ - # TODO: Make `collect` in dataframe transfer to the current node - # TODO: Add `collect` to series - # TODO: Add `compute` to dataframe - # TODO: Handle dataframes (remove Shared.apply_impl) - # TODO: Handle lazy series - # TODO: Add `node` option to creation functions - @doc """ Receives a data structure and traverses it looking for remote dataframes and series. diff --git a/test/explorer/remote_test.exs b/test/explorer/remote_test.exs index c237a2b23..956e3aa50 100644 --- a/test/explorer/remote_test.exs +++ b/test/explorer/remote_test.exs @@ -79,33 +79,22 @@ defmodule Explorer.RemoteTest do describe "garbage collection" do test "happens once the resource is deallocated" do - # {resource, _} = - # remote_eval @node2 do - # Explorer.Series.from_list([1, 2, 3]) - # |> Explorer.RemoteHelpers.keep() - # end + {resource, _} = + remote_eval @node2 do + Explorer.Series.from_list([1, 2, 3]) + |> Explorer.RemoteHelpers.keep() + end - # assert inspect(resource) =~ "OMG" + {%{"foo" => [{resource}]}, [pid]} = Explorer.Remote.place(%{"foo" => [{resource}]}) + assert node(pid) == @node2 + + ref = Process.monitor(pid) + assert :erpc.call(@node2, Process, :alive?, [pid]) + + # Hold a reference until before it is garbage collected + List.flatten([resource]) + :erlang.garbage_collect(self()) + assert_receive {:DOWN, ^ref, _, _, _} end end - - # defp pry_request(sessions) do - # :erlang.trace(Process.whereis(IEx.Broker), true, [:receive, tracer: self()]) - # patterns = for %{pid: pid} <- sessions, do: {[:_, pid, :_], [], []} - # :erlang.trace_pattern(:receive, patterns, []) - - # task = - # Task.async(fn -> - # iex_context = :inside_pry - # IEx.pry() - # end) - - # for _ <- sessions do - # assert_receive {:trace, _, :receive, {_, _, call}} when elem(call, 0) in [:accept, :refuse] - # end - - # task - # after - # :erlang.trace(Process.whereis(IEx.Broker), false, [:receive, tracer: self()]) - # end end