
    &                        S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	K
Jr  SS
K
Jr  SSK
Jr  SSKJr  SS0rS r\	R&                  " \	R(                  R*                  5       " S S\	R,                  5      5       r\	R&                  " \	R(                  R0                  5       " S S\5      5       r\	R&                  " \	R(                  R4                  5       " S S\5      5       rg)z$ai-platform versions create command.    )absolute_import)division)unicode_literals)
operations)versions_api)base)endpoint_util)flags)region_util)versions_util)labels_utilEXAMPLESz        To create an AI Platform version model with the version ID 'versionId'
        and with the name 'model-name', run:

          $ {command} versionId --model=model-name
        c                    [         R                  " SSS9R                  U 5        [         R                  " S5      R                  U 5        [         R                  " SS9R                  U 5        [         R
                  R                  U 5        [        R                  " SSS9R                  U 5        [         R                  R                  U 5        [        R                  R                  U 5        [         R                  R                  U 5        [        R                  " S	S
S9R                  U 5        [        R                  " U 5        [         R                  R                  R                  U 5        [         R                  " U S5        [         R                   " U 5        [         R"                  " 5       R                  U 5        [         R$                  " U 5        g)z3Add common arguments for `versions create` command.FT)
positionalrequiredversion)include_globalz--origina            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.
      )helpz--configaE            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.
      zwhen creating the versionN)r
   GetModelNameAddToParserGetDescriptionFlagGetRegionArgVERSION_NAMEr   ArgumentRUNTIME_VERSION
ASYNC_FLAGSTAGING_BUCKETr   AddCreateLabelsFlagsFRAMEWORK_MAPPER
choice_argAddPythonVersionFlagAddMachineTypeFlagToParserGetAcceleratorFlagAddAutoScalingFlagsparsers    *lib/surface/ai_platform/versions/create.py_AddCreateArgsr(   )   sJ   5AA&I9%11&9D)55f=  (--
 ;v##F+//f%""6*--
 @ K""6*##//7V%@A""6*((0F#    c                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)CreateGAi   Create a new AI Platform version.

Creates a new version of an AI Platform model.

For more details on managing AI Platform models and versions see
https://cloud.google.com/ai-platform/prediction/docs/managing-models-jobs
c                     [        U 5        g N)r(   r%   s    r'   ArgsCreateGA.Argsu   s
    6r)   c                 ,   [         R                  " U5      n[        R                  " US9   [        R
                  " 5       n[        R                  " X15      n[        R                  R                  UR                  5      n[        R                  " UR                  5      n[        R                  " U[        R                   " 5       UR"                  40 SUR$                  _SUR&                  _SUR(                  _SUR*                  _SUR,                  _SUR.                  _SUR0                  _S	U_S
UR2                  _SU_SUR4                  _SU_SUR6                  _SUR8                  _SUR:                  _SS_6sS S S 5        $ ! , (       d  f       g = f)Nregionmodeloriginstaging_bucketruntime_versionconfig_fileasyncronousdescriptionlabelsmachine_type	frameworkpython_versionaccelerator_config	min_nodes	max_nodesmetricsautoscaling_hiddenF)r   	GetRegionr	   MlEndpointOverridesr   VersionsClientr   ParseCreateLabelsr
   r   GetEnumForChoicer>   ParseAcceleratorFlagacceleratorCreater   OperationsClientr   r5   r6   r7   r8   configasync_r;   r=   r?   rA   rB   metric_targetsselfargsr4   clientr<   r>   rK   s          r'   RunCreateGA.Runy   sz   ""4(F		*	*&	9**,f..v<f((99$..Ii..t/?/?@k!!


%
%
'
,,$ 

	$
 $ ,,$ ..$ kk$ kk$ &&$ $ (($ $ ,,$ )$  NN!$" NN#$$ %%%$& #'$ 
:	9	9s   EF
F N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr0   rU   __static_attributes__rW   r)   r'   r+   r+   i   s%      - $r)   r+   c                   .    \ rS rSrSr\S 5       rS rSrg)
CreateBeta   r-   c                     [        U 5        [        R                  R                  U 5        [        R                  " U 5        [        R
                  " U 5        [        R                  " U 5        g r/   )r(   r
   SERVICE_ACCOUNTr   AddUserCodeArgsAddExplainabilityFlagsAddContainerFlagsr%   s    r'   r0   CreateBeta.Args   sH    6	%%f-	&!	  (	F#r)   c                    [         R                  " U5      n[        R                  " US9   [        R
                  " 5       n[        R                  " X15      n[        R                  R                  UR                  5      n[        R                  " UR                  5      n[        R                  " U[        R                   " 5       UR"                  40 SUR$                  _SUR&                  _SUR(                  _SUR*                  _SUR,                  _SUR.                  _SUR0                  _S	U_S
UR2                  _SU_SUR4                  _SUR6                  _SUR8                  _SUR:                  _SU_SUR<                  _SUR>                  _SUR@                  _SURB                  _SURD                  _SURF                  _SURH                  _SURJ                  _SURL                  _SURN                  _SURP                  _SURR                  _SURT                  _SS_S S_6sS S S 5        $ ! , (       d  f       g = f)!Nr3   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   service_accountprediction_classpackage_urisr@   explanation_methodnum_integral_steps	num_pathsimagecommandcontainer_argsenv_varsportspredict_routehealth_routerA   rB   rC   containers_hiddenFrD   )+r   rE   r	   rF   r   rG   r   rH   r
   r   rI   r>   rJ   rK   rL   r   rM   r   r5   r6   r7   r8   rN   rO   r;   r=   r?   rk   rl   rm   rn   ro   rp   rq   rr   rS   rt   ru   rv   rw   rA   rB   rP   rQ   s          r'   rU   CreateBeta.Run   sL   ""4(F		*	*&	9**,f..v<f((99$..Ii..t/?/?@k!!


%
%
'
,,!$ 

	!$
 !$ ,,!$ ..!$ kk!$ kk!$ &&!$ !$ ((!$ !$ ,,!$ ..!$   00!!$" ((#!$$ )%!$& "44'!$( "44)!$* NN+!$, 

-!$. ,,/!$0 1!$2 ==3!$4 

5!$6 **7!$8 ((9!$: NN;!$< NN=!$> %%?!$@ "A!$B #C!$ 
:	9	9   G<H11
H?rW   N	rX   rY   rZ   r[   r\   r_   r0   rU   r`   rW   r)   r'   rb   rb      s      $ $($r)   rb   c                   .    \ rS rSrSr\S 5       rS rSrg)CreateAlpha   r-   c                 .    [         R                  U 5        g r/   )rb   r0   r%   s    r'   r0   CreateAlpha.Args   s    OOFr)   c                    [         R                  " U5      n[        R                  " US9   [        R
                  " 5       n[        R                  " X15      n[        R                  R                  UR                  5      n[        R                  " UR                  5      n[        R                  " U[        R                   " 5       UR"                  40 SUR$                  _SUR&                  _SUR(                  _SUR*                  _SUR,                  _SUR.                  _SU_S	UR0                  _S
UR2                  _SU_SUR4                  _SUR6                  _SUR8                  _SUR:                  _SU_SUR<                  _SUR>                  _SUR@                  _SURB                  _SURD                  _SURF                  _SURH                  _SURJ                  _SURL                  _SURN                  _SURP                  _SURR                  _SURT                  _SS_S S_6sS S S 5        $ ! , (       d  f       g = f)!Nr3   r5   r6   r7   r8   r9   r:   r<   r;   r=   r>   r?   rl   rm   rk   r@   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rA   rB   rC   rx   FrD   )+r   rE   r	   rF   r   rG   r   rH   r
   r   rI   r>   rJ   rK   rL   r   rM   r   r5   r6   r7   r8   rN   rO   r;   r=   r?   rl   rm   rk   rn   ro   rp   rq   rr   rS   rt   ru   rv   rw   rA   rB   rP   rQ   s          r'   rU   CreateAlpha.Run   sL   ""4(F		*	*&	9**,f..v<f((99$..Ii..t/?/?@k!!


%
%
'
,,!$ 

	!$
 !$ ,,!$ ..!$ kk!$ kk!$ !$ &&!$ ((!$ !$ ,,!$  00!$  ((!!$" ..#!$$ )%!$& "44'!$( "44)!$* NN+!$, 

-!$. ,,/!$0 1!$2 ==3!$4 

5!$6 **7!$8 ((9!$: NN;!$< NN=!$> %%?!$@ "A!$B #C!$ 
:	9	9rz   rW   Nr{   rW   r)   r'   r}   r}      s       ($r)   r}   N)r\   
__future__r   r   r    googlecloudsdk.api_lib.ml_enginer   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.ml_enginer	   r
   r   r   $googlecloudsdk.command_lib.util.argsr   r]   r(   ReleaseTracksReleaseTrackGACreateCommandr+   BETArb   ALPHAr}   rW   r)   r'   <module>r      s    + &  ' 7 9 ( > 6 < > < 	=$@ D%%(())$t!! )$ *)$X D%%**+9$ 9$ ,9$x D%%++,5$* 5$ -5$r)   