    def poll(self, current_time, timeout) -> bool:
        """Given the current time, check whether
        the task is running, finished or timed out.

        Parameters
        ----------
        current_time : int
            Current timestamp
        timeout : int
            Timeout time

        Returns
        -------
        bool
            Whether the task is finished
        """
        if self.is_running() is False:
            return False
        # handle timeout job
        step = current_time - self._timestamp
        if step > timeout:
            self._proc.kill()
            self._finished = True
            self._is_timeout = True
            self._failed = True
            return True
        # handle finished job
        if self._proc.poll() is not None:
            self._finished = True
        return self._finished
Given the current time, check whether
the task is running, finished or timed out.

Parameters
----------
current_time : int
Current timestamp
timeout : int
Timeout time

Returns
-------
bool
Whether the task is finished
python/aitemplate/backend/task_runner.py