コード例 #1
0
    def start_task(self, job_id, instance_id):
        """
        param job_id: id of the job
        param instance_id: instance id of the task to start

        type job_id: str
        type instance_id: int

        rtype: task.StartResponse
        """
        rng = task.InstanceRange(to=instance_id + 1)
        setattr(rng, "from", instance_id)
        request = task.StartRequest(
            jobId=peloton.JobID(value=job_id), ranges=[rng]
        )
        try:
            print_okblue("Starting task %d of Job %s" % (instance_id, job_id))
            resp = self.client.task_svc.Start(
                request,
                metadata=self.client.jobmgr_metadata,
                timeout=default_timeout,
            )
            return resp
        except Exception as e:
            print_fail("Exception calling Start Tasks :%s" % str(e))
            raise
コード例 #2
0
ファイル: job.py プロジェクト: talaniz/peloton
 def start(self, ranges=None):
     """
     Starts a job or certain tasks based on the ranges
     :param ranges: the instance ranges to start
     :return: task start response from the API
     """
     request = task.StartRequest(jobId=peloton.JobID(value=self.job_id),
                                 ranges=ranges)
     response = self.client.task_svc.Start(
         request,
         metadata=self.client.jobmgr_metadata,
         timeout=self.config.rpc_timeout_sec,
     )
     log.info("starting tasks in job {0} with ranges {1}".format(
         self.job_id, ranges))
     return response