Ejemplo n.º 1
0
 def update_job(
     self,
     instance_inc,
     batch_size,
     use_instance_config,
     sleep_time,
     host_limit_1=False,
 ):
     job_info = self.get_job_info()
     job_config = job_info.config
     if use_instance_config:
         instance_config = {}
         for i in range(0, instance_inc):
             count = job_config.instanceCount + i
             instance_config[count] = self.create_pod_config(
                 sleep_time, "instance %s" % i)
         job_config.instanceConfig.MergeFrom(instance_config)
     job_config.instanceCount = job_config.instanceCount + instance_inc
     request = job.UpdateRequest(id=peloton.JobID(value=self.job_id),
                                 config=job_config)
     self.client.job_svc.Update(
         request,
         metadata=self.client.jobmgr_metadata,
         timeout=default_timeout,
     )
Ejemplo n.º 2
0
    def update(self, new_job_file):
        """
        updates a job
        :param new_job_file: The job config file used for updating
        """
        job_config_dump = load_test_config(new_job_file)
        new_job_config = job.JobConfig()
        json_format.ParseDict(job_config_dump, new_job_config)

        request = job.UpdateRequest(id=peloton.JobID(value=self.job_id),
                                    config=new_job_config)
        resp = self.client.job_svc.Update(
            request,
            metadata=self.client.jobmgr_metadata,
            timeout=self.config.rpc_timeout_sec,
        )
        assert not resp.HasField("error")

        # update the config
        self.job_config = new_job_config
        log.info("updated job %s", self.job_id)
Ejemplo n.º 3
0
    def update_job(self, job_id, new_job_config):
        """
        param job_id: id of the job
        param new_job_config: new config of the job
        type job_id: str
        type new_job_config: job.JobConfig

        rtype: job.UpdateResponse
        """
        request = job.UpdateRequest(id=peloton.JobID(value=job_id),
                                    config=new_job_config)
        try:
            print_okblue("Updating Job %s" % job_id)
            resp = self.client.job_svc.Update(
                request,
                metadata=self.client.jobmgr_metadata,
                timeout=default_timeout,
            )
            return resp
        except Exception as e:
            print_fail("Exception calling Update Job: %s" % str(e))
            raise