jina.peapods.runtimes.ssh

class jina.peapods.runtimes.ssh.SSHRuntime(args)[source]

Bases: jina.peapods.runtimes.zmq.base.ZMQManyRuntime

Simple SSH based SSHRuntime for remote Pea management .. note:

It requires one to upload host public key to the remote
1. ssh-keygen -b 4096
2. scp ~/.ssh/id_rsa.pub username@hostname:~/.ssh/authorized_keys

Note

As the terminal signal is sent via send_terminate_signal() from BasePea, there is no need to override/implement close() method. Lifecycle is handled by BasePea.

setup()[source]

Method called to prepare the runtime inside S. Optional in subclasses. The default implementation does nothing.

Note

If this method raises any exception, then run_forever() and teardown() won’t be called.

Note

Unlike __init__() called in M, setup() is called inside S.

run_forever()[source]

Running the blocking procedure inside S. Note, once this method is called, S is blocked.

Note

If this method raises any exception, teardown() will be called.

See also

cancel() for cancelling the forever loop.

teardown()[source]

Method called immediately after run_forever() is unblocked. You can tidy up things here. Optional in subclasses. The default implementation does nothing.

Note

This method will only be called if the setup() succeeds.