当前位置: 首页>>代码示例>>Python>>正文


Python GLOBAL_WM.stopWorkers方法代码示例

本文整理汇总了Python中ilastik.core.jobMachine.GLOBAL_WM.stopWorkers方法的典型用法代码示例。如果您正苦于以下问题:Python GLOBAL_WM.stopWorkers方法的具体用法?Python GLOBAL_WM.stopWorkers怎么用?Python GLOBAL_WM.stopWorkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilastik.core.jobMachine.GLOBAL_WM的用法示例。


在下文中一共展示了GLOBAL_WM.stopWorkers方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDownClass

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
 def tearDownClass(cls):
     try:
         from ilastik.core.jobMachine import GLOBAL_WM
         GLOBAL_WM.stopWorkers()
     except:
         pass
     cls.notify_pub_socket.close()
开发者ID:refack,项目名称:CellProfiler,代码行数:9,代码来源:test_analysisworker.py

示例2: finalize

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
 def finalize(self, result):
     try:
         if self.temp_images is not None:
             import shutil
             shutil.rmtree(self.temp_images)
         if self.temp_exampleimages is not None:
             import shutil
             shutil.rmtree(self.temp_exampleimages)
     except:
         pass
     from cellprofiler.utilities.cpjvm import cp_stop_vm
     try:
         import wx
         app = wx.GetApp()
         if app is not None:
             app.ExitMainLoop()
             app.MainLoop()
         cp_stop_vm(kill=False)
     except:
         logging.root.warn("Failed to shut down AWT", exc_info=1)
     try:
         from ilastik.core.jobMachine import GLOBAL_WM
         GLOBAL_WM.stopWorkers()
     except:
         logging.root.warn("Failed to stop Ilastik")
     try:
         from cellprofiler.utilities.zmqrequest import join_to_the_boundary
         join_to_the_boundary()
     except:
         logging.root.warn("Failed to stop zmq boundary")
开发者ID:LeeKamentsky,项目名称:CellProfiler,代码行数:32,代码来源:cpnose.py

示例3: finalize

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
 def finalize(self, result):
     try:
         javabridge.deactivate_awt()
         import imagej.imagej2
         if imagej.imagej2.the_imagej_context is not None:
             script = """
             new java.lang.Runnable () {
               run: function() {
                 ctx.getContext().dispose();
               }
             }"""
             runnable = javabridge.run_script(
                 script, dict(ctx=imagej.imagej2.the_imagej_context))
             javabridge.execute_runnable_in_main_thread(runnable, True)
             imagej.imagej2.the_imagej_context = None
             javabridge.static_call("java/lang/System", "gc", "()V")
     except:
         pass
     try:
         from ilastik.core.jobMachine import GLOBAL_WM
         GLOBAL_WM.stopWorkers()
     except:
         logging.root.warn("Failed to stop Ilastik")
     try:
         from cellprofiler.utilities.zmqrequest import join_to_the_boundary
         join_to_the_boundary()
     except:
         logging.root.warn("Failed to stop zmq boundary")
开发者ID:Bambirez,项目名称:CellProfiler,代码行数:30,代码来源:cpnose.py

示例4: teardown_package

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def teardown_package():
    '''Shut down the Ilastik threads if they are up'''
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
        
    except:
        pass
开发者ID:Amjadhpc,项目名称:CellProfiler,代码行数:10,代码来源:__init__.py

示例5: main

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def main():
    #
    # For Windows build with Ilastik, look for site-packages
    # in order to find Ilastik sources.
    #
    if hasattr(sys, 'frozen') and sys.platform == "win32":
        root = os.path.split(sys.argv[0])[0]
        if len(root) == 0:
            root = os.curdir
        root = os.path.abspath(root)
        site_packages = os.path.join(root, 'site-packages').encode('utf-8')
        if os.path.exists(site_packages) and os.path.isdir(site_packages):
            import site
            site.addsitedir(site_packages)
    #
    # For OS/X set up the UI elements that users expect from
    # an app.
    #
    if sys.platform == "darwin":
        from cellprofiler.icons import get_builtin_images_path
        
        icon_path = os.path.join(get_builtin_images_path(), "CellProfilerIcon.png")
        os.environ["APP_NAME_%d" % os.getpid()] = "CellProfilerWorker"
        os.environ["APP_ICON_%d" % os.getpid()] = icon_path
        J.javabridge.mac_run_loop_init()
    
    # Importing bioformats starts the JVM
    import bioformats
    # Start the deadman switch thread.
    start_daemon_thread(target=exit_on_stdin_close, 
                        name="exit_on_stdin_close")
    with stdin_monitor_lock:
        while not stdin_monitor_started:
            stdin_monitor_cv.wait()
        
    with AnalysisWorker(work_announce_address) as worker:
        worker_thread = threading.Thread(target = worker.run, 
                                         name="WorkerThread")
        worker_thread.setDaemon(True)
        worker_thread.start()
        print "Entering run loop"
        enter_run_loop()
        print "Exiting run loop"
        worker_thread.join()
            
    #
    # Shutdown - need to handle some global cleanup here
    #
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        logger.warn("Failed to stop Ilastik")
    try:
        J.kill_vm()
    except:
        logger.warn("Failed to stop the Java VM")
开发者ID:akki201,项目名称:CellProfiler,代码行数:59,代码来源:analysis_worker.py

示例6: shutdown_cellprofiler

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def shutdown_cellprofiler():
    '''Oh sadness and so many threads that won't die...
    
    '''
    try:
        import javabridge
        javabridge.kill_vm()
    except:
        pass
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        pass
开发者ID:AnneCarpenter,项目名称:BatchProfiler,代码行数:16,代码来源:bputilities.py

示例7: stop_cellprofiler

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def stop_cellprofiler():
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        logging.root.warn("Failed to stop Ilastik")
    try:
        from cellprofiler.utilities.zmqrequest import join_to_the_boundary
        join_to_the_boundary()
    except:
        logging.root.warn("Failed to stop zmq boundary", exc_info=1)
    try:
        from cellprofiler.utilities.cpjvm import cp_stop_vm
        cp_stop_vm()
    except:
        logging.root.warn("Failed to stop the JVM", exc_info=1)
开发者ID:AnneCarpenter,项目名称:CellProfiler,代码行数:18,代码来源:__main__.py

示例8: main

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def main():
    # XXX - move all this to a class
    
    #
    # For OS/X set up the UI elements that users expect from
    # an app.
    #
    if sys.platform == "darwin":
        from cellprofiler.icons import get_builtin_images_path
        
        icon_path = os.path.join(get_builtin_images_path(), "CellProfilerIcon.png")
        os.environ["APP_NAME_%d" % os.getpid()] = "CellProfilerWorker"
        os.environ["APP_ICON_%d" % os.getpid()] = icon_path
        J.javabridge.mac_run_loop_init()
    
    # Importing bioformats starts the JVM
    import bioformats
    # Start the deadman switch thread.
    start_daemon_thread(target=exit_on_stdin_close, 
                        name="exit_on_stdin_close")
    with stdin_monitor_lock:
        while not stdin_monitor_started:
            stdin_monitor_cv.wait()
        
    with AnalysisWorker(work_announce_address) as worker:
        worker_thread = threading.Thread(target = worker.run, 
                                         name="WorkerThread")
        worker_thread.setDaemon(True)
        worker_thread.start()
        print "Entering run loop"
        enter_run_loop()
        print "Exiting run loop"
        worker_thread.join()
            
    #
    # Shutdown - need to handle some global cleanup here
    #
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        logger.warn("Failed to stop Ilastik")
    try:
        J.kill_vm()
    except:
        logger.warn("Failed to stop the Java VM")
开发者ID:aplassard,项目名称:CellProfiler,代码行数:48,代码来源:analysis_worker.py

示例9: main

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def main():
    # XXX - move all this to a class
    parser = optparse.OptionParser()
    parser.add_option("--work-announce",
                      dest="work_announce_address",
                      help="ZMQ port where work announcements are published",
                      default=None)
    parser.add_option("--log-level",
                      dest="log_level",
                      help="Logging level for logger: DEBUG, INFO, WARNING, ERROR",
                      default=logging.INFO)
    options, args = parser.parse_args()
    logging.root.setLevel(options.log_level)

    if not options.work_announce_address:
        parser.print_help()
        sys.exit(1)
    # Start the deadman switch thread.
    notify_started_cv = threading.Condition()
    start_daemon_thread(target=exit_on_stdin_close, 
                        name="exit_on_stdin_close",
                        args = (notify_started_cv, ))
    with notify_started_cv:
        notify_started_cv.wait()

    try:
        with AnalysisWorker(options.work_announce_address) as worker:
            worker.run()
    except CancelledException:
        logger.debug("Exiting after cancellation")
    finally:
        #
        # Shutdown - need to handle some global cleanup here
        #
        try:
            from ilastik.core.jobMachine import GLOBAL_WM
            GLOBAL_WM.stopWorkers()
        except:
            logger.warn("Failed to stop Ilastik")
        try:
            J.kill_vm()
        except:
            logger.warn("Failed to stop the Java VM")
开发者ID:JDWarner,项目名称:CellProfiler,代码行数:45,代码来源:analysis_worker.py

示例10: main

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def main():
    #
    # For Windows build with Ilastik, look for site-packages
    # in order to find Ilastik sources.
    #
    if hasattr(sys, 'frozen') and sys.platform == "win32":
        root = os.path.split(sys.argv[0])[0]
        if len(root) == 0:
            root = os.curdir
        root = os.path.abspath(root)
        site_packages = os.path.join(root, 'site-packages').encode('utf-8')
        if os.path.exists(site_packages) and os.path.isdir(site_packages):
            import site
            site.addsitedir(site_packages)
    #
    # For OS/X set up the UI elements that users expect from
    # an app.
    #
    if sys.platform == "darwin":
        from cellprofiler.icons import get_builtin_images_path
        
        icon_path = os.path.join(get_builtin_images_path(), "CellProfilerIcon.png")
        os.environ["APP_NAME_%d" % os.getpid()] = "CellProfilerWorker"
        os.environ["APP_ICON_%d" % os.getpid()] = icon_path
    
    # Start the JVM
    from cellprofiler.utilities.cpjvm import cp_start_vm
    cp_start_vm()
    
    deadman_start_socket = the_zmq_context.socket(zmq.PAIR)
    deadman_start_socket.bind(DEADMAN_START_ADDR)
    
    # Start the deadman switch thread.
    start_daemon_thread(target=exit_on_stdin_close, 
                        name="exit_on_stdin_close")
    deadman_start_socket.recv()
    deadman_start_socket.close()
    
    from cellprofiler.knime_bridge import KnimeBridgeServer
    with AnalysisWorker(work_announce_address) as worker:
        worker_thread = threading.Thread(target = worker.run, 
                                         name="WorkerThread")
        worker_thread.setDaemon(True)
        worker_thread.start()
        with KnimeBridgeServer(the_zmq_context,
                               knime_bridge_address,
                               NOTIFY_ADDR, NOTIFY_STOP):
            enter_run_loop()
            worker_thread.join()
            
    #
    # Shutdown - need to handle some global cleanup here
    #
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        logger.warn("Failed to stop Ilastik")
    try:
        from imagej.imagej2 import allow_quit
        allow_quit()
    except:
        logger.warn("Failed to signal ImageJ to stop")
    try:
        J.kill_vm()
    except:
        logger.warn("Failed to stop the Java VM")
开发者ID:jiashunzheng,项目名称:CellProfiler,代码行数:69,代码来源:analysis_worker.py

示例11: run_pipeline_headless

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
            if options.run_pipeline:
                App.frame.pipeline_controller.do_analyze_images()
            App.MainLoop()
            return
        
        elif options.run_pipeline:
            run_pipeline_headless(options, args)
    except Exception, e:
        logging.root.fatal("Uncaught exception in CellProfiler.py", exc_info=True)
        raise
    
    finally:
        if __name__ == "__main__":
            try:
                from ilastik.core.jobMachine import GLOBAL_WM
                GLOBAL_WM.stopWorkers()
            except:
                logging.root.warn("Failed to stop Ilastik")
            try:
                from cellprofiler.utilities.zmqrequest import join_to_the_boundary
                join_to_the_boundary()
            except:
                logging.root.warn("Failed to stop zmq boundary")
            try:
                from cellprofiler.utilities.jutil import kill_vm
                kill_vm()
            except:
                logging.root.warn("Failed to stop the JVM")
            os._exit(0)

def parse_args(args):
开发者ID:nathanlazar,项目名称:CellProfiler,代码行数:33,代码来源:CellProfiler.py

示例12: main

# 需要导入模块: from ilastik.core.jobMachine import GLOBAL_WM [as 别名]
# 或者: from ilastik.core.jobMachine.GLOBAL_WM import stopWorkers [as 别名]
def main():
    # XXX - move all this to a class
    parser = optparse.OptionParser()
    parser.add_option("--work-announce",
                      dest="work_announce_address",
                      help="ZMQ port where work announcements are published",
                      default=None)
    parser.add_option("--log-level",
                      dest="log_level",
                      help="Logging level for logger: DEBUG, INFO, WARNING, ERROR",
                      default=logging.INFO)
    options, args = parser.parse_args()
    logging.root.setLevel(options.log_level)

    if not options.work_announce_address:
        parser.print_help()
        sys.exit(1)
    #
    # For OS/X set up the UI elements that users expect from
    # an app.
    #
    if sys.platform == "darwin":
        from cellprofiler.icons import get_builtin_images_path
        
        icon_path = os.path.join(get_builtin_images_path(), "CellProfilerIcon.png")
        os.environ["APP_NAME_%d" % os.getpid()] = "CellProfilerWorker"
        os.environ["APP_ICON_%d" % os.getpid()] = icon_path
        J.javabridge.mac_run_loop_init()
     
    # Importing bioformats starts the JVM
    import bioformats
    
    # Start the deadman switch thread.
    start_daemon_thread(target=exit_on_stdin_close, 
                        name="exit_on_stdin_close")
    with stdin_monitor_lock:
        while not stdin_monitor_started:
            stdin_monitor_cv.wait()
        
    with AnalysisWorker(options.work_announce_address) as worker:
        worker_thread = threading.Thread(target = worker.run, 
                                         name="WorkerThread")
        worker_thread.setDaemon(True)
        worker_thread.start()
        print "Entering run loop"
        enter_run_loop()
        print "Exiting run loop"
        worker_thread.join()
            
    #
    # Shutdown - need to handle some global cleanup here
    #
    try:
        from ilastik.core.jobMachine import GLOBAL_WM
        GLOBAL_WM.stopWorkers()
    except:
        logger.warn("Failed to stop Ilastik")
    try:
        J.kill_vm()
    except:
        logger.warn("Failed to stop the Java VM")
开发者ID:crschmidt,项目名称:CellProfiler,代码行数:63,代码来源:analysis_worker.py


注:本文中的ilastik.core.jobMachine.GLOBAL_WM.stopWorkers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。