
                         J   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  \R                   r\	R"                  rS
SS.r\R&                  \R(                  " \R*                  R,                  5       " S S\R.                  5      5       5       r\\l        g)z'Create command for Workbench Schedules.    )util)	schedules)base)parser_arguments)parser_extensions)endpoint_util)flags)logzJ
        Create a schedule to run a Workbench notebook execution job.
    al  
      To create a schedule in region `us-central1` with the following schedule properties:
        - display name: `my-schedule`,
        - cron schedule: `TZ=America/Los_Angeles * * * * *`,
        - maximum concurrent runs allowed: 1,
        - start time: 2025-01-01T00:00:00-06:00,

      for a notebook execution job:
        - with display name `my-execution`,
        - running notebook file from Cloud Storage URI `gs://my-bucket/my-notebook.ipynb`,
        - running with service account `my-service-account@my-project.iam.gserviceaccount.com`,
        - with results uploaded to Cloud Storage bucket `gs://my-bucket/results`
        - with machine type `n1-standard-4`,

      Run the following command:
        $ {command} --region=us-central1 --display-name=my-schedule --cron-schedule='TZ=America/Los_Angeles * * * * *' --max-concurrent-runs=1 --start-time=2025-01-01T00:00:00-06:00 --execution-display-name=my-execution --gcs-notebook-uri=gs://my-bucket/my-notebook.ipynb --service-account=my-service-account@my-project.iam.gserviceaccount.com --gcs-output-uri=gs://my-bucket/results --machine-type=n1-standard-4
    )DESCRIPTIONEXAMPLESc                   >    \ rS rSrSr\S\4S j5       rS\4S jr	Sr
g)	Create7   zCreate a schedule.parserc                 0    [         R                  " U SSS9  g)zRRegister flags for this command.

Args:
  parser: argparse parser for the command
FT)	is_updatefor_workbenchN)r	   AddCreateOrUpdateScheduleFlags)r   s    )lib/surface/workbench/schedules/create.pyArgsCreate.Args<   s     
((%t    argsc           	         U R                  5       n[        R                  " U R                  5       5      nUR                  R                  R                  5       nUR                  5       S   n[        R                  " SUS9   [        R                  " U5      nUR                  nUR                  [        R                  " XSS95      n[        R                  " UR                   SS9  UsSSS5        $ ! , (       d  f       g= f)	zThis is what gets called when the user runs this command.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.

Returns:
  The API response for creating the schedule.
locationsIdBETA)versionregionT)r   schedule)resourcekindN)ReleaseTrackr   GetMessagesCONCEPTSr   ParseAsDictr   AiplatformEndpointOverrides	GetClientprojects_locations_schedulesr   schedules_utilCreateScheduleCreateRequestr
   CreatedResourcename)	selfr   release_trackmessages
region_refr   
api_clientschedules_servicer   s	            r   Run
Create.RunG   s     %%'M 1 1 34H%%++-J /F		2	2v
 >>-0j$AA"))

4
4Dh
 
8==zB
 
 
s   A'C22
D  N)__name__
__module____qualname____firstlineno____doc__staticmethodArgumentInterceptorr   	Namespacer4   __static_attributes__r6   r   r   r   r   7   s-     &  i r   r   N)r;   'googlecloudsdk.api_lib.colab_enterpriser   (googlecloudsdk.api_lib.notebook_executorr   r*   googlecloudsdk.callioper   r   r   googlecloudsdk.command_lib.air   ,googlecloudsdk.command_lib.notebook_executorr	   googlecloudsdk.corer
   r=   r>   _DETAILED_HELPDefaultUniverseOnlyReleaseTracksr"   r   CreateCommandr   detailed_helpr6   r   r   <module>rK      s     . 8 P ( 4 5 7 > # ':: ''		0 D%%**+'T ' , 'T & r   