Exemple #1
0
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)
    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()
Exemple #2
0
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)
    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()
Exemple #3
0
def make(Schedtype):
    plasm = ecto.Plasm()

    gen = ecto_test.Generate("Gen", step=1.0, start=0.0)

    printer = ecto_test.Printer("Printy")
    ecto.log_to_file(fname)
    plasm.connect(gen[:] >> printer[:])
    return Schedtype(plasm)
def make(Schedtype):
    print 'Using :', Schedtype
    plasm = ecto.Plasm()

    gen = ecto_test.Generate("Gen", step=1.0, start=0.0)

    printer = ecto_test.Printer("Printy")
    ecto.log_to_file(fname)
    plasm.connect(gen[:] >> printer[:])
    return Schedtype(plasm)
Exemple #5
0
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()
Exemple #6
0
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()
Exemple #7
0
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()
Exemple #8
0
#!/usr/bin/env python
import ecto, ecto_test, sys

plasm = ecto.Plasm()

gen = ecto_test.Generate("Gen", step=1.0, start=0.0)
inc = ecto_test.Increment("Increment 0", delay=100)
printer = ecto_test.Printer("Printy")

plasm.connect(gen[:] >> inc[:], inc[:] >> printer[:])

sched = ecto.schedulers.Threadpool(plasm)
ecto.log_to_file("ectolog.txt")
sched.execute_async(niter=100)

from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()
Exemple #9
0
#!/usr/bin/env python
import ecto, ecto_test, sys

plasm = ecto.Plasm()
 
gen = ecto_test.Generate("Gen", step=1.0, start=0.0)
inc = ecto_test.Increment("Increment 0", delay=100)
printer = ecto_test.Printer("Printy")
 
plasm.connect(gen[:] >> inc[:],
              inc[:] >> printer[:])
  
sched = ecto.schedulers.Threadpool(plasm)
ecto.log_to_file("ectolog.txt")
sched.execute_async(niter=100)
    
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()