Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added manager node monitor #827

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Added manager node monitor #827

wants to merge 1 commit into from

Conversation

scohen
Copy link
Collaborator

@scohen scohen commented Sep 6, 2024

Occasionally, our script that's designed to clean up after the project node port doesn't seem to work correctly. Because of this, it makes sense to monitor the manager node for the project node and to shut down when the manager node dies.

Occasionally, our script that's designed to clean up after the project
node port doesn't seem to work correctly. Because of this, it makes
sense to monitor the manager node for the project node and to
shut down when the manager node dies.
Copy link
Collaborator

@zachallaun zachallaun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking about this a bit and while it works, I was wondering if there was a lighter-weight solution.

Right now, when we start the remote node, we pass the flag -e "Node.connect(manager_node)". What if, instead, we called something like LXical.RemoteControl.connect_to_manager(manager_node) that was defined like this:

def connect_to_manager(manager) do
  true = Node.connect(manager)

  spawn(fn ->
    Node.monitor(manager, true)

    receive do
      {:nodedown, ^manager} -> System.stop()
    end
  end)
end

Thoughts?

end

@impl true
def handle_info({:nodedown, _}, state) do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think state is the manager node here, maybe this is worth doing?

Suggested change
def handle_info({:nodedown, _}, state) do
def handle_info({:nodedown, manager}, manager) do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants