code: def poll_logs(
      project: ProjectModel,
      request: PollLogsRequest,
  ) -> JobSubmissionLogs:
      if request.diagnose:
          log_file_path = _get_runner_log_file_path(
              project_name=project.name,
              run_name=request.run_name,
              job_submission_id=request.job_submission_id,
          )
      else:
          log_file_path = _get_job_log_file_path(
              project_name=project.name,
              run_name=request.run_name,
              job_submission_id=request.job_submission_id,
          )
      logs = []
      try:
          with open(log_file_path) as f:
              for line in f:
                  log_event = LogEvent.parse_raw(line)
                  if (
                      request.start_time
                      and log_event.timestamp <= request.start_time
                  ):
                      continue
                  if (
                      request.end_time is None
                      or log_event.timestamp < request.end_time
                  ):
                      logs.append(log_event)
                  else:
                      break
      except IOError:
          pass
      return JobSubmissionLogs(logs=logs)
  
file_path: dstack/src/dstack/_internal/server/services/logs.py
imports: import base64
  from datetime import datetime, timezone
  from pathlib import Path
  from typing import List
  from uuid import UUID
  from dstack._internal.core.models.logs import JobSubmissionLogs, LogEvent, LogEventSource
  from dstack._internal.server import settings
  from dstack._internal.server.models import ProjectModel
  from dstack._internal.server.schemas.logs import PollLogsRequest
  from dstack._internal.server.schemas.runner import LogEvent
label_desc: Use image node_id 3 for calling a global function with example usage: poll_logs(project, request) and returns: JobSubmissionLogs