Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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")
Exemplo n.º 4
0
def stop_cellprofiler():
    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)
Exemplo n.º 5
0
def stop_cellprofiler():
    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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
 def tearDownClass(cls):
     Z.join_to_the_boundary()
     cls.zmq_context.term()
     if cls.old_hostname is not None:
         os.environ['HOSTNAME'] = cls.old_hostname
Exemplo n.º 9
0
        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):
    '''Parse the CellProfiler command-line arguments'''
    import optparse
    usage = """usage: %prog [options] [<output-file>])
         where <output-file> is the optional filename for the output file of 
               measurements when running headless. 
Exemplo n.º 10
0
 def tearDownClass(cls):
     Z.join_to_the_boundary()
     cls.zmq_context.term()
Exemplo n.º 11
0
 def tearDownClass(cls):
     Z.join_to_the_boundary()
     cls.zmq_context.term()
Exemplo n.º 12
0
 def tearDownClass(cls):
     Z.join_to_the_boundary()
     cls.zmq_context.term()
     if cls.old_hostname is not None:
         os.environ['HOSTNAME'] = cls.old_hostname