code: def _gateway_preflight(
      project: str,
      domain: str,
      gateway_ssh_private_key: str,
      project_ssh_private_key: str,
      options: dict,
  ):
      logger.debug("Running service preflight: %s", domain)
      try:
          with gateway_tunnel_client(
              domain, gateway_ssh_private_key
          ) as client:
              client.preflight(
                  project, domain, project_ssh_private_key, options
              )
      except requests.RequestException:
          raise GatewayError(f"Gateway is not working")
  
imports: import asyncio
  import os
  from datetime import timezone
  from typing import List, Optional, Sequence
  import requests
  from sqlalchemy import delete, select, update
  from sqlalchemy.ext.asyncio import AsyncSession
  import dstack._internal.utils.random_names
  from dstack._internal.core.backends.base.compute import get_dstack_gateway_wheel, get_dstack_runner_version
  from dstack._internal.core.errors import GatewayError, ResourceNotExistsError, ServerClientError
  from dstack._internal.core.models.backends.base import BackendType
  from dstack._internal.core.models.gateways import Gateway
  from dstack._internal.core.models.runs import Job
  from dstack._internal.core.services.ssh.exec import ssh_execute_command
  from dstack._internal.server import settings
  from dstack._internal.server.models import GatewayComputeModel, GatewayModel, ProjectModel
  from dstack._internal.server.services.backends import get_project_backend_by_type_or_error, get_project_backends_with_models
  from dstack._internal.server.services.gateways.ssh import gateway_tunnel_client
  from dstack._internal.server.utils.common import run_async
  from dstack._internal.utils.crypto import generate_rsa_key_pair_bytes
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: _gateway_preflight(project, domain, gateway_ssh_private_key, project_ssh_private_key, options) without return types