class_docstr: Parallel Python SMP execution server class
      
class_docstr_tok: ["Parallel","Python","SMP","execution","server","class"]
docstr: Conects to a remote ppserver specified by host and port
docstr_tok: ["Conects","to","a","remote","ppserver","specified","by","host","and","port"]
code: def connect1(self, host, port, persistent=True):
      """Conects to a remote ppserver specified by host and port"""
      hostid = host + ":" + str(port)
      lock = self.__connect_locks.setdefault(hostid, threading.Lock())
      lock.acquire()
      try:
          if hostid in self.autopp_list:
              return
          # open('/tmp/pp.debug', 'a+').write('_RWorker(STAT)\n')
          rworker = _RWorker(
              host,
              port,
              self.secret,
              self,
              "STAT",
              persistent,
              self.socket_timeout,
          )
          ncpus = int(rworker.receive())
          # open('/tmp/pp.debug', 'a+').write('_RWorker: %s\n' % ncpus)
          self.__stats[hostid] = _Statistics(ncpus, rworker)
  
          for x in range(ncpus):
              # open('/tmp/pp.debug', 'a+').write('_RWorker(EXEC)\n')
              rworker = _RWorker(
                  host,
                  port,
                  self.secret,
                  self,
                  "EXEC",
                  persistent,
                  self.socket_timeout,
              )
              self.__update_active_rworkers(rworker.id, 1)
              # append is atomic - no need to lock self.__rworkers
              self.__rworkers.append(rworker)
          # creating reserved rworkers
          for x in range(ncpus):
              # open('/tmp/pp.debug', 'a+').write('_RWorker(EXEC)_\n')
              rworker = _RWorker(
                  host,
                  port,
                  self.secret,
                  self,
                  "EXEC",
                  persistent,
                  self.socket_timeout,
              )
              self.__update_active_rworkers(rworker.id, 1)
              self.__rworkers_reserved.append(rworker)
          self.logger.debug(
              "Connected to ppserver (host=%s, port=%i) \
                      with %i workers"
              % (host, port, ncpus)
          )
          # open('/tmp/pp.debug', 'a+').write('_RWorker(sched)\n')
          self.__scheduler()
      except:
          if SHOW_EXPECTED_EXCEPTIONS:
              self.logger.debug(
                  "Exception in connect1 method (possibly expected)",
                  exc_info=True,
              )
      finally:
          lock.release()
  
imports: import os
  import threading
  import logging
  import inspect
  import sys
  import types
  import time
  import atexit
  from .None import transport
  from .None import auto
  from .None import common
  import subprocess
label_desc: Use image node_id 10 for calling the Server obj's underlying member method code with example usage: obj.connect1(host, port, persistent) without return types