def test_gridsearch_n_jobs(self):
        """
        Testing that running gridsearch with multiple workers returns the same
        best_parameters as the single worker run.
        """

        rng_seed = 1

        np.random.seed(rng_seed)

        dummy_series = get_dummy_series(
            ts_length=100, lt_end_value=1, st_value_offset=0
        ).astype(np.float32)
        ts_train, ts_val = dummy_series.split_before(split_point=0.8)

        test_cases = [
            {
                "model": ARIMA,  # ExtendedForecastingModel
                "parameters": {"p": [18, 4], "q": [2, 3], "random_state": [rng_seed]},
            },
            {
                "model": BlockRNNModel,  # TorchForecastingModel
                "parameters": {
                    "input_chunk_length": [5, 10],
                    "output_chunk_length": [1, 3],
                    "n_epochs": [1, 5],
                    "random_state": [rng_seed],
                    "pl_trainer_kwargs": [tfm_kwargs["pl_trainer_kwargs"]],
                },
            },
        ]

        for test in test_cases:
            model = test["model"]
            parameters = test["parameters"]

            np.random.seed(rng_seed)
            _, best_params1, _ = model.gridsearch(
                parameters=parameters, series=ts_train, val_series=ts_val, n_jobs=1
            )

            np.random.seed(rng_seed)
            _, best_params2, _ = model.gridsearch(
                parameters=parameters, series=ts_train, val_series=ts_val, n_jobs=2
            )

            assert best_params1 == best_params2

        Testing that running gridsearch with multiple workers returns the same
        best_parameters as the single worker run.
        
darts/tests/models/forecasting/test_backtesting.py