Skip to content

Instantly share code, notes, and snippets.

View pdilyard's full-sized avatar

Paul Dilyard pdilyard

  • Atomic Industries
  • Cleveland, OH
View GitHub Profile
# Model
defmodule MyApp.Message do
use MyApp.Web, :model
schema "messages" do
field :text, :string
belongs_to :user, User
timestamps
end
1) Controllers.UserTest: failure on setup_all callback, tests invalidated
** (RuntimeError) cannot find ownership process for #PID<0.496.0>.
When using ownership, you must manage connections in one
of the three ways:
* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
iex(1)> Hydrogen.Repo.all(Model.User)
[%Model.User{__meta__: #Ecto.Schema.Metadata<:loaded>, email: "jdoe@example.com",
id: 1, inserted_at: #Ecto.DateTime<2016-03-14 19:56:48>, name: "John Doe",
password: "$2b$12$oDQbBsclvSC9JwS3Wig9ZuqwGc8R1Yz.i1dqVjvWx4Flwp8383PMy", salt: "$2b$12$oDQbBsclvSC9JwS3Wig9Zu",
updated_at: #Ecto.DateTime<2016-03-14 19:56:48>}]
defmodule ListServer do
use GenServer
def start_link(name) do
GenServer.start_link(__MODULE__, name, [])
end
def get_result(name) do
GenServer.call(via(name), :get_result)
end
def make_choices(id, users, votes_per_user) do
start_time = Timex.Time.now(:msecs)
1..users
|> Enum.map(fn(user) ->
# map each user to an async task
Task.async(fn ->
# make a given number of choices for this user
1..votes_per_user
|> Enum.each(fn(_) ->
$ rel/ex_orient/bin/ex_orient console
Using /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/releases/1.0.1/ex_orient.sh
Exec: /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/erts-7.2.1/bin/erlexec -boot /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/releases/1.0.1/ex_orient -boot_var ERTS_LIB_DIR /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/erts-7.2.1/../lib -env ERL_LIBS /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/lib -config /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/running-config/sys.config -args_file /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient/running-config/vm.args -user Elixir.IEx.CLI -extra --no-halt +iex -- console
Root: /Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient
/Users/pauldilyard/github.com/remesh/ex_orient/rel/ex_orient
Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
"Pool size:"
5
"Pool max overflow:"
{"Kernel pid terminated",application_controller,"{application_start_failure,ex_orient,{{shutdown,{failed_to_start_child,'Elixir.ExOrient.Supervisor',{shutdown,{failed_to_start_child,marco_polo,{{badmatch,{error,{'EXIT',{undef,[{'Elixir.Connection',start_link,['Elixir.MarcoPolo.Connection',[{user,<<\"admin\">>},{password,<<\"admin\">>},{connection,{db,<<\"GratefulDeadConcerts\">>,document}},{host,<<\"localhost\">>},{port,2424}],[{user,<<\"admin\">>},{password,<<\"admin\">>},{connection,{db,<<\"GratefulDeadConcerts\">>,document}},{host,<<\"localhost\">>},{port,2424}]],[]},{'Elixir.MarcoPolo.Connection',start_link,1,[{file,\"lib/marco_polo/connection.ex\"},{line,53}]},{supervisor,do_start_child_i,3,[{file,\"supervisor.erl\"},{line,359}]},{supervisor,handle_call,3,[{file,\"supervisor.erl\"},{line,384}]},{gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,629}]},{gen_server,handle_msg,5,[{file,\"gen_server.erl\"},{line,661}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}},[{poolb
{"Kernel pid terminated",application_controller,"{application_start_failure,ex_orient,{{shutdown,{failed_to_start_child,'Elixir.ExOrient.Supervisor',{shutdown,{failed_to_start_child,marco_polo,{{badmatch,{error,{'EXIT',{undef,[{'Elixir.Connection',start_link,['Elixir.MarcoPolo.Connection',[{user,<<\"admin\">>},{password,<<\"admin\">>},{connection,{db,<<\"GratefulDeadConcerts\">>,document}},{host,<<\"localhost\">>},{port,2424}],[{user,<<\"admin\">>},{password,<<\"admin\">>},{connection,{db,<<\"GratefulDeadConcerts\">>,document}},{host,<<\"localhost\">>},{port,2424}]],[]},{'Elixir.MarcoPolo.Connection',start_link,1,[{file,\"lib/marco_polo/connection.ex\"},{line,53}]},{supervisor,do_start_child_i,3,[{file,\"supervisor.erl\"},{line,359}]},{supervisor,handle_call,3,[{file,\"supervisor.erl\"},{line,384}]},{gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,629}]},{gen_server,handle_msg,5,[{file,\"gen_server.erl\"},{line,661}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}},[{poolb
defmodule ExOrient.Mixfile do
use Mix.Project
def project do
[app: :ex_orient,
version: "1.0.1",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
description: description,
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[
app: :myapp,
version: full_version("0.0.0"),
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix] ++ Mix.compilers,