Cannot get it working?
vans163 opened this issue · comments
Using elixir I added :cpg to applications in the mix. Tried both with just calling :reltool_util.application_start(:cpg), and having it in applications and calling.
:application.which_applications()
[...
{:cpg, 'CloudI Process Groups', '1.5.1'}
]
I then try
iex(dev@1.1.1.1)4> :cpg.which_groups
** (exit) exited in: :gen_server.call(:cpg_default_scope, :which_groups)
** (EXIT) no process
(stdlib) gen_server.erl:204: :gen_server.call/2
The same sequence works for me in the Erlang shell:
1> reltool_util:application_start(cpg).
ok
2> cpg:which_groups().
[]
3> application:get_all_env(cpg).
[{group_storage,trie},
{scope,[cpg_default_scope,groups_scope1,groups_scope2]},
{included_applications,[]},
{node_type,visible}]
You should check what it says for env when you attempt to run it. Also, start sasl before attempting that sequence to make sure nothing is crashing. Erlang/OTP and Elixir version information would help make it clearer what you are testing.
Okay so this is what I am doing. Elixir 1.2.6, Erlang R18.3
mix new cpgtest
#mix.exs
defp deps do
[{:cpg, github: "okeuday/cpg"}]
end
mix deps.get
mix deps.compile
iex -S mix
> :reltool_util.application_start(:cpg)
:ok
> :application.get_all_env(:cpg)
[included_applications: []]
> :cpg.which_groups()
** (exit) exited in: :gen_server.call(:cpg_default_scope, :which_groups)
** (EXIT) no process
(stdlib) gen_server.erl:204: :gen_server.call/2
Works fine for the versions you are using (Elixir 1.2.6 with Erlang/OTP 18.3):
$ iex -pz deps/trie/ebin -pz deps/reltool_util/ebin -pz deps/quickrand/ebin -pz ebin
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Interactive Elixir (1.2.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :reltool_util.application_start(:cpg)
:ok
iex(2)> :cpg.which_groups()
[]
I used rebar2 to compile cpg and test it in the repository, so this may be a problem using mix.
Ah. Is elixirs mix supported then? I just see the mix.exs included in the repo and automatically assume it is. I am not sure how to build the project using rebar2 when elixir wants you to use mix. For example building it separately using rebar2 then doing a mix deps.update/clean then manually using rebar2 again is not a comfortable solution.
@vans163 The cpg application fields needed to be in the mix config when using mix to build. I added the extra values there and now it works fine.
Awesome.