def head(self, stream='stdout', num_lines=10):
        """ Head a specified stream (stdout or stderr) by num_lines. """
        target = self._map_string_to_file(stream)
        if not target:  # no current temp file
            last_run = self.backend.get_latest_run_log(self.parent_job.job_id,
                                                       self.name)
            if not last_run:
                return None
            return self._head_string(last_run['tasks'][self.name][stream],
                                     num_lines)
        else:
            return self._head_temp_file(target, num_lines)
def head ( self , stream = 'stdout' , num_lines = 10 ) : target = self . _map_string_to_file ( stream ) if not target : last_run = self . backend . get_latest_run_log ( self . parent_job . job_id , self . name ) if not last_run : return None return self . _head_string ( last_run [ 'tasks' ] [ self . name ] [ stream ] , num_lines ) else : return self . _head_temp_file ( target , num_lines )
Head a specified stream (stdout or stderr) by num_lines.