code: def test_mongo_observer_failed_event_updates_run(
      mongo_obs, sample_run
  ):
      mongo_obs.started_event(**sample_run)
  
      fail_trace = "lots of errors and\nso\non..."
      mongo_obs.failed_event(fail_time=T2, fail_trace=fail_trace)
  
      assert mongo_obs.runs.count_documents({}) == 1
      db_run = mongo_obs.runs.find_one()
      assert db_run["stop_time"] == T2
      assert db_run["status"] == "FAILED"
      assert db_run["fail_trace"] == fail_trace
  
imports: import datetime
  from sacred.observers.queue import QueueObserver
  import mock
  import pytest
  import sys
  from sacred.metrics_logger import ScalarMetricLogEntry, linearize_metrics
  import gridfs
  from mongomock.gridfs import enable_gridfs_integration
  import pymongo.errors
  from sacred.dependencies import get_digest
  from sacred.observers.mongo import QueuedMongoObserver, MongoObserver, QueueCompatibleMongoObserver
  from .failing_mongo_mock import ReconnectingMongoClient
label_desc: Use image node_id 9 for calling a global function with example usage: test_mongo_observer_failed_event_updates_run(mongo_obs, sample_run) without return types