def update_run_key(cls, samples, key, new_key):
        """Replaces the key for the given run with a new key.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            key: a run key
            new_key: a new run key
        """
        if new_key in cls.list_runs(samples):
            raise ValueError(
                "A %s with key '%s' already exists" % (cls._run_str(), new_key)
            )

        try:
            # Execute rename() method
            run_info = cls.get_run_info(samples, key)
            run = run_info.config.build()
            run.rename(samples, key, new_key)
        except Exception as e:
            logger.warning(
                "Failed to run rename() for the %s with key '%s': %s",
                cls._run_str(),
                key,
                str(e),
            )

        dataset = samples._root_dataset

        # Update run doc
        run_docs = getattr(dataset._doc, cls._runs_field())
        # DON'T use pop()! https://github.com/voxel51/fiftyone/issues/4322
        run_doc = run_docs[key]
        del run_docs[key]
        run_doc.key = new_key
        run_docs[new_key] = run_doc
        run_doc.save()
        dataset.save()

        # Update results cache
        results_cache = getattr(dataset, cls._results_cache_field())
        run_results = results_cache.pop(key, None)
        if run_results is not None:
            run_results._key = new_key
            results_cache[new_key] = run_results
Replaces the key for the given run with a new key.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            key: a run key
            new_key: a new run key
        
fiftyone/core/runs.py