當前位置: 首頁>>代碼示例>>Python>>正文


Python NuclideServer.get_processes方法代碼示例

本文整理匯總了Python中nuclide_server.NuclideServer.get_processes方法的典型用法代碼示例。如果您正苦於以下問題:Python NuclideServer.get_processes方法的具體用法?Python NuclideServer.get_processes怎麽用?Python NuclideServer.get_processes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nuclide_server.NuclideServer的用法示例。


在下文中一共展示了NuclideServer.get_processes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: cleanup

# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import get_processes [as 別名]
    def cleanup(self):
        self.logger.info('Starting to clean up old Nuclide processes/files.')
        # TODO: Remove it after migration is complete.
        # For migration, stop the forever monitor processes of Nuclide server.
        # This does not stop existing Nuclide server processes themselves.
        # It just removes the monitor so that we can kill them on upgrade.
        for proc in ProcessInfo.get_processes(
                getpass.getuser(), '%s.*%s' %
                (re.escape('forever/bin/monitor'), re.escape('nuclide-main.js'))):
            self.logger.info('Stopping forever monitor process: %s' % proc)
            proc.stop()

        # Clean up multiple Nuclide processes on same port.
        # There should be no more than one on a given port.
        # TODO: log the error to analytics db.
        # { port1 => [proc1, proc2, ...], ...}
        server_proc_map = defaultdict(list)
        # Group the processes by port.
        for proc in NuclideServer.get_processes():
            port = int(proc.get_command_param('port'))
            server_proc_map[port].append(proc)
        for port in server_proc_map:
            if len(server_proc_map[port]) > 1:
                self.logger.warning(
                    'Multiple Nuclide processes on port %d. Something wrong. Clean them up...' %
                    port)
                for proc in server_proc_map[port]:
                    proc.stop()

        self.cleanup_certificates(CERTS_EXPIRATION_DAYS)
        self.logger.info('Finished cleaning up old Nuclide processes/files.')
開發者ID:mahinko,項目名稱:nuclide,代碼行數:33,代碼來源:nuclide_server_manager.py

示例2: cleanup

# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import get_processes [as 別名]
    def cleanup(self):

        # TODO: Remove it after migration is complete.
        # For migration, stop the forever monitor processes of Nuclide server.
        # This does not stop existing Nuclide server processes themselves.
        # It just removes the monitor so that we can kill them on upgrade.
        for proc in ProcessInfo.get_processes(
            getpass.getuser(), "%s.*%s" % (re.escape("forever/bin/monitor"), re.escape("nuclide-main.js"))
        ):
            print("Stopping %s" % proc, file=sys.stderr)
            proc.stop()

        # Clean up multiple Nuclide processes on same port.
        # There should be no more than one on a given port.
        # TODO: log the error to analytics db.
        # { port1 => [proc1, proc2, ...], ...}
        server_proc_map = defaultdict(list)
        # Group the processes by port.
        for proc in NuclideServer.get_processes():
            port = int(proc.get_command_param("port"))
            server_proc_map[port].append(proc)
        for port in server_proc_map:
            if len(server_proc_map[port]) > 1:
                print(
                    "Multiple Nuclide processes on port %d. Something wrong. Clean them up..." % port, file=sys.stderr
                )
                for proc in server_proc_map[port]:
                    proc.stop()

        self.cleanup_certificates(CERTS_EXPIRATION_DAYS)
開發者ID:etcinit,項目名稱:nuclide,代碼行數:32,代碼來源:nuclide_server_manager.py

示例3: list_servers

# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import get_processes [as 別名]
 def list_servers(user=getpass.getuser(), port_filter=[]):
     servers = []
     for proc in NuclideServer.get_processes(user):
         port = int(proc.get_command_param('port'))
         if not port_filter or port in port_filter:
             server = NuclideServer(port, proc=proc)
             servers.append(server)
     return servers
開發者ID:mahinko,項目名稱:nuclide,代碼行數:10,代碼來源:nuclide_server_manager.py

示例4: cleanup

# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import get_processes [as 別名]
    def cleanup(self):
        self.logger.info("Starting to clean up old Nuclide processes/files.")
        # Clean up multiple Nuclide processes on same port.
        # There should be no more than one on a given port.
        # TODO: log the error to analytics db.
        # { port1 => [proc1, proc2, ...], ...}
        server_proc_map = defaultdict(list)
        # Group the processes by port.
        for proc in NuclideServer.get_processes():
            port = int(proc.get_command_param("port"))
            server_proc_map[port].append(proc)
        for port in server_proc_map:
            if len(server_proc_map[port]) > 1:
                self.logger.warning("Multiple Nuclide processes on port %d. Something wrong. Clean them up..." % port)
                for proc in server_proc_map[port]:
                    proc.stop()

        self.cleanup_certificates(CERTS_EXPIRATION_DAYS)
        self.logger.info("Finished cleaning up old Nuclide processes/files.")
開發者ID:PKRoma,項目名稱:nuclide,代碼行數:21,代碼來源:nuclide_server_manager.py


注:本文中的nuclide_server.NuclideServer.get_processes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。