Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 29, 2024
1 parent f3cac55 commit f9ff532
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 33 deletions.
7 changes: 0 additions & 7 deletions lib/explorer/remote.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
41 changes: 15 additions & 26 deletions test/explorer/remote_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f9ff532

Please sign in to comment.