parameters: (self)
docstring: The idea is to get the list of all processes by the current user, check which one of them is using the port.
          If there is such a process, let's wait for 10 seconds for it to start serving, if it doesn't, kill it.
          
          If there is NO such process, let's see if there is a process with the same name as us but with a lower process id. 
          We shall wait for 10 seconds for it to start, if it doesn't, kill it.
          
          If we are the process with the same name as ours and with the lowest process id, let's start serving and kill everyone else.
docstring_summary: The idea is to get the list of all processes by the current user, check which one of them is using the port.
          If there is such a process, let's wait for 10 seconds for it to start serving, if it doesn't, kill it.
          
          If there is NO such process, let's see if there is a process with the same name as us but with a lower process id. 
          We shall wait for 10 seconds for it to start, if it doesn't, kill it.
          
          If we are the process with the same name as ours and with the lowest process id, let's start serving and kill everyone else.
docstring_tokens: The idea is to get the list of all processes by the current user check which one of them is using the port . If there is such a process let s wait for 10 seconds for it to start serving if it doesn t kill it . If there is NO such process let s see if there is a process with the same name as us but with a lower process id . We shall wait for 10 seconds for it to start if it doesn t kill it . If we are the process with the same name as ours and with the lowest process id let s start serving and kill everyone else .
function: def kill_siblings(self):
          """
          The idea is to get the list of all processes by the current user, check which one of them is using the port.
          If there is such a process, let's wait for 10 seconds for it to start serving, if it doesn't, kill it.
          
          If there is NO such process, let's see if there is a process with the same name as us but with a lower process id. 
          We shall wait for 10 seconds for it to start, if it doesn't, kill it.
          
          If we are the process with the same name as ours and with the lowest process id, let's start serving and kill everyone else. 
          """
  
          if self.wait_for_server():
              self.__allow_serving = False
              logging.debug("There is a server that is currently serving on our port... Disallowing to start a new one")
              return
          
          logging.debug("There are no servers that are currently serving. Will try to kill our siblings.")
          
          
          sibs = self.siblings()
          
          for sibling in sibs:
              logging.debug("Checking whether we should kill sibling id: {}".format(sibling))
              
              self.give_process_time_to_kill_port_user()
              
              if self.wait_for_server():
                  serving_pid = self.serving_process_id()
                  if serving_pid:
                      logging.debug("There is a serving sibling with process id: {}".format(serving_pid))
                      self.kill(pids=map(lambda x: x != serving_pid, sibs))
                      self.__allow_serving = False
                      return
              else:
                  self.kill(pid=sibling)
                  
          self.kill_process_on_port()
function_tokens: def kill_siblings ( self ) : if self . wait_for_server ( ) : self . __allow_serving = False logging . debug ( "There is a server that is currently serving on our port... Disallowing to start a new one" ) return logging . debug ( "There are no servers that are currently serving. Will try to kill our siblings." ) sibs = self . siblings ( ) for sibling in sibs : logging . debug ( "Checking whether we should kill sibling id: {}" . format ( sibling ) ) self . give_process_time_to_kill_port_user ( ) if self . wait_for_server ( ) : serving_pid = self . serving_process_id ( ) if serving_pid : logging . debug ( "There is a serving sibling with process id: {}" . format ( serving_pid ) ) self . kill ( pids = map ( lambda x : x != serving_pid , sibs ) ) self . __allow_serving = False return else : self . kill ( pid = sibling ) self . kill_process_on_port ( )