def step_impl(context, source, destination, name): source = path.join(context.temp_directory, source) destination = path.join(context.temp_directory, destination) context.results[name] = remote_copy(RemoteConfiguration(host=u'localhost'), source, destination, sys.stdout)
def step_impl(context, command, name): logfile = _get_logfile(context) remote = RemoteConfiguration(host=u'localhost') c = RemoteRun(context.reactor, remote, command, logfile=logfile) def _on_exit(run): context.results[name] = c.result c.register_exit_monitor(_on_exit) context.executions[name] = c
def step_impl(context, source, destination, name): source = path.join(context.temp_directory, source) destination = path.join(context.temp_directory, destination) c = RemoteCopy(context.reactor, RemoteConfiguration(host=u'localhost'), source, destination, sys.stdout) def _on_exit(run): context.results[name] = c.result c.register_exit_monitor(_on_exit) context.executions[name] = c
def step_impl(context, execution, name): remote = RemoteConfiguration(host=u'localhost') context.results[name] = remote_run(remote, execution, sys.stdout)
import logging from yassh import Reactor, RemoteRun, RemoteConfiguration, LocalRun logging.basicConfig(level=logging.DEBUG) r = Reactor() remote = RemoteConfiguration(host='localhost', username='******') c1 = RemoteRun(r, remote, 'sleep 5') c2 = LocalRun(r, 'echo ok') c3 = RemoteRun(r, remote, 'echo "finished" && sleep 1') def start_c2(): # Start cmd2 when cmd1 complete c2.start() c1.register_exit_monitor(start_c2) def start_c3(): # Start cmd3 when cmd2 complete c3.start() c2.register_monitor(u'ok', start_c3) def on_c3_finished(): # Print dummy message when c3 is near terminaison print('c3 almost finished')
def step_impl(context, host, user, port): context.remote = RemoteConfiguration(host=host, username=user, port=port)