def __init__(self, hunt_obj, runner_args=None, token=None):
    """Constructor for the Hunt Runner.

    Args:
      hunt_obj: The hunt object this runner will run states for.
      runner_args: A HuntRunnerArgs() instance containing initial values. If not
        specified, we use the runner_args from the hunt_obj.
      token: An instance of access_control.ACLToken security token.
    """
    self.token = token or hunt_obj.token

    self.queue_manager = queue_manager.QueueManager(token=self.token)

    self.outbound_lock = threading.Lock()
    self.hunt_obj = hunt_obj

    # Initialize from a new runner args proto.
    if runner_args is not None:
      self.runner_args = runner_args
      self.session_id = self.GetNewSessionID()
      self.hunt_obj.urn = self.session_id

      # Create a context.
      self.context = self.InitializeContext(runner_args)
      self.hunt_obj.context = self.context
      self.context.session_id = self.session_id

    else:
      # Retrieve args from the hunts object's context. The hunt object is
      # responsible for storing our context, although they do not generally
      # access it directly.
      self.context = self.hunt_obj.context

      self.runner_args = self.hunt_obj.runner_args

    # Populate the hunt object's urn with the session id.
    self.hunt_obj.urn = self.session_id = self.context.session_id
def __init__ ( self , hunt_obj , runner_args = None , token = None ) : self . token = token or hunt_obj . token self . queue_manager = queue_manager . QueueManager ( token = self . token ) self . outbound_lock = threading . Lock ( ) self . hunt_obj = hunt_obj if runner_args is not None : self . runner_args = runner_args self . session_id = self . GetNewSessionID ( ) self . hunt_obj . urn = self . session_id self . context = self . InitializeContext ( runner_args ) self . hunt_obj . context = self . context self . context . session_id = self . session_id else : self . context = self . hunt_obj . context self . runner_args = self . hunt_obj . runner_args self . hunt_obj . urn = self . session_id = self . context . session_id
Constructor for the Hunt Runner.

    Args:
      hunt_obj: The hunt object this runner will run states for.
      runner_args: A HuntRunnerArgs() instance containing initial values. If not
        specified, we use the runner_args from the hunt_obj.
      token: An instance of access_control.ACLToken security token.