Ejemplo n.º 1
0
 def Run(self, args):
     hptuning_job_ref = args.CONCEPTS.hptuning_job.Parse()
     name = hptuning_job_ref.Name()
     region = hptuning_job_ref.AsDict()['locationsId']
     with endpoint_util.AiplatformEndpointOverrides(
             version=constants.BETA_VERSION, region=region):
         response = client.HpTuningJobsClient().Cancel(
             hptuning_job_ref.RelativeName())
         log.status.Print(
             constants.HPTUNING_JOB_CANCEL_DISPLAY_MESSAGE.format(id=name))
         return response
Ejemplo n.º 2
0
 def Run(self, args):
     hptuning_job_ref = args.CONCEPTS.hptuning_job.Parse()
     region = hptuning_job_ref.AsDict()['locationsId']
     with endpoint_util.AiplatformEndpointOverrides(
             version=constants.BETA_VERSION, region=region):
         relative_name = hptuning_job_ref.RelativeName()
         return log_util.StreamLogs(
             hptuning_job_ref.AsDict()['hyperparameterTuningJobsId'],
             continue_function=client.HpTuningJobsClient().CheckJobComplete(
                 relative_name),
             polling_interval=args.polling_interval,
             task_name=args.task_name,
             allow_multiline=args.allow_multiline_logs)
    def Run(self, args):
        hptuning_job_ref = args.CONCEPTS.hptuning_job.Parse()
        region = hptuning_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(
            region, available_regions=constants.SUPPORTED_TRAINING_REGIONS)

        version = constants.GA_VERSION if self.ReleaseTrack(
        ) == base.ReleaseTrack.GA else constants.BETA_VERSION
        with endpoint_util.AiplatformEndpointOverrides(version=version,
                                                       region=region):
            response = client.HpTuningJobsClient(version=version).Get(
                hptuning_job_ref.RelativeName())
            return response
    def Run(self, args):
        hptuning_job_ref = args.CONCEPTS.hptuning_job.Parse()
        region = hptuning_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(
            region, available_regions=constants.SUPPORTED_TRAINING_REGIONS)

        version = constants.GA_VERSION if self.ReleaseTrack(
        ) == base.ReleaseTrack.GA else constants.BETA_VERSION
        with endpoint_util.AiplatformEndpointOverrides(version=version,
                                                       region=region):
            relative_name = hptuning_job_ref.RelativeName()
            return log_util.StreamLogs(
                hptuning_job_ref.AsDict()['hyperparameterTuningJobsId'],
                continue_function=client.HpTuningJobsClient(
                    version=version).CheckJobComplete(relative_name),
                polling_interval=args.polling_interval,
                task_name=args.task_name,
                allow_multiline=args.allow_multiline_logs)
Ejemplo n.º 5
0
 def Run(self, args):
     region_ref = args.CONCEPTS.region.Parse()
     region = region_ref.AsDict()['locationsId']
     with endpoint_util.AiplatformEndpointOverrides(
             version=constants.BETA_VERSION, region=region):
         algorithm = arg_utils.ChoiceToEnum(
             args.algorithm, client.HpTuningJobsClient.GetAlgorithmEnum())
         response = client.HpTuningJobsClient().Create(
             parent=region_ref.RelativeName(),
             config_path=args.config,
             display_name=args.display_name,
             max_trial_count=args.max_trial_count,
             parallel_trial_count=args.parallel_trial_count,
             algorithm=algorithm)
         log.status.Print(
             constants.HPTUNING_JOB_CREATION_DISPLAY_MESSAGE.format(
                 id=hp_tuning_jobs_util.ParseJobName(response.name),
                 state=response.state))
         return response
Ejemplo n.º 6
0
    def Run(self, args):
        """Executes the list command.

    Args:
      args: an argparse.Namespace, it contains all arguments that this command
        was invoked with.

    Returns:
      The list of resources
    """

        region_ref = args.CONCEPTS.region.Parse()
        region = region_ref.AsDict()['locationsId']
        validation.ValidateRegion(
            region, available_regions=constants.SUPPORTED_TRAINING_REGIONS)

        with endpoint_util.AiplatformEndpointOverrides(version=self._version,
                                                       region=region):
            return client.HpTuningJobsClient(version=self._version).List(
                region=region_ref.RelativeName())
    def Run(self, args):
        hptuning_job_ref = args.CONCEPTS.hptuning_job.Parse()
        region = hptuning_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(
            region, available_regions=constants.SUPPORTED_TRAINING_REGIONS)

        version = constants.GA_VERSION if self.ReleaseTrack(
        ) == base.ReleaseTrack.GA else constants.BETA_VERSION
        with endpoint_util.AiplatformEndpointOverrides(version=version,
                                                       region=region):
            response = client.HpTuningJobsClient(version=version).Cancel(
                hptuning_job_ref.RelativeName())

            log.status.Print(
                _HPTUNING_JOB_CANCEL_DISPLAY_MESSAGE.format(
                    id=hptuning_job_ref.Name(),
                    command_version=hp_tuning_jobs_util.OutputCommandVersion(
                        self.ReleaseTrack()),
                    region=region))
            return response