Maxximiliann
defmodule TheApp.Application do
require Logger
use Application
def start(_type, _args) do
:logger.add_handlers(:the_app)
Print.text("Initiating TheApp \n")
children = [
TheAppDB.Repo,
Supervisor.PyOperatorManager
]
opts = [strategy: :one_for_one, name: TheApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
defmodule Supervisor.PyOperatorManager do
use Supervisor
@timeout 60_000
def start_link(_) do
Supervisor.start_link(__MODULE__, [], name: __MODULE__)
end
@impl true
def init(_) do
Process.flag(:trap_exit, true)
children = [
:poolboy.child_spec(:py_pool,
name: {:local, :py_pool},
worker_module: Server.PyOperator,
size: 10,
max_overflow: 5
)
]
Supervisor.init(children, strategy: :one_for_one)
end
def launch(data \\ [], py_module, py_lambda) do
:poolboy.transaction(
:py_pool,
fn pid ->
GenServer.call(pid, {data, py_module, py_lambda}, @timeout)
end,
@timeout
)
end
end
defmodule Server.PyOperator do
use GenServer
use Export.Python
def start_link(_) do
GenServer.start_link(__MODULE__, %{})
end
@impl true
def init(state) do
Process.flag(:trap_exit, true)
priv_path = Path.join(:code.priv_dir(:arbit), "python")
{:ok, py} = Python.start_link(python_path: priv_path)
{:ok, Map.put(state, :py, py)}
end
@impl true
def handle_call({args, py_module, py_lambda}, _from, %{py: py} = state) do
results = Python.call(py, py_module, py_lambda, [args])
{:reply, results, state}
end
@impl true
def terminate(_reason, %{py: py}) do
Python.stop(py)
:ok
end
end
2021-10-06T22:23:46.065683+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,1},pid=<0.378.0>.
2021-10-06T22:23:46.084583+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,2},pid=<0.379.0>.
2021-10-06T22:23:46.084832+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,3},pid=<0.380.0>.
2021-10-06T22:23:46.085016+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,4},pid=<0.381.0>.
2021-10-06T22:23:46.085196+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,5},pid=<0.382.0>.
2021-10-06T22:23:46.085350+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,6},pid=<0.383.0>.
2021-10-06T22:23:46.085475+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,7},pid=<0.384.0>.
2021-10-06T22:23:46.085600+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,8},pid=<0.385.0>.
2021-10-06T22:23:46.085713+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,9},pid=<0.386.0>.
2021-10-06T22:23:46.085815+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,10},pid=<0.387.0>.
2021-10-06T22:23:46.085936+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,11},pid=<0.388.0>.
2021-10-06T22:23:46.086109+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,12},pid=<0.389.0>.
2021-10-06T22:23:46.086287+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,13},pid=<0.390.0>.
2021-10-06T22:23:46.086477+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,14},pid=<0.391.0>.
2021-10-06T22:23:46.086656+00:00 info: Supervisor: {<0.377.0>,'Elixir.DBConnection.ConnectionPool.Pool'}. Started: id={'Elixir.Postgrex.Protocol',<0.376.0>,15},pid=<0.392.0>.
2021-10-06T22:23:46.087901+00:00 info: Supervisor: {local,'Elixir.TheAppDB.Repo'}. Started: id='Elixir.DBConnection.ConnectionPool',pid=<0.376.0>.
2021-10-06T22:23:46.088211+00:00 info: Supervisor: {local,'Elixir.TheApp.Supervisor'}. Started: id='Elixir.TheAppDB.Repo',pid=<0.375.0>.
2021-10-06T22:23:46.090726+00:00 info: Supervisor: {local,inet_gethost_native_sup}. Started: pid=<0.396.0>,mfa={inet_gethost_native,init,[[]]}.
2021-10-06T22:23:46.090961+00:00 info: Supervisor: {local,kernel_safe_sup}. Started: id=inet_gethost_native_sup,pid=<0.395.0>.
2021-10-06T22:23:46.278295+00:00 error: 'Elixir.Server.PyOperator' <0.398.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.24>,normal}
2021-10-06T22:23:46.401591+00:00 error: 'Elixir.Server.PyOperator' <0.401.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.26>,normal}
2021-10-06T22:23:46.530950+00:00 error: 'Elixir.Server.PyOperator' <0.403.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.28>,normal}
2021-10-06T22:23:46.736844+00:00 error: 'Elixir.Server.PyOperator' <0.405.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.30>,normal}
2021-10-06T22:23:46.900071+00:00 error: 'Elixir.Server.PyOperator' <0.407.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.32>,normal}
2021-10-06T22:23:47.039102+00:00 error: 'Elixir.Server.PyOperator' <0.409.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.34>,normal}
2021-10-06T22:23:47.197723+00:00 error: 'Elixir.Server.PyOperator' <0.411.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.36>,normal}
2021-10-06T22:23:47.365769+00:00 error: 'Elixir.Server.PyOperator' <0.413.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.38>,normal}
2021-10-06T22:23:47.550171+00:00 error: 'Elixir.Server.PyOperator' <0.415.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.40>,normal}
2021-10-06T22:23:47.730449+00:00 error: 'Elixir.Server.PyOperator' <0.417.0> received unexpected message in handle_info/2: {'EXIT',#Port<0.42>,normal}
How and why is {'EXIT',#Port<number>,normal} being triggered?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
hauleth
Because that is how port informs controlling process that spawned process has ended.