docstr: Testing that running gridsearch with multiple workers returns the same
  best_parameters as the single worker run.
docstr_tok: ["Testing","that","running","gridsearch","with","multiple","workers","returns","the","same","best_parameters","as","the","single","worker","run","."]
code: 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
  
imports: import random
  from itertools import product
  import numpy
  import pandas
  import pytest
  from darts import TimeSeries
  from darts.datasets import AirPassengersDataset, MonthlyMilkDataset
  from darts.logging import get_logger
  from darts.metrics import mape, r2_score
  from darts.models import ARIMA, FFT, ExponentialSmoothing, NaiveDrift, NaiveSeasonal, Theta
  from darts.tests.conftest import tfm_kwargs
  from darts.utils.timeseries_generation import gaussian_timeseries
  from darts.utils.timeseries_generation import linear_timeseries
  from darts.utils.timeseries_generation import random_walk_timeseries
  from darts.utils.timeseries_generation import sine_timeseries
label_desc: Use image node_id 10 for calling the TestBacktesting obj's underlying member method code with example usage: obj.test_gridsearch_n_jobs() without return types