Exemple #1
0
from pathos import SSH_Launcher


if __name__ == '__main__':
   #import journal

    # test command and remote host
    command1 = 'echo "hello from..."'
    command2 = 'hostname'
   #command3 = 'sleep 5' #XXX: buggy?
   #command3 = ''  #XXX: buggy ?
    rhost = 'localhost'
   #rhost = 'computer.cacr.caltech.edu'
   #rhost = 'foobar.danse.us'

    launcher = SSH_Launcher('LauncherSSH')
   #journal.debug('LauncherSSH').activate()
    launcher(command=command1, rhost=rhost, background=False)
    launcher.launch()
    print launcher.response()
    launcher(command=command2, rhost=rhost, background=False)
    launcher.launch()
    print launcher.response()
   #launcher(command=command3, rhost=rhost, background=False)
   #launcher.launch()
   #print launcher.response()


# End of file
Exemple #2
0
    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s %s:%s}' % (source0,cpu1,dest0)
    copier(source=source0, destination=cpu1+':'+dest0)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s:%s %s:%s}' % (cpu1,source1,cpu2,dest1)
    copier(source=cpu1+':'+source1, destination=cpu2+':'+dest1)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s:%s %s}' % (cpu2,source2,dest2)
    copier(source=cpu2+':'+source2, destination=dest2)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'cleanup temporary files...'
    import os
    os.remove(source0)

    launcher = SSH_Launcher('cleanup')
    launcher(command=del1, rhost=cpu1, background=True)
    launcher.launch()
    launcher(command=del2, rhost=cpu2, background=True)
    launcher.launch()

#   print 'cleanup result file...'
#   os.remove("."+os.sep+os.path.basename(source2))

# End of file 
Exemple #3
0
    sleep(1)  #FIXME: needs time to work...
    print 'executing {scp %s %s:%s}' % (source0, cpu1, dest0)
    copier(source=source0, destination=cpu1 + ':' + dest0)
    copier.launch()

    sleep(1)  #FIXME: needs time to work...
    print 'executing {scp %s:%s %s:%s}' % (cpu1, source1, cpu2, dest1)
    copier(source=cpu1 + ':' + source1, destination=cpu2 + ':' + dest1)
    copier.launch()

    sleep(1)  #FIXME: needs time to work...
    print 'executing {scp %s:%s %s}' % (cpu2, source2, dest2)
    copier(source=cpu2 + ':' + source2, destination=dest2)
    copier.launch()

    sleep(1)  #FIXME: needs time to work...
    print 'cleanup temporary files...'
    import os
    os.remove(source0)

    launcher = SSH_Launcher('cleanup')
    launcher(command=del1, rhost=cpu1, background=True)
    launcher.launch()
    launcher(command=del2, rhost=cpu2, background=True)
    launcher.launch()

#   print 'cleanup result file...'
#   os.remove("."+os.sep+os.path.basename(source2))

# End of file
from pathos import SSH_Launcher


if __name__ == '__main__':
   #import journal

    # test command and remote host
    command1 = 'echo "hello from..."'
    command2 = 'hostname'
   #command3 = 'sleep 5' #XXX: buggy?
   #command3 = ''  #XXX: buggy ?
    rhost = 'localhost'
   #rhost = 'computer.cacr.caltech.edu'
   #rhost = 'foobar.danse.us'

    launcher = SSH_Launcher('LauncherSSH')
   #journal.debug('LauncherSSH').activate()
    launcher.stage(command=command1, rhost=rhost, fgbg='background')
    launcher.launch()
    print launcher.response()
    launcher.stage(command=command2, rhost=rhost, fgbg='background')
    launcher.launch()
    print launcher.response()
   #launcher.stage(command=command3, rhost=rhost, fgbg='foreground')
   #launcher.launch()
   #print launcher.response()


# End of file
    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s %s:%s}' % (source0,cpu1,dest0)
    copier.stage(source=source0, destination=cpu1+':'+dest0)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s:%s %s:%s}' % (cpu1,source1,cpu2,dest1)
    copier.stage(source=cpu1+':'+source1, destination=cpu2+':'+dest1)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'executing {scp %s:%s %s}' % (cpu2,source2,dest2)
    copier.stage(source=cpu2+':'+source2, destination=dest2)
    copier.launch()

    sleep(1) #FIXME: needs time to work...
    print 'cleanup temporary files...'
    import os
    os.remove(source0)

    launcher = SSH_Launcher('cleanup')
    launcher.stage(command=del1, rhost=cpu1, fgbg='bg')
    launcher.launch()
    launcher.stage(command=del2, rhost=cpu2, fgbg='bg')
    launcher.launch()

#   print 'cleanup result file...'
#   os.remove("."+os.sep+os.path.basename(source2))

# End of file