Example #1
0
 def Args(parser):
   parser.add_argument(
       'id',
       metavar='JOB_ID',
       help='The ID of the job to describe.')
   # Allow the user to specify new labels as well as update/remove existing
   labels_util.AddUpdateLabelsFlags(parser)
Example #2
0
def _CommonArgs(parser):
    """Register flags common to all tracks."""
    base.ASYNC_FLAG.AddToParser(parser)
    # Allow the user to specify new labels as well as update/remove existing
    labels_util.AddUpdateLabelsFlags(parser)
    # Updates can take hours if a lot of data needs to be moved on HDFS
    flags.AddTimeoutFlag(parser, default='3h')
    parser.add_argument('name', help='The name of the cluster to update.')
    parser.add_argument('--num-workers',
                        type=int,
                        help='The new number of worker nodes in the cluster.')
    parser.add_argument(
        '--num-preemptible-workers',
        type=int,
        help='The new number of preemptible worker nodes in the cluster.')

    parser.add_argument('--graceful-decommission-timeout',
                        type=arg_parsers.Duration(lower_bound='0s',
                                                  upper_bound='1d'),
                        help="""
            The graceful decommission timeout for decommissioning Node Managers
            in the cluster, used when removing nodes. Graceful decommissioning
            allows removing nodes from the cluster without interrupting jobs in
            progress. Timeout specifies how long to wait for jobs in progress to
            finish before forcefully removing nodes (and potentially
            interrupting jobs). Timeout defaults to 0 if not set (for forceful
            decommission), and the maximum allowed timeout is 1 day.
            """)
Example #3
0
  def Args(parser, version=base.ReleaseTrack.GA):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
      version: The version this tool is running as. base.ReleaseTrack.GA
          is the default.
    """
    flags.AddDeploymentNameFlag(parser)
    flags.AddPropertiesFlag(parser)
    flags.AddAsyncFlag(parser)

    parser.add_argument(
        '--description',
        help='The new description of the deployment.',
        dest='description'
    )

    group = parser.add_mutually_exclusive_group()
    group.add_argument(
        '--config',
        help='Filename of config that specifies resources to deploy. '
        'Required unless launching an already-previewed update to this '
        'deployment. More information is available at '
        'https://cloud.google.com/deployment-manager/docs/configuration/.',
        dest='config')

    if version in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
      group.add_argument(
          '--manifest-id',
          help='Manifest Id of a previous deployment. '
          'This flag cannot be used with --config.',
          dest='manifest_id')

    labels_util.AddUpdateLabelsFlags(parser)

    parser.add_argument(
        '--preview',
        help='Preview the requested update without making any changes to the'
        'underlying resources. (default=False)',
        dest='preview',
        default=False,
        action='store_true')

    parser.add_argument(
        '--create-policy',
        help='Create policy for resources that have changed in the update.',
        default='CREATE_OR_ACQUIRE',
        choices=(sorted(dm_v2_base.GetMessages()
                        .DeploymentmanagerDeploymentsUpdateRequest
                        .CreatePolicyValueValuesEnum.to_dict().keys())))

    flags.AddDeletePolicyFlag(
        parser, dm_v2_base.GetMessages()
        .DeploymentmanagerDeploymentsUpdateRequest)
    flags.AddFingerprintFlag(parser)

    parser.display_info.AddFormat(flags.RESOURCES_AND_OUTPUTS_FORMAT)
Example #4
0
 def Args(parser):
     flags.AddCryptoKeyArgument(parser, 'to update')
     flags.AddRotationPeriodFlag(parser)
     flags.AddNextRotationTimeFlag(parser)
     flags.AddRemoveRotationScheduleFlag(parser)
     flags.AddCryptoKeyPrimaryVersionFlag(parser, 'to make primary')
     labels_util.AddUpdateLabelsFlags(parser)
Example #5
0
def _FunctionArgs(parser):
    """Add arguments specyfying functions behavior to the parser."""
    parser.add_argument('name',
                        help='Intended name of the new function.',
                        type=util.ValidateFunctionNameOrRaise)
    parser.add_argument(
        '--memory',
        type=arg_parsers.BinarySize(
            suggested_binary_size_scales=['KB', 'MB', 'MiB', 'GB', 'GiB'],
            default_unit='MB'),
        help="""\
      The amount of memory allocated to your function.

      Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB. By default,
      256 MB is allocated to each function. When deploying an update to an
      existing function it will keep its old memory limit unless you specify
      this flag.""")
    parser.add_argument('--timeout',
                        help="""\
      The function execution timeout, e.g. 30s for 30 seconds. Defaults to
      original value for existing function or 60 seconds for new functions.""",
                        type=arg_parsers.Duration(lower_bound='1s'))
    parser.add_argument(
        '--retry',
        help=('If specified, then the function will be retried in case of a '
              'failure.'),
        action='store_true',
    )
    labels_util.AddUpdateLabelsFlags(parser)
Example #6
0
    def Args(cls, parser):
        flags.AddSubscriptionResourceArg(parser, 'to update.')
        flags.AddSubscriptionSettingsFlags(parser,
                                           cls.ReleaseTrack(),
                                           is_update=True)

        labels_util.AddUpdateLabelsFlags(parser)
Example #7
0
 def Args(cls, parser):
   # Regional disk is in Alpha only.
   if cls.ReleaseTrack() == base.ReleaseTrack.ALPHA:
     cls.DISK_ARG = disks_flags.MakeDiskArgZonalOrRegional(plural=False)
   else:
     cls.DISK_ARG = disks_flags.MakeDiskArg(plural=False)
   cls.DISK_ARG.AddArgument(parser)
   labels_util.AddUpdateLabelsFlags(parser)
    def Args(cls, parser):
        """Adds arguments to the supplied parser.

    Args:
      parser: The argparse parser to add arguments to.
    """
        cls.VPN_TUNNEL_ARG = (vpn_tunnel_flags.VpnTunnelArgument())
        cls.VPN_TUNNEL_ARG.AddArgument(parser)
        labels_util.AddUpdateLabelsFlags(parser)
Example #9
0
 def Args(parser):
     """Args is called by calliope to gather arguments for this command."""
     AddBaseArgs(parser)
     flags.AddInstanceResizeLimit(parser)
     labels_util.AddUpdateLabelsFlags(parser)
     parser.add_argument('--clear-labels',
                         required=False,
                         action='store_true',
                         help=('Remove all labels, if any are set.'))
Example #10
0
    def Args(cls, parser):

        cls.INTERCONNECT_ATTACHMENT_ARG = (
            attachment_flags.InterconnectAttachmentArgument())
        cls.INTERCONNECT_ATTACHMENT_ARG.AddArgument(parser,
                                                    operation_type='patch')
        attachment_flags.AddDescription(parser)
        attachment_flags.AddAdminEnabled(parser, update=True)
        labels_util.AddUpdateLabelsFlags(parser)
Example #11
0
  def Args(cls, parser):

    cls.INTERCONNECT_ATTACHMENT_ARG = (
        attachment_flags.InterconnectAttachmentArgument())
    cls.INTERCONNECT_ATTACHMENT_ARG.AddArgument(parser, operation_type='patch')
    attachment_flags.AddBandwidth(parser, required=False)
    attachment_flags.AddPartnerMetadata(parser, required=False)
    attachment_flags.AddDescription(parser)
    labels_util.AddUpdateLabelsFlags(parser)
Example #12
0
  def Args(cls, parser):
    """Adds arguments to the supplied parser.

    Args:
      parser: The argparse parser to add arguments to.
    """
    cls.TARGET_VPN_GATEWAY_ARG = (
        target_vpn_gateway_flags.TargetVpnGatewayArgument())
    cls.TARGET_VPN_GATEWAY_ARG.AddArgument(parser)
    labels_util.AddUpdateLabelsFlags(parser)
Example #13
0
 def Args(parser):
   """Args is called by calliope to gather arguments for this command."""
   AddBaseArgs(parser)
   flags.INSTANCE_RESIZE_LIMIT_FLAG.AddToParser(parser)
   labels_util.AddUpdateLabelsFlags(parser)
   parser.add_argument(
       '--clear-labels',
       required=False,
       action='store_true',
       help=('Remove all labels, if any are set.'))
Example #14
0
def _ArgsCommon(cls, parser, support_labels=False):
    """Shared arguments for patch commands."""
    cls.INTERCONNECT_ARG = flags.InterconnectArgument()
    cls.INTERCONNECT_ARG.AddArgument(parser, operation_type='patch')

    parser.add_argument(
        '--description',
        help='An optional, textual description for the interconnect.')
    flags.AddAdminEnabledForPatch(parser)
    flags.AddNocContactEmail(parser)
    flags.AddRequestedLinkCountForPatch(parser)
    if support_labels:
        labels_util.AddUpdateLabelsFlags(parser)
Example #15
0
  def Args(parser):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    """
    flags.AddAsyncFlag(parser)
    composite_types.AddCompositeTypeNameFlag(parser)
    composite_types.AddDescriptionFlag(parser)
    composite_types.AddStatusFlag(parser)
    labels_util.AddUpdateLabelsFlags(parser)
Example #16
0
 def Args(parser):
     base.ASYNC_FLAG.AddToParser(parser)
     # Allow the user to specify new labels as well as update/remove existing
     labels_util.AddUpdateLabelsFlags(parser)
     parser.add_argument('name', help='The name of the cluster to update.')
     parser.add_argument(
         '--num-workers',
         type=int,
         help='The new number of worker nodes in the cluster.')
     parser.add_argument(
         '--num-preemptible-workers',
         type=int,
         help='The new number of preemptible worker nodes in the cluster.')
Example #17
0
    def Args(parser):
        """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    """
        flags.AddAsyncFlag(parser)
        type_providers.AddTypeProviderNameFlag(parser)
        type_providers.AddApiOptionsFileFlag(parser)
        type_providers.AddDescriptionFlag(parser)
        type_providers.AddDescriptorUrlFlag(parser)
        labels_util.AddUpdateLabelsFlags(parser)
Example #18
0
def _CommonArgs(parser):
    """Register flags common to all tracks."""
    base.ASYNC_FLAG.AddToParser(parser)
    # Allow the user to specify new labels as well as update/remove existing
    labels_util.AddUpdateLabelsFlags(parser)
    # Updates can take hours if a lot of data needs to be moved on HDFS
    util.AddTimeoutFlag(parser, default='3h')
    parser.add_argument('name', help='The name of the cluster to update.')
    parser.add_argument('--num-workers',
                        type=int,
                        help='The new number of worker nodes in the cluster.')
    parser.add_argument(
        '--num-preemptible-workers',
        type=int,
        help='The new number of preemptible worker nodes in the cluster.')
Example #19
0
  def Args(parser, version=base.ReleaseTrack.GA):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
      version: The version this tool is running as. base.ReleaseTrack.GA
          is the default.
    """
    flags.AddDeploymentNameFlag(parser)
    flags.AddPropertiesFlag(parser)
    flags.AddAsyncFlag(parser)

    parser.add_argument(
        '--description',
        help='The new description of the deployment.',
        dest='description'
    )

    group = parser.add_mutually_exclusive_group()
    flags.AddConfigFlags(group)

    if version in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
      group.add_argument(
          '--manifest-id',
          help='Manifest Id of a previous deployment. '
          'This flag cannot be used with --config.',
          dest='manifest_id')

    labels_util.AddUpdateLabelsFlags(parser)

    parser.add_argument(
        '--preview',
        help='Preview the requested update without making any changes to the'
        'underlying resources. (default=False)',
        dest='preview',
        default=False,
        action='store_true')

    Update._create_policy_flag_map.choice_arg.AddToParser(parser)
    Update._delete_policy_flag_map.choice_arg.AddToParser(parser)
    flags.AddFingerprintFlag(parser)

    parser.display_info.AddFormat(flags.RESOURCES_AND_OUTPUTS_FORMAT)
Example #20
0
 def Args(parser):
     base.ASYNC_FLAG.AddToParser(parser)
     # Allow the user to specify new labels as well as update/remove existing
     labels_util.AddUpdateLabelsFlags(parser)
     parser.add_argument('name', help='The name of the cluster to update.')
     parser.add_argument(
         '--num-workers',
         type=int,
         help='The new number of worker nodes in the cluster.')
     parser.add_argument(
         '--num-preemptible-workers',
         type=int,
         help='The new number of preemptible worker nodes in the cluster.')
     # Leaving this option here since it was in public announcement.
     # Hiding it so new users see the preferred --num-workers
     # option in help.
     # TODO(user): remove before public beta launch.
     parser.add_argument('--new-num-workers',
                         type=int,
                         help=argparse.SUPPRESS)
Example #21
0
def _FunctionArgs(parser):
  """Add arguments specyfying functions behavior to the parser."""
  parser.add_argument(
      'name',
      help='Name of the function to deploy.',
      type=util.ValidateFunctionNameOrRaise,
  )
  parser.add_argument(
      '--memory',
      type=arg_parsers.BinarySize(
          suggested_binary_size_scales=['KB', 'MB', 'MiB', 'GB', 'GiB'],
          default_unit='MB'),
      help="""\
      Limit on the amount of memory the function can use.

      Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB. By default,
      a new function is limited to 256MB of memory. When deploying an update to
      an existing function, the function will keep its old memory limit unless
      you specify this flag.""")
  parser.add_argument(
      '--timeout',
      help="""\
      The function execution timeout, e.g. 30s for 30 seconds. Defaults to
      original value for existing function or 60 seconds for new functions.
      Cannot be more than 540s.""",
      type=arg_parsers.Duration(lower_bound='1s', upper_bound='540s'))
  parser.add_argument(
      '--retry',
      help=('If specified, then the function will be retried in case of a '
            'failure.'),
      action='store_true',
  )
  labels_util.AddUpdateLabelsFlags(
      parser,
      extra_update_message=' ' + _NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE,
      extra_remove_message=' ' + _NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE)
Example #22
0
 def Args(cls, parser):
   cls.ADDRESS_ARG = flags.AddressArgument(plural=False)
   cls.ADDRESS_ARG.AddArgument(parser)
   labels_util.AddUpdateLabelsFlags(parser)
Example #23
0
 def Args(parser):
     flags.GetProjectFlag('update').AddToParser(parser)
     labels_util.AddUpdateLabelsFlags(parser)
     parser.add_argument('--name', help='New name for the project.')
     parser.display_info.AddFormat(command_lib_util.LIST_FORMAT)
Example #24
0
 def Args(cls, parser):
     cls.DISK_IMAGE_ARG = images_flags.MakeDiskImageArg(plural=False)
     cls.DISK_IMAGE_ARG.AddArgument(parser)
     labels_util.AddUpdateLabelsFlags(parser)
Example #25
0
 def Args(parser):
     Update.SnapshotArg = snapshots_flags.MakeSnapshotArg()
     Update.SnapshotArg.AddArgument(parser, operation_type='update')
     labels_util.AddUpdateLabelsFlags(parser)
Example #26
0
def _AddUpdateArgs(parser):
    """Get arguments for the `ml-engine versions update` command."""
    flags.AddVersionResourceArg(parser, 'to update')
    labels_util.AddUpdateLabelsFlags(parser)
Example #27
0
def _Args(cls, parser):
  cls.FORWARDING_RULE_ARG = flags.ForwardingRuleArgument()
  cls.FORWARDING_RULE_ARG.AddArgument(parser)
  labels_util.AddUpdateLabelsFlags(parser)
Example #28
0
 def Args(parser):
     images_flags.IMAGE_ARG.AddArgument(parser)
     labels_util.AddUpdateLabelsFlags(parser)
Example #29
0
 def Args(parser):
     flags.INSTANCE_ARG.AddArgument(parser)
     labels_util.AddUpdateLabelsFlags(parser)
     flags.AddMinCpuPlatformArgs(parser, Update.ReleaseTrack())
Example #30
0
 def Args(cls, parser):
   cls.DISK_ARG = disks_flags.MakeDiskArg(plural=False)
   cls.DISK_ARG.AddArgument(parser, operation_type='update')
   labels_util.AddUpdateLabelsFlags(parser)