def HandleMessage(self, message):
    """Entry point for processing jobs.

    Args:
        message: The GrrMessage that was delivered from the server.
    """
    self._is_active = True
    try:
      # Try to retrieve a suspended action from the client worker.
      try:
        suspended_action_id = message.payload.iterator.suspended_action
        action = self.suspended_actions[suspended_action_id]

      except (AttributeError, KeyError):
        # Otherwise make a new action instance.
        action_cls = actions.ActionPlugin.classes.get(message.name)
        if action_cls is None:
          raise RuntimeError("Client action %r not known" % message.name)

        action = action_cls(grr_worker=self)

      # Write the message to the transaction log.
      self.nanny_controller.WriteTransactionLog(message)

      # Heartbeat so we have the full period to work on this message.
      action.Progress()
      action.Execute(message)

      # If we get here without exception, we can remove the transaction.
      self.nanny_controller.CleanTransactionLog()
    finally:
      self._is_active = False
      # We want to send ClientStats when client action is complete.
      self._send_stats_on_check = True
dataset/ETHPy150Open google/grr/grr/client/comms.py/GRRClientWorker.HandleMessage/original