code: def terminate_manager(self):
          
  
          try:
  
              if self._tmgr_process:
  
                  if not self._tmgr_terminate.is_set():
                      self._tmgr_terminate.set()
  
                  if self.check_manager():
                      self._tmgr_process.join()
  
                  self._tmgr_process = None
                  self._logger.info('Task manager process closed')
  
                  self._prof.prof('tmgr process terminated', uid=self._uid)
  
          except Exception, ex:
              self._logger.exception('Could not terminate task manager process')
              raise
docs: **Purpose**: Method to terminate the tmgr process. This method is 
          blocking as it waits for the tmgr process to terminate (aka join).