Running jobs through ssh (linux/osx)

自作多情 提交于 2020-01-06 05:40:10

问题


I was wondering if it was possible to execute jobs via ssh. In particular I have a different list of input files on a number of machines that all have the same executable in the same place. Is there some command which means I dont have to move from machine to machine using ssh and set them running individually. The sort of thing I had in mind would be something like:

ssh RemoteMachine1:./Executable ~/Inputfile_1 ssh RemoteMachine2:./Executable ~/Inputfile_2

which could be run from my host machine? Thanks in advance Jack


回答1:


Try using Fabric.

"Fabric is a Python (2.5 or higher) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks."




回答2:


If you can write Perl, try Net::OpenSSH::Parallel.

For instance:

my %file = (host1 => file1,
             host2 => file2,
             ...);

my $pssh = Net::OpenSSH::Parallel->new();

for my $host (keys %files) {
    $pssh->add_host($host);
    $pssh->push($host, 'cmd',
                {stdout_file => "$host.out"},
                './Executable', $file{$host});

}

$pssh->run



回答3:


You usually can run the batch command thru ssh ; read more about batch command and batch processing.

You might also be interested by MPI or DSH or SQS



来源:https://stackoverflow.com/questions/19143980/running-jobs-through-ssh-linux-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!