예제 #1
0
def main():
    print('foo')
    profile = False
    if len(sys.argv) > 1 and sys.argv[1] == '-p':
        print('profiling')
        profile = True
        from PYME.mProfile import mProfile
        mProfile.profileOn(
            ['taskServerMP.py', 'HDFTaskQueue.py', 'TaskQueue.py'])

    Pyro.config.PYRO_MOBILE_CODE = 0
    Pyro.core.initServer()
    ns = Pyro.naming.NameServerLocator().getNS()
    daemon = Pyro.core.Daemon()
    daemon.useNameServer(ns)  # useNameServer!

    #check to see if we've got the TaskQueues group
    if not 'TaskQueues' in [n[0] for n in ns.list('')]:
        ns.createGroup('TaskQueues')

    #get rid of any previous queue
    try:
        ns.unregister(taskQueueName)
    except Pyro.errors.NamingError:
        pass

    tq = TaskQueueSet()
    uri = daemon.connect(tq, taskQueueName)

    tw = TaskWatcher(tq)
    tw.start()
    try:
        print '> taskServer start ...'
        daemon.requestLoop(tq.isAlive)
    finally:
        daemon.shutdown(True)
        tw.alive = False

        if profile:
            mProfile.report()

        print '> taskServer shutdown'
예제 #2
0
def main():
    print('foo')
    profile = False
    if len(sys.argv) > 1 and sys.argv[1] == '-p':
        print('profiling')
        profile = True
        from PYME.mProfile import mProfile
        mProfile.profileOn(['taskServerMP.py', 'HDFTaskQueue.py', 'TaskQueue.py'])

    Pyro.config.PYRO_MOBILE_CODE = 0
    Pyro.core.initServer()
    ns=Pyro.naming.NameServerLocator().getNS()
    daemon=Pyro.core.Daemon()
    daemon.useNameServer(ns)        # useNameServer!

    #check to see if we've got the TaskQueues group
    if not 'TaskQueues' in [n[0] for n in ns.list('')]:
        ns.createGroup('TaskQueues')

    #get rid of any previous queue
    try:
        ns.unregister(taskQueueName)
    except Pyro.errors.NamingError:
        pass

    tq = TaskQueueSet()
    uri=daemon.connect(tq,taskQueueName)

    tw = TaskWatcher(tq)
    tw.start()
    try:
        print '> taskServer start ...'
        daemon.requestLoop(tq.isAlive)
    finally:
        daemon.shutdown(True)
        tw.alive = False
        
        if profile:
            mProfile.report()
        
        print '> taskServer shutdown'
예제 #3
0
class BoaApp(wx.App):
    def __init__(self, options, *args):
        self.options = options
        wx.App.__init__(self, *args)
        
        
    def OnInit(self):
        wx.InitAllImageHandlers()
        self.main = acquiremainframe.create(None, self.options)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True


def main():
    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option("-i", "--init-file", dest="initFile", help="Read initialisation from file [defaults to init.py]", metavar="FILE")
        
    (options, args) = parser.parse_args()
    
    application = BoaApp(options, 0)
    application.MainLoop()

if __name__ == '__main__':
    from PYME import mProfile
    mProfile.profileOn(['previewacquisator.py'])
    main()
    mProfile.report()
예제 #4
0
    def OnInit(self):
        wx.InitAllImageHandlers()
        self.main = acquiremainframe.create(None, self.options)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True


def main():
    from optparse import OptionParser

    parser = OptionParser()
    parser.add_option(
        "-i",
        "--init-file",
        dest="initFile",
        help="Read initialisation from file [defaults to init.py]",
        metavar="FILE")

    (options, args) = parser.parse_args()

    application = BoaApp(options, 0)
    application.MainLoop()


if __name__ == '__main__':
    from PYME import mProfile
    mProfile.profileOn(['previewacquisator.py'])
    main()
    mProfile.report()