Ejemplo n.º 1
0
def _AddCreateArgs(parser, support_console_logging=False):
    """Get arguments for the `ai-platform models create` command."""
    flags.GetModelName().AddToParser(parser)
    flags.GetDescriptionFlag('model').AddToParser(parser)
    flags.GetRegionArg('model').AddToParser(parser)
    parser.add_argument('--regions',
                        metavar='REGION',
                        type=arg_parsers.ArgList(min_length=1),
                        help="""\
The Google Cloud region where the model will be deployed (currently only a
single region is supported).

Defaults to 'us-central1'.
""")
    parser.add_argument(
        '--enable-logging',
        action='store_true',
        help='If set, enables StackDriver Logging for online prediction. These '
        'logs are like standard server access logs, containing information '
        'such as timestamps and latency for each request.')
    if support_console_logging:
        parser.add_argument(
            '--enable-console-logging',
            action='store_true',
            help=
            'If set, enables StackDriver Logging of stderr and stdout streams '
            'for online prediction. These logs are more verbose than the '
            'standard access logs and can be helpful for debugging.')
    labels_util.AddCreateLabelsFlags(parser)
Ejemplo n.º 2
0
def _AddCreateArgs(parser):
    """Add common arguments for `versions create` command."""
    flags.GetModelName(positional=False, required=True).AddToParser(parser)
    flags.GetDescriptionFlag('version').AddToParser(parser)
    flags.GetRegionArg(include_global=True).AddToParser(parser)
    flags.VERSION_NAME.AddToParser(parser)
    base.Argument('--origin',
                  help="""\
          Location of ```model/``` "directory" (see
          https://cloud.google.com/ai-platform/prediction/docs/deploying-models#upload-model).

          This overrides `deploymentUri` in the `--config` file. If this flag is
          not passed, `deploymentUri` *must* be specified in the file from
          `--config`.

          Can be a Cloud Storage (`gs://`) path or local file path (no
          prefix). In the latter case the files will be uploaded to Cloud
          Storage and a `--staging-bucket` argument is required.
      """).AddToParser(parser)
    flags.RUNTIME_VERSION.AddToParser(parser)
    base.ASYNC_FLAG.AddToParser(parser)
    flags.STAGING_BUCKET.AddToParser(parser)
    base.Argument('--config',
                  help="""\
          Path to a YAML configuration file containing configuration parameters
          for the
          [Version](https://cloud.google.com/ai-platform/prediction/docs/reference/rest/v1/projects.models.versions)
          to create.

          The file is in YAML format. Note that not all attributes of a version
          are configurable; available attributes (with example values) are:

              description: A free-form description of the version.
              deploymentUri: gs://path/to/source
              runtimeVersion: '2.1'
              #  Set only one of either manualScaling or autoScaling.
              manualScaling:
                nodes: 10  # The number of nodes to allocate for this model.
              autoScaling:
                minNodes: 0  # The minimum number of nodes to allocate for this model.
              labels:
                user-defined-key: user-defined-value

          The name of the version must always be specified via the required
          VERSION argument.

          Only one of manualScaling or autoScaling can be specified. If both
          are specified in same yaml file an error will be returned.

          If an option is specified both in the configuration file and via
          command-line arguments, the command-line arguments override the
          configuration file.
      """).AddToParser(parser)
    labels_util.AddCreateLabelsFlags(parser)
    flags.FRAMEWORK_MAPPER.choice_arg.AddToParser(parser)
    flags.AddPythonVersionFlag(parser, 'when creating the version')
    flags.AddMachineTypeFlagToParser(parser)
    flags.GetAcceleratorFlag().AddToParser(parser)
    flags.AddAutoScalingFlags(parser)
Ejemplo n.º 3
0
def _AddCreateArgs(parser):
  """Add common arguments for `versions create` command."""
  flags.GetModelName(positional=False, required=True).AddToParser(parser)
  flags.GetDescriptionFlag('version').AddToParser(parser)
  flags.VERSION_NAME.AddToParser(parser)
  base.Argument(
      '--origin',
      help="""\
          Location of ```model/``` "directory" (as output by
          https://www.tensorflow.org/versions/r0.12/api_docs/python/state_ops.html#Saver).

          This overrides `deploymentUri` in the `--config` file. If this flag is
          not passed, `deploymentUri` *must* be specified in the file from
          `--config`.

          Can be a Google Cloud Storage (`gs://`) path or local file path (no
          prefix). In the latter case the files will be uploaded to Google Cloud
          Storage and a `--staging-bucket` argument is required.
      """).AddToParser(parser)
  flags.RUNTIME_VERSION.AddToParser(parser)
  base.ASYNC_FLAG.AddToParser(parser)
  flags.STAGING_BUCKET.AddToParser(parser)
  base.Argument(
      '--config',
      help="""\
          Path to a YAML configuration file containing configuration parameters
          for the
          [Version](https://cloud.google.com/ml/reference/rest/v1/projects.models.versions)
          to create.

          The file is in YAML format. Note that not all attributes of a Version
          are configurable; available attributes (with example values) are:

              description: A free-form description of the version.
              deploymentUri: gs://path/to/source
              runtimeVersion: '1.0'
              manualScaling:
                nodes: 10  # The number of nodes to allocate for this model.
              autoScaling:
                minNodes: 0  # The minimum number of nodes to allocate for this model.
              labels:
                user-defined-key: user-defined-value

          The name of the version must always be specified via the required
          VERSION argument.

          Only one of manualScaling or autoScaling must be specified. If both
          are specified in same yaml file an error will be returned.

          If an option is specified both in the configuration file and via
          command line arguments, the command line arguments override the
          configuration file.
      """
  ).AddToParser(parser)
  labels_util.AddCreateLabelsFlags(parser)
Ejemplo n.º 4
0
def _AddCreateArgs(parser):
    """Get arguments for the `ml-engine models create` command."""
    flags.GetModelName().AddToParser(parser)
    flags.GetDescriptionFlag('model').AddToParser(parser)
    parser.add_argument('--regions',
                        metavar='REGION',
                        type=arg_parsers.ArgList(min_length=1),
                        help="""\
The Google Cloud region where the model will be deployed (currently only a
single region is supported).

Will soon be required, but defaults to 'us-central1' for now.
""")
    parser.add_argument(
        '--enable-logging',
        action='store_true',
        help=('If set, enables StackDriver Logging for online prediction.'))
    labels_util.AddCreateLabelsFlags(parser)
Ejemplo n.º 5
0
def _AddUpdateArgs(parser):
    """Get arguments for the `ai-platform versions update` command."""
    flags.AddVersionResourceArg(parser, 'to update')
    flags.GetDescriptionFlag('version').AddToParser(parser)
    flags.GetRegionArg(include_global=True).AddToParser(parser)
    labels_util.AddUpdateLabelsFlags(parser)
    base.Argument('--config',
                  metavar='YAML_FILE',
                  help="""\
          Path to a YAML configuration file containing configuration parameters
          for the
          [version](https://cloud.google.com/ml/reference/rest/v1/projects.models.versions)
          to create.

          The file is in YAML format. Note that not all attributes of a version
          are configurable; available attributes (with example values) are:

              description: A free-form description of the version.
              manualScaling:
                nodes: 10  # The number of nodes to allocate for this model.
              autoScaling:
                minNodes: 0  # The minimum number of nodes to allocate for this model.
                maxNodes: 1  # The maxinum number of nodes to allocate for this model.
              requestLoggingconfig:
                bigqueryTableName: someTable  # Fully qualified BigQuery table name.
                samplingPercentage: 0.5  # Percentage of requests to be logged.

          The name of the version must always be specified via the required
          VERSION argument.

          Only one of manualScaling or autoScaling can be specified. If both
          are specified in same yaml file, an error will be returned.

          Labels cannot currently be set in the config.yaml; please use
          the command-line flags to alter them.

          If an option is specified both in the configuration file and via
          command-line arguments, the command-line arguments override the
          configuration file.
      """).AddToParser(parser)
def _AddCreateArgs(parser,
                   support_console_logging=False):
  """Get arguments for the `ai-platform models create` command."""
  flags.GetModelName().AddToParser(parser)
  flags.GetDescriptionFlag('model').AddToParser(parser)
  region_group = parser.add_mutually_exclusive_group()
  region_group.add_argument(
      '--region',
      choices=constants.SUPPORTED_REGIONS_WITH_GLOBAL,
      help=_REGION_FLAG_HELPTEXT)
  region_group.add_argument(
      '--regions',
      metavar='REGION',
      type=arg_parsers.ArgList(min_length=1),
      help="""\
The Google Cloud region where the model will be deployed (currently only a
single region is supported) against the global endpoint.

If you specify this flag, do not specify `--region`.

Defaults to 'us-central1' while using the global endpoint.
""")
  parser.add_argument(
      '--enable-logging',
      action='store_true',
      help='If set, enables StackDriver Logging for online prediction. These '
           'logs are like standard server access logs, containing information '
           'such as timestamps and latency for each request.')
  if support_console_logging:
    parser.add_argument(
        '--enable-console-logging',
        action='store_true',
        help='If set, enables StackDriver Logging of stderr and stdout streams '
             'for online prediction. These logs are more verbose than the '
             'standard access logs and can be helpful for debugging.')
  labels_util.AddCreateLabelsFlags(parser)
Ejemplo n.º 7
0
def _AddUpdateArgs(parser):
    """Get arguments for the `ai-platform models update` command."""
    flags.GetModelName().AddToParser(parser)
    flags.GetDescriptionFlag('model').AddToParser(parser)
    labels_util.AddUpdateLabelsFlags(parser)
Ejemplo n.º 8
0
def _AddUpdateArgs(parser):
    """Get arguments for the `ml-engine versions update` command."""
    flags.AddVersionResourceArg(parser, 'to update')
    flags.GetDescriptionFlag('version').AddToParser(parser)
    labels_util.AddUpdateLabelsFlags(parser)
Ejemplo n.º 9
0
def _AddUpdateArgs(parser, hide_region_arg=True):
  """Get arguments for the `ai-platform versions update` command."""
  flags.AddVersionResourceArg(parser, 'to update')
  flags.GetDescriptionFlag('version').AddToParser(parser)
  flags.GetRegionArg(hidden=hide_region_arg).AddToParser(parser)
  labels_util.AddUpdateLabelsFlags(parser)