Maxximiliann
(EXIT) no process: the process is not alive or there's no process currently associated with the given name
defmodule The_App.Application do
require Logger
use Application
def start(_type, _args) do
:logger.add_handlers(:The_App)
Print.text("Initiating The_App \n")
children = [
The_AppDB.Repo
]
opts = [strategy: :one_for_one, name: The_App.Supervisor]
Supervisor.start_link(children, opts)
end
end
defmodule Supervisor.PyOperatorManager do
use Supervisor
def start_link(_) do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
@impl true
def init(_) do
children = [
:poolboy.child_spec(:py_pool,
name: {:local, :py_pool},
worker_module: Server.PyOperator,
size: 4,
max_overflow: 2
)
]
Supervisor.init(children, strategy: :one_for_one)
end
def launch() do
:poolboy.transaction(:py_pool, fn pid ->
GenServer.call(pid, {"hello_world", "main", "Hello"})
end)
end
end
defmodule Server.PyOperator do
use GenServer
use Export.Python
def start_link(_) do
GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
end
def init(state) do
Process.flag(:trap_exit, true)
priv_path = Path.join(:code.priv_dir(:the_app), "python")
{:ok, py} = Python.start_link(python_path: priv_path)
{:ok, Map.put(state, :py, py)}
end
def handle_call({py_module, py_lambda, data}, _from, %{py: py} = state) do
result = Python.call(py, py_module, py_lambda, [data])
{:reply, result, state}
end
def terminate(_reason, %{py: py}) do
Python.stop(py)
:ok
end
end
Interactive Elixir (1.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Supervisor.PyOperatorManager.launch()
** (exit) exited in: :gen_server.call(:py_pool, {:checkout, #Reference<0.4022030713.2998403074.45553>, true}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
(stdlib 3.15.1) gen_server.erl:247: :gen_server.call/3
(poolboy 1.5.2) /home/source/Desktop/The_App/deps/poolboy/src/poolboy.erl:63: :poolboy.checkout/3
(poolboy 1.5.2) /home/source/Desktop/The_App/deps/poolboy/src/poolboy.erl:82: :poolboy.transaction/3
iex(1)> Supervisor.PyOperatorManager.start_link([])
** (EXIT from #PID<0.367.0>) shell process exited with reason: shutdown: failed to start child: :py_pool
** (EXIT) an exception was raised:
** (MatchError) no match of right hand side value: {:error, {:already_started, #PID<0.379.0>}}
(poolboy 1.5.2) /home/source/Desktop/The_App/deps/poolboy/src/poolboy.erl:283: :poolboy.new_worker/1
(poolboy 1.5.2) /home/source/Desktop/The_App/deps/poolboy/src/poolboy.erl:304: :poolboy.prepopulate/3
(poolboy 1.5.2) /home/source/Desktop/The_App/deps/poolboy/src/poolboy.erl:153: :poolboy.init/3
(stdlib 3.15.1) gen_server.erl:423: :gen_server.init_it/2
(stdlib 3.15.1) gen_server.erl:390: :gen_server.init_it/6
(stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
What exactly is causing these errors and how are they properly addressed?
Marked As Solved
Maxximiliann
defmodule The_App.Application do
require Logger
use Application
def start(_type, _args) do
:logger.add_handlers(:the_app)
Print.text("Initiating The_App \n")
children = [
The_AppDB.Repo,
Supervisor.PyOperatorManager
]
opts = [strategy: :one_for_one, name: The_App.Supervisor]
Supervisor.start_link(children, opts)
end
end
defmodule Supervisor.PyOperatorManager do
use Supervisor
def start_link(_) do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
@impl true
def init(_) do
children = [
:poolboy.child_spec(:py_pool,
name: {:local, :py_pool},
worker_module: Server.PyOperator,
size: 4,
max_overflow: 2
)
]
Supervisor.init(children, strategy: :one_for_one)
end
def launch() do
:poolboy.transaction(:py_pool, fn pid ->
GenServer.call(pid, {"foo", "main", "Hello"})
end)
end
end
defmodule Server.PyOperator do
use GenServer
use Export.Python
def start_link(_) do
GenServer.start_link(__MODULE__, %{})
end
def init(state) do
Process.flag(:trap_exit, true)
priv_path = Path.join(:code.priv_dir(:the_app), "python")
{:ok, py} = Python.start_link(python_path: priv_path)
{:ok, Map.put(state, :py, py)}
end
def handle_call({py_module, py_lambda, data}, _from, %{py: py} = state) do
result = Python.call(py, py_module, py_lambda, [data])
{:reply, result, state}
end
def terminate(_reason, %{py: py}) do
Python.stop(py)
:ok
end
end
Modifications:
- Added
Supervisor.PyOperatorManagertoThe_App.Application'schildren - Removed
name: __MODULE__fromSupervisor.PyOperatorManager.start_link(_)
Popular in Questions
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Hello,
I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these
buyer = %{
id: ...
New
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project.
Baby step #1 is extracting the number ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Other popular topics
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New







