def run_plasm(options, plasm, locals={}): ''' Run the plasm given the options from the command line parser. :param options: The command line, preparsed options object. It is assumed that you have filled this object using scheduler_options. :param plasm: The plasm to run. :param locals: Any local variables that you would like available to the iPython shell session. ''' global possible_schedulers if options.scheduler_type not in possible_schedulers: msg = "You must supply a valid scheduler type, not \'%s\'\n" % options.scheduler_type msg += 'Valid schedulers are:\n\t' + '\n\t'.join(possible_schedulers) + '\n' raise RuntimeError(msg) if options.graphviz: ecto.view_plasm(plasm) if len(options.dotfile) > 0: print >> open(options.dotfile, 'wt'), plasm.viz() if len(options.logfile) > 0: ecto.log_to_file(options.logfile) if options.gui: from ecto.gui import gui_execute gui_execute(plasm) else: sched = ecto.schedulers.__dict__[options.scheduler_type](plasm) if options.ipython: use_ipython(options, sched, plasm, locals) else: sched.execute(options.niter, options.nthreads) if options.stats: print sched.stats()
def test_parameter_callbacks(): generate = ecto_test.Generate() param_watcher = ecto_test.ParameterWatcher(value=2) sleep = ecto_test.Sleep(seconds=0.2) printer = ecto_test.Printer() plasm = ecto.Plasm() plasm.connect(generate["out"] >> param_watcher["input"], param_watcher['output'] >> printer[:] ) plasm.insert(sleep) return gui_execute(plasm)
def run_plasm(options, plasm, locals={}): ''' Run the plasm given the options from the command line parser. :param options: The command line, preparsed options object. It is assumed that you have filled this object using scheduler_options. :param plasm: The plasm to run. :param locals: Any local variables that you would like available to the iPython shell session. ''' if options.graphviz: ecto.view_plasm(plasm) if len(options.dotfile) > 0: print >> open(options.dotfile, 'wt'), plasm.viz() if len(options.logfile) > 0: ecto.log_to_file(options.logfile) if options.gui: from ecto.gui import gui_execute gui_execute(plasm) else: sched = ecto.Scheduler(plasm) if options.ipython: use_ipython(options, sched, plasm, locals) else: sched.execute(options.niter) if options.stats: print sched.stats()
def run_plasm(options, plasm, locals={}): ''' Run the plasm given the options from the command line parser. :param options: The command line, preparsed options object. It is assumed that you have filled this object using scheduler_options. :param plasm: The plasm to run. :param locals: Any local variables that you would like available to the iPython shell session. ''' tail_shell = None if options.devel: options.graphviz = True options.stats = True options.logfile = '/tmp/ecto.log' options.ipython = True if options.graphviz: ecto.view_plasm(plasm) if len(options.dotfile) > 0: print >> open(options.dotfile, 'wt'), plasm.viz() if len(options.logfile) > 0: ecto.log_to_file(options.logfile) if options.devel: command = "/usr/bin/uxterm -T /tmp/ecto.log -e tail -f %s" % options.logfile print 'opening devel shell: %s' % command tail_shell = subprocess.Popen(command, shell=True) if options.gui: from ecto.gui import gui_execute gui_execute(plasm) else: sched = ecto.Scheduler(plasm) if options.ipython: use_ipython(options, sched, plasm, locals) else: sched.execute(options.niter) if options.stats: print sched.stats()