def _Run(args, version):
  """Update an existing Vertex AI Tensorboard."""

  tensorboard_ref = args.CONCEPTS.tensorboard.Parse()
  args.region = tensorboard_ref.AsDict()['locationsId']
  with endpoint_util.AiplatformEndpointOverrides(version, region=args.region):
    tensorboards_client = client.TensorboardsClient(version=version)

    try:
      op = tensorboards_client.Patch(tensorboard_ref, args)
    except errors.NoFieldsSpecifiedError:
      available_update_args = [
          'display_name',
          'description',
          'update_labels',
          'clear_labels',
          'remove_labels',
      ]
      if not any(args.IsSpecified(arg) for arg in available_update_args):
        raise
      log.status.Print('No update to perform.')
      return None
    else:
      log.UpdatedResource(op.name, kind='Vertex AI Tensorboard')
      return op
Пример #2
0
 def _Run(self, args):
   tensorboard_ref = args.CONCEPTS.tensorboard.Parse()
   region = tensorboard_ref.AsDict()['locationsId']
   with endpoint_util.AiplatformEndpointOverrides(
       version=constants.ALPHA_VERSION, region=region):
     response = client.TensorboardsClient().Get(tensorboard_ref)
     return response
Пример #3
0
def _Run(args, version):
    tensorboard_ref = args.CONCEPTS.tensorboard.Parse()
    region = tensorboard_ref.AsDict()['locationsId']
    with endpoint_util.AiplatformEndpointOverrides(version=version,
                                                   region=region):
        response = client.TensorboardsClient(
            version=version).Get(tensorboard_ref)
        return response
Пример #4
0
 def _Run(self, args):
     region_ref = args.CONCEPTS.region.Parse()
     region = region_ref.AsDict()['locationsId']
     with endpoint_util.AiplatformEndpointOverrides(
             version=constants.ALPHA_VERSION, region=region):
         return client.TensorboardsClient().List(limit=args.limit,
                                                 page_size=args.page_size,
                                                 region_ref=region_ref,
                                                 sort_by=args.sort_by)
Пример #5
0
 def _Run(self, args):
     tensorboard_ref = args.CONCEPTS.tensorboard.Parse()
     region = tensorboard_ref.AsDict()['locationsId']
     with endpoint_util.AiplatformEndpointOverrides(
             version=constants.ALPHA_VERSION, region=region):
         operation = client.TensorboardsClient().Delete(tensorboard_ref)
         return operations_util.WaitForOpMaybe(
             operations_client=operations.OperationsClient(),
             op=operation,
             op_ref=tensorboards_util.ParseTensorboardOperation(
                 operation.name))
Пример #6
0
def _Run(args, version):
    """Create a new Vertex AI Tensorboard."""
    validation.ValidateDisplayName(args.display_name)

    region_ref = args.CONCEPTS.region.Parse()
    args.region = region_ref.AsDict()['locationsId']
    with endpoint_util.AiplatformEndpointOverrides(version,
                                                   region=args.region):
        tensorboards_client = client.TensorboardsClient(version=version)
        operation_client = operations.OperationsClient()
        op = tensorboards_client.Create(region_ref, args)
        response_msg = operations_util.WaitForOpMaybe(
            operation_client, op,
            tensorboards_util.ParseTensorboardOperation(op.name))
        if response_msg is not None:
            response = encoding.MessageToPyValue(response_msg)
            if 'name' in response:
                log.status.Print(('Created Vertex AI Tensorboard: {}.').format(
                    response['name']))
        return response_msg