Exemple #1
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    """
        client = models.ModelsClient()
        op = client.Delete(args.model)

        return operations.OperationsClient().WaitForOperation(
            op, message='Deleting model [{}]'.format(args.model)).response
Exemple #2
0
def WaitForOpMaybe(op, async_=False, message=None):
  """Waits for an operation if async_ flag is on.

  Args:
    op: Cloud ML operation, the operation to poll
    async_: bool, whether to wait for the operation or return immediately
    message: str, the message to display while waiting for the operation

  Returns:
    The result of the operation if async_ is true, or the Operation message
        otherwise
  """
  if async_:
    return op
  return operations.OperationsClient().WaitForOperation(
      op, message=message).response
Exemple #3
0
 def Run(self, args):
     return operations.OperationsClient().List(
         properties.VALUES.core.project.Get())
Exemple #4
0
 def Run(self, args):
     operation_ref = resources.REGISTRY.Parse(
         args.operation, collection='ml.projects.operations')
     return operations.OperationsClient().Get(operation_ref)
Exemple #5
0
 def Run(self, args):
     return operations_util.Wait(operations.OperationsClient('v1'),
                                 args.operation)
Exemple #6
0
 def Run(self, args):
   models_client = models.ModelsClient('v1beta1')
   operations_client = operations.OperationsClient('v1beta1')
   return models_util.Delete(models_client, operations_client, args.model)
Exemple #7
0
 def Run(self, args):
     project_ref = resources.REGISTRY.Parse(
         properties.VALUES.core.project.Get(required=True),
         collection='ml.projects')
     return operations.OperationsClient().List(project_ref)
Exemple #8
0
 def Run(self, args):
   return operations_util.Describe(operations.OperationsClient('v1'),
                                   args.operation)
Exemple #9
0
 def Run(self, args):
   return operations_util.Delete(operations.OperationsClient('v1beta1'),
                                 args.operation)
Exemple #10
0
 def Run(self, args):
     return operations_util.List(operations.OperationsClient('v1'))
Exemple #11
0
 def Run(self, args):
   operations_client = operations.OperationsClient()
   operation_ref = resources.REGISTRY.Parse(
       args.operation, collection='ml.projects.operations')
   operation = operations_client.Get(operation_ref)
   return operations_client.WaitForOperation(operation)
Exemple #12
0
 def Run(self, args):
     return versions_util.Delete(versions_api.VersionsClient('v1'),
                                 operations.OperationsClient('v1'),
                                 args.version,
                                 model=args.model)