Comments (12)
choose_node
receives all members of the cluster plus the identifier, so that means that you could just pick one of the members based on the identifer?
from horde.
@arjan Yes I agree. As long as I know at that point which identifier to choose. We would have to receive some information about which preferred Node the user wants to connect this Process
from horde.
This could be passed as an option to the DynamicSupervisor of the process.
from horde.
@sleipnir, I'm in the same boat. Currently looking for a way to start my processes on a specific node. My app require a specific node based on volume id (disk storage). Did you find a way to accomplish your goal?
@arjan, it seems that the identifier
given to choose_node/2
is the hash of the child_spec
(without the :id
) in Horde.DynamicSupervisor.start_child/2
. In my case it's not feasible because the params given to :start
would differ between processes.
horde/lib/horde/dynamic_supervisor_impl.ex
Line 754 in c00f77d
I think the changes made in #128 and being a fix for compatibility issues with Elixir.DynamicSupervisor
broke the way of defining custom distribution strategies based on a specific identifier (or at least making it very cumbersome).
from horde.
@sleipnir, I'm in the same boat. Currently looking for a way to start my processes on a specific node. My app require a specific node based on volume id (disk storage). Did you find a way to accomplish your goal?
@arjan, it seems that the
identifier
given tochoose_node/2
is the hash of thechild_spec
(without the:id
) inHorde.DynamicSupervisor.start_child/2
. In my case it's not feasible because the params given to:start
would differ between processes.horde/lib/horde/dynamic_supervisor_impl.ex
Line 754 in c00f77d
@redrabbit Unfortunately I couldn't find a solution and ended up using a singleton process on the cluster. Still trying to find time to send a PR with a proposal for this feature but it's a little difficult
from horde.
@redrabbit the second argument of choose_node/2
is the list of members. If you filter that list first you can control the set of nodes which get selected. This is how I implemented it:
def choose_node(identifier, members) do
members = Enum.filter(members, fn member -> ... end)
Horde.UniformDistribution.choose_node(identifier, members)
end
from horde.
@arjan like I stated in my previous comment, the identifier
passed to choose_node/2
is not very usable because it's the hash of child_spec without :id
. So how do I filter my members based on the identifier?
from horde.
I'm sorry, I did not read it carefully enough.
I think it would be a nice addition to add the original child_spec
as a third argument to the choose_node callback function.
from horde.
¿Any updates on this issue?
I'm having the same problem, I need some of the child's info to filter out members from the list.
¿Any new ideas on how to work around this?
from horde.
It seems easy enough to create a branch add this third argument, and then create a PR for it?
AFAICT you only need to change these lines
from horde.
choose_node/2 receives a child_spec. Since child_spec is an ordinary map, you could add a :preferred_node into it, and choose_node would have something to decide where to start your process.
from horde.
Closing this because PR #239 can solve the problem.
from horde.
Related Issues (20)
- ETS lookup crash in Registry.lookup
- DynamicSupervisor.start_child hangs on infinite timeout HOT 3
- Is it possible to start a Horde dynamic supervisor with a registered name? HOT 2
- match error when stopping a process HOT 1
- Stopping Child via Horde.DynamicSupervisor.terminate_child with via_tuple HOT 1
- Occasional Horde Registry Lookup Misses HOT 2
- GenServer.cast cant find process via {:via, Horde.Registry, ...} HOT 6
- race condition in name conflict in same registry process results in all processes losing HOT 20
- Default random node distribution strategy HOT 5
- Match error while doing process handoff in dynamic supervisor
- Use new PartitionSupervisor
- Timeouts and Crashes in the Cluster HOT 2
- Disappearing values from Horde.Registry after spawning more than two nodes. HOT 2
- Why we need to handle {:error, {:already_started, pid}} ? HOT 4
- SayHello GenServer never (re)started on `count3` node?
- uniform_random_distribution.ex not in deps 8.7 HOT 1
- Old child specs remain in Supervisor CRDT after process handoff
- Registry.lookup doesn't always return new item that was just registered HOT 13
- Example of How to Start Children like a Regular Supervisor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from horde.