Package: pfm
pfm – a ssh port forward manager for data scientistsData scientists launch a Jupyter Notebook servers to tackle each machine learning task.
Usually local computers are not enough to handle multiple machine learning tasks.
And therefore data scientists do their experiments in servers launched in remote hosts such as EC2 instances.To connect Jupyter Notebook servers in remote hosts, we use ssh port forwarding.
Port forwarding is useful since we do not consume resources in local PC.Unfortunately, when connecting servers in multiple remote hosts and ports numbers, we easily forget
the port number or assign the local port number which is used in another task. Especially when there are multiple remote
hosts and ssh servers as the following image, understanding the combinations of remote hosts and local ports are difficult.pfm manages the remote hosts and port numbers used in port forwarding. Users understand which local
ports are used and which ports are not. Once users register the port forwarding information, pfm generates
ssh parameters any time specifying the task name.InstallWe can install pfm with pip.pip install pfmUsageRegister settings of ssh port forwardingpfm addregisters port forward settings.Register settings with optionsThe following is a sample of adding port forward settings with command line options.$ pfm add -n image-classification --local-port 9999 --remote-port 8888 --ssh-server myml.aws.com --remote-host localhostpfm addprovides the following options.Usage: pfm add [OPTIONS]

add port forwarding target

Options:
    -n, --name TEXT        name of port fowarding
    --forward-type TEXT    port forwarding type [L (local) or R (remote)]
    --local-port INTEGER   local port
    --remote-port INTEGER  remote host port
    --ssh-server TEXT      server to ssh login
    --server-port INTEGER  server port
    --remote-host TEXT     remote host for port forwarding
    --login-user TEXT      login user of ssh server
    --help                 Show this message and exit.Note that when local port number  (--local-port)  is not specified,pfm addautomatically assigns the local port not to collide to other port forward settings.Register settings with a argumentIf you think adding many options are tedious,pfm addalso provides argument style of registration.The following is a sample of registration which forwards port 8888 in takahi-i-ml.aws.com to port 9999 of localhost with a local port forward setting.$pfm add -n image-classification "9999:localhost:8888 takahi-i-ml.aws.com"As we see the above example is simple and just uses-noption. Note that default forward type is set to local (L). If you want to set forward type
to remote please specify the type with--forward_typeparameter.Generate ssh port forward parametersAfter the registration of port forward settings withpfm add, we can generate ssh parameters withpfm param.$ ssh `pfm param image-classification`Or we can also usepfm connectin order to do same (Note that this command includes -A ssh option).$ pfm connect image-classificationUpdate port forward settingsAfter the registration of port forward settings withpfm add, we can modify ssh parameters withpfm update.
For example, the following command changes the port forwarding type  ofimage-classificationsetting from local to remote.$ pfm update --name image-classification --forward-type RList registered ssh port forward settingsWe can see the list of registered port forward settings.$ pfm list
+----------------------+------------+------------+--------------------------------+--------------+-----------------+--------------------------------+--------------+
|         name         |    type    | local_port |          remote_host           | remote_port  |   login_user    |           ssh_server           | server_port  |
+======================+============+============+================================+==============+=================+================================+==============+
| image-processing     | L          | 9999       | localhost                      | 8888         | None            | my-ml-instance.aws.com         |              |
+----------------------+------------+------------+--------------------------------+--------------+-----------------+--------------------------------+--------------+
| text-processing      | L          | 7777       | localhost                      | 8888         | None            | my-ml-instance-2.aws.com       |              |
+----------------------+------------+------------+--------------------------------+--------------+-----------------+--------------------------------+--------------+Delete registered forwarding settingWhen a port forward settings is not needed, we can remove the setting withpfm deletecommand$ pfm delete image-processLicenseFree software: MIT licenseResourcesSlides on pfm.For developersWe are welcome any contribution. For details, please seeCONTRIBUTING.rst.