Skip to content

Multiple Machine Configs #3

@wrathematics

Description

@wrathematics

I was working on something like this a year ago, but the pbdRPC design is so radically different, it wouldn't be easy to integrate. Basically what I'd like to have is an easy way to handle multiple machine configurations. What I want to be able to do is

rpc(cmd="uname", machine=newton)
rpc(cmd="uname", machine=beacon)

etc. I actually think it would be worth changing the current interface for something like this, since in the long run it would be much simpler.

In my original plan, machine configs were S4 objects, but that's not really necessary (and I'm not sure I would do it that way again anyway). But I think all of the .pbd_env$RPC_LI$ objects could be moved to a machine "object" (maybe S3/attribute just for error checking). Maybe something like:

machine <- function(user, hostname, args="", pport=22, priv.key="~/.ssh/id_rsa", priv.key.ppk=.pbd_env$RPC.LI$priv.key.ppk)
{
  m <- list(args=args, pport=pport, user=user, hostname=hostname, priv.key=priv.key, priv.key.ppk=priv.key.ppk)
  class(m) <- "remote_machine"
  return(m)
}

print.remote_machine <- function(x, ...)
{
  cat(paste0("Machine config for ", x$user, "@", x$hostname, "\n"))
  cat(paste0("    pport = ", x$pport, "\n"))
  cat(paste0("    args = \"", x$args, "\"\n"))
  cat(paste0("    priv.key = ", x$priv.key, "\n"))
  cat(paste0("    priv.key.ppk = ", x$priv.key.ppk, "\n"))
}

Then you would be able to just do:

myvm <- machine("wrathematics", "192.168.0.10")
rpc("uname", myvm)

There's nothing high minded here, but I really think this way of organization is worth considering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions