code: def test_executor_stops_on_long_job(
      executor: WorkerExecutor,
      tmp_dataset_repo_factory: Callable[[str], str],
      set_long_running_job_in_queue: JobDocument,
      set_just_started_job_in_queue: JobDocument,
  ) -> None:
      long_job = set_long_running_job_in_queue
      tmp_dataset_repo_factory(long_job.dataset)
      with patch.dict(
          os.environ,
          {"WORKER_LOOP_TYPE": "start_worker_loop_with_long_job"},
      ):
          with patch.object(
              executor, "max_seconds_without_heartbeat_for_zombies", -1
          ):  # don't kill normal_job
              with patch.object(
                  executor, "kill_long_job_interval_seconds", 0.1
              ):  # make sure it has the time to kill the job
                  with patch(
                      "worker.executor.START_WORKER_LOOP_PATH", __file__
                  ), patch.dict(
                      os.environ, {"WORKER_TEST_TIME": str(_TIME)}
                  ):
                      executor.start()
  
      assert long_job is not None
      assert str(long_job.pk) == get_job_info("long")["job_id"]
      assert (
          JobDocument.objects(pk=long_job.pk).count() == 0
      ), "must be deleted because too long"
  
      responses = CachedResponseDocument.objects(
          error_code="JobManagerExceededMaximumDurationError"
      )
      assert len(responses) == 1
      response = responses[0]
      expected_error = {
          "error": "Job manager was killed while running this job (job exceeded maximum duration).",
      }
      assert response.http_status == HTTPStatus.NOT_IMPLEMENTED
      assert (
          response.error_code
          == "JobManagerExceededMaximumDurationError"
      )
      assert response.dataset == long_job.dataset
      assert response.config == long_job.config
      assert response.split == long_job.split
      assert response.content == expected_error
      assert response.details == expected_error
  
imports: import os
  import sys
  import time
  from collections.abc import Callable, Iterator
  from datetime import timedelta
  from http import HTTPStatus
  from pathlib import Path
  from unittest.mock import patch
  import orjson
  import pytest
  import pytz
  from filelock import FileLock
  from libcommon.queue import JobDocument, JobDoesNotExistError, Queue
  from libcommon.resources import CacheMongoResource, QueueMongoResource
  from libcommon.simple_cache import CachedResponseDocument
  from libcommon.storage import StrPath
  from libcommon.storage_client import StorageClient
  from libcommon.utils import JobInfo, Priority, Status, get_datetime
  from mirakuru import ProcessExitedWithError, TimeoutExpired
  from pytest import fixture
  from worker.config import AppConfig
  from worker.executor import WorkerExecutor
  from worker.job_runner_factory import JobRunnerFactory
  from worker.loop import WorkerState
  from worker.resources import LibrariesResource
label_desc: Use image node_id 19 for calling a global function with example usage: test_executor_stops_on_long_job(executor, tmp_dataset_repo_factory, set_long_running_job_in_queue, set_just_started_job_in_queue) without return types