Exemplo n.º 1
0
 def test_pulse_interval_secs(self):
   config = UpdaterConfig(
     UpdateConfig(batch_size=1,
                  watch_secs=1,
                  max_per_shard_failures=1,
                  max_total_failures=1,
                  pulse_interval_secs=60))
   assert 60000 == config.to_thrift_update_settings().blockIfNoPulsesAfterMs
Exemplo n.º 2
0
 def test_pulse_interval_unset(self):
     config = UpdaterConfig(
         UpdateConfig(batch_size=1,
                      watch_secs=1,
                      max_per_shard_failures=1,
                      max_total_failures=1))
     assert config.to_thrift_update_settings(
     ).blockIfNoPulsesAfterMs is None
Exemplo n.º 3
0
    def test_to_thrift_update_settings_no_strategy_queue(self):
        """Test to_thrift produces an expected thrift update settings configuration
       from a Pystachio update object that doesn't include an update strategy.

       The configuration in this test should be converted to a
       QueueJobUpdateStrategy.
    """

        config = UpdaterConfig(UpdateConfig())

        thrift_update_config = config.to_thrift_update_settings()

        update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS)
        update_settings.updateStrategy = JobUpdateStrategy(
            batchStrategy=None,
            queueStrategy=QueueJobUpdateStrategy(groupSize=1),
            varBatchStrategy=None)

        assert thrift_update_config == update_settings
Exemplo n.º 4
0
  def test_to_thrift_update_settings_no_strategy_queue(self):

    """Test to_thrift produces an expected thrift update settings configuration
       from a Pystachio update object that doesn't include an update strategy.

       The configuration in this test should be converted to a
       QueueJobUpdateStrategy.
    """

    config = UpdaterConfig(UpdateConfig())

    thrift_update_config = config.to_thrift_update_settings()

    update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS)
    update_settings.updateStrategy = JobUpdateStrategy(
        batchStrategy=None,
        queueStrategy=QueueJobUpdateStrategy(groupSize=1),
        varBatchStrategy=None)

    assert thrift_update_config == update_settings
Exemplo n.º 5
0
    def test_to_thrift_update_settings_no_strategy_batch(self):
        """Test to_thrift produces an expected thrift update settings configuration
       from a Pystachio update object that doesn't include an update strategy.

       The configuration in this test should be converted to a
       BatchJobUpdateStrategy.
    """

        config = UpdaterConfig(UpdateConfig(wait_for_batch_completion=True))

        thrift_update_config = config.to_thrift_update_settings()

        update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS)
        update_settings.updateStrategy = JobUpdateStrategy(
            batchStrategy=BatchJobUpdateStrategy(groupSize=1,
                                                 autopauseAfterBatch=False),
            queueStrategy=None,
            varBatchStrategy=None)
        update_settings.waitForBatchCompletion = True

        assert thrift_update_config == update_settings
Exemplo n.º 6
0
    def test_to_thrift_update_settings_strategy(self):
        """Test to_thrift produces an expected thrift update settings configuration
       from a Pystachio update object.
    """

        config = UpdaterConfig(
            UpdateConfig(update_strategy=self.UPDATE_STRATEGIES(
                PystachioVariableBatchUpdateStrategy(
                    batch_sizes=[1, 2, 3, 4], autopause_after_batch=True))))

        thrift_update_config = config.to_thrift_update_settings()

        update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS)

        update_settings.updateStrategy = JobUpdateStrategy(
            batchStrategy=None,
            queueStrategy=None,
            varBatchStrategy=VariableBatchJobUpdateStrategy(
                groupSizes=(1, 2, 3, 4), autopauseAfterBatch=True))

        assert thrift_update_config == update_settings
Exemplo n.º 7
0
  def test_to_thrift_update_settings_strategy(self):

    """Test to_thrift produces an expected thrift update settings configuration
       from a Pystachio update object.
    """

    config = UpdaterConfig(
      UpdateConfig(
        update_strategy=self.UPDATE_STRATEGIES(
          PystachioVariableBatchUpdateStrategy(batch_sizes=[1, 2, 3, 4]))))

    thrift_update_config = config.to_thrift_update_settings()

    update_settings = copy.deepcopy(self.EXPECTED_JOB_UPDATE_SETTINGS)

    update_settings.updateStrategy = JobUpdateStrategy(
      batchStrategy=None,
      queueStrategy=None,
      varBatchStrategy=VariableBatchJobUpdateStrategy(groupSizes=(1, 2, 3, 4)))

    assert thrift_update_config == update_settings
 def test_pulse_interval_unset(self):
     config = UpdaterConfig(1, 1, 1, 1, 1)
     assert config.to_thrift_update_settings(
     ).blockIfNoPulsesAfterMs is None
 def test_pulse_interval_secs(self):
     config = UpdaterConfig(1, 1, 1, 1, 1, pulse_interval_secs=60)
     assert 60000 == config.to_thrift_update_settings(
     ).blockIfNoPulsesAfterMs
Exemplo n.º 10
0
 def test_pulse_interval_unset(self):
     config = UpdaterConfig(1, 1, 1, 1)
     assert config.to_thrift_update_settings().blockIfNoPulsesAfterMs is None
Exemplo n.º 11
0
 def test_pulse_interval_secs(self):
     config = UpdaterConfig(1, 1, 1, 1, pulse_interval_secs=60)
     assert 60000 == config.to_thrift_update_settings().blockIfNoPulsesAfterMs