def lock(self, source_node):
        """Lock the task, source is the :class:`Node` that applies the lock."""
        if self.status != self.S_INIT:
            raise ValueError("Trying to lock a task with status %s" % self.status)

        self._status = self.S_LOCKED
        self.history.info("Locked by node %s", source_node)