def save_run_info(cls, samples, run_info, overwrite=True, cleanup=True):
        """Saves the run information on the collection.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            run_info: a :class:`BaseRunInfo`
            overwrite (True): whether to overwrite an existing run with the
                same key
            cleanup (True): whether to execute an existing run's
                :meth:`BaseRun.cleanup` method when overwriting it
        """
        import fiftyone.core.view as fov

        key = run_info.key

        if key in cls.list_runs(samples):
            if overwrite:
                cls.delete_run(samples, key, cleanup=cleanup)
            else:
                raise ValueError(
                    "%s with key '%s' already exists"
                    % (cls._run_str().capitalize(), key)
                )

        dataset = samples._root_dataset
        run_docs = getattr(dataset._doc, cls._runs_field())

        if isinstance(samples, fov.DatasetView):
            view_stages = [
                json_util.dumps(s)
                for s in samples._serialize(include_uuids=False)
            ]
        else:
            view_stages = None

        run_doc = RunDocument(
            dataset_id=dataset._doc.id,
            key=key,
            version=run_info.version,
            timestamp=run_info.timestamp,
            config=deepcopy(run_info.config.serialize()),
            view_stages=view_stages,
            results=None,
        )
        run_doc.save(upsert=True)

        run_docs[key] = run_doc
        dataset.save()
Saves the run information on the collection.

        Args:
            samples: a :class:`fiftyone.core.collections.SampleCollection`
            run_info: a :class:`BaseRunInfo`
            overwrite (True): whether to overwrite an existing run with the
                same key
            cleanup (True): whether to execute an existing run's
                :meth:`BaseRun.cleanup` method when overwriting it
        
fiftyone/core/runs.py