A lot of them use Python and almost all the on-line courses use also Python to teach the concepts.
You can see that the first example is prepared to scale-in and the second one to scale-out. But all of them seem to be too much for a guy who only wants to develop a "Python code" so let's back to the data science world.
- Francesco Cesarini, Founder & Technical Director of Erlang Solutions, defined Erlang as an orchestration language.
-
Demonware, the company behind the infrastructure for Call of Duty, uses Erlang to handle connections, tasks and especially, to control Python (slides).
Why don't I try to handle my Python code using Elixir? In this way I will be able to scale and specially to add fault tolerance.
The first step is to have a Python project. I am going to use a simple example of a Fibonnaci calculator.
def fib(n): if n < 0: raise Exception("No negative values !!!") if n == 0: return 0 if n < 3: return 1 return fib(n - 1) + fib(n - 2)
defmodule MyPoolPort do use Piton.Port def start(), do: MyPoolPort.start([path: Path.expand("python_folder"), python: "python"], []) def fun(pid, n), do: MyPoolPort.execute(pid, :functions, :fun, [n]) end
Now we only have to launch our Piton.Pool, indicating which module is going to use and the number Pythons we want to run, and use it:
iex> {:ok, pool} = Piton.Pool.start_link([module: MyPoolPort, pool_number: 2], []) {:ok, #PID<0.176.0>} iex> Piton.Pool.execute(pool, :fib, [20]) 6765