Ejemplo n.º 1
0
    def _job_update_request(self, config, instances=None):
        try:
            settings = UpdaterConfig(**config.update_config().get()
                                     ).to_thrift_update_settings(instances)
        except ValueError as e:
            raise self.UpdateConfigError(str(e))

        return JobUpdateRequest(instanceCount=config.instances(),
                                settings=settings,
                                taskConfig=config.job().taskConfig)
Ejemplo n.º 2
0
    def _job_update_request(self, config, instances=None, metadata=None):
        try:
            settings = UpdaterConfig(
                config.update_config()).to_thrift_update_settings(instances)
        except ValueError as e:
            raise self.UpdateConfigError(str(e))

        return JobUpdateRequest(
            instanceCount=config.instances(),
            settings=settings,
            taskConfig=config.job().taskConfig,
            metadata={Metadata(k, v)
                      for k, v in metadata.items()} if metadata else None)
Ejemplo n.º 3
0
    def start_job_update(self, config, instances=None):
        """Requests Scheduler to start job update process.

    Arguments:
    config -- AuroraConfig instance with update details.
    instances -- Optional list of instances to restrict update to.

    Returns response object with update ID and acquired job lock.
    """
        try:
            settings = UpdaterConfig(**config.update_config().get()
                                     ).to_thrift_update_settings(instances)
        except ValueError as e:
            raise self.UpdateConfigError(str(e))

        log.info("Starting update for: %s" % config.name())
        request = JobUpdateRequest(instanceCount=config.instances(),
                                   settings=settings,
                                   taskConfig=config.job().taskConfig)

        return self._scheduler_proxy.startJobUpdate(request)
Ejemplo n.º 4
0
 def test_startJobUpdate(self):
     self.mock_thrift_client.startJobUpdate(
         IsA(JobUpdateRequest), IsA(SessionKey)).AndReturn(DEFAULT_RESPONSE)
     self.mox.ReplayAll()
     self.make_scheduler_proxy().startJobUpdate(JobUpdateRequest())
Ejemplo n.º 5
0
 def create_update_request(cls, task_config):
     return JobUpdateRequest(instanceCount=5,
                             settings=cls.create_update_settings(),
                             taskConfig=task_config)
Ejemplo n.º 6
0
 def create_update_request(cls, task_config):
     return JobUpdateRequest(jobKey=cls.JOB_KEY.to_thrift(),
                             instanceCount=5,
                             settings=cls.create_update_settings(),
                             taskConfig=task_config)