def Run(self, args):
        custom_job_ref = args.CONCEPTS.custom_job.Parse()
        region = custom_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(region)

        with endpoint_util.AiplatformEndpointOverrides(
                version=self._api_version, region=region):
            response = client.CustomJobsClient(version=self._api_version).Get(
                custom_job_ref.RelativeName())
            return response
    def Run(self, args):
        custom_job_ref = args.CONCEPTS.custom_job.Parse()
        region = custom_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(region)

        with endpoint_util.AiplatformEndpointOverrides(
                version=self._api_version, region=region):
            job_name = custom_job_ref.RelativeName()
            response = client.CustomJobsClient(
                version=self._api_version).Cancel(job_name)
            log.status.Print(
                _CUSTOM_JOB_CANCEL_DISPLAY_MESSAGE.format(
                    job_name=job_name, command_prefix=self._CommandPrefix()))
            return response
예제 #3
0
    def Run(self, args):
        custom_job_ref = args.CONCEPTS.custom_job.Parse()
        region = custom_job_ref.AsDict()['locationsId']
        validation.ValidateRegion(region)

        with endpoint_util.AiplatformEndpointOverrides(
                version=self._api_version, region=region):
            return log_util.StreamLogs(
                custom_job_ref.AsDict()['customJobsId'],
                continue_function=client.CustomJobsClient(
                    version=self._api_version).CheckJobComplete(
                        custom_job_ref.RelativeName()),
                polling_interval=args.polling_interval,
                task_name=args.task_name,
                allow_multiline=args.allow_multiline_logs)
예제 #4
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)

        with endpoint_util.AiplatformEndpointOverrides(
                version=self._api_version, region=region):
            return client.CustomJobsClient(version=self._api_version).List(
                region=region_ref.RelativeName())
  def Run(self, args):
    project = properties.VALUES.core.project.GetOrFail()
    region_ref = args.CONCEPTS.region.Parse()
    region = region_ref.AsDict()['locationsId']
    validation.ValidateRegion(region)

    with endpoint_util.AiplatformEndpointOverrides(
        version=self._version, region=region):
      api_client = client.CustomJobsClient(version=self._version)
      job_spec = self._PrepareJobSpec(args, api_client, project)
      labels = labels_util.ParseCreateArgs(
          args,
          api_client.CustomJobMessage().LabelsValue)

      response = api_client.Create(
          parent=region_ref.RelativeName(),
          display_name=args.display_name,
          job_spec=job_spec,
          kms_key_name=common_validation.GetAndValidateKmsKey(args),
          labels=labels)
      self._DisplayResult(response)
      return response