
    '                     ,   d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	d
Zej                   ej                   ej"                  j$                  ej"                  j&                         G d dej(                                      Zee_        y)z.Create command for Colab Enterprise Schedules.    )util)	schedules)base)endpoint_util)flags)logzQ
        Create a schedule to run a Colab Enterprise notebook execution job.
    a  
      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`,
        - compute configured from runtime template `my-runtime-template-id`,
        - running with service account `my-service-account@my-project.iam.gserviceaccount.com`,
        - with results uploaded to Cloud Storage bucket `gs://my-bucket/results`

      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 --notebook-runtime-template=my-runtime-template-id --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
    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)CreatezCreate a schedule.c                 2    t        j                  | d       y)z^Register flags for this command.

    Args:
      parser: argparse parser for the command
    F)	is_updateN)r   AddCreateOrUpdateScheduleFlags)parsers    %lib/surface/colab/schedules/create.pyArgszCreate.Args6   s     
((5A    c                    | j                         }t        j                  | j                               }|j                  j                  j                         }|j                         d   }t        j                  d|      5  t        j                  |      }|j                  }|j                  t        j                  ||            }t        j                  |j                   d       |cddd       S # 1 sw Y   yxY w)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regionschedule)resourcekindN)ReleaseTrackr   GetMessagesCONCEPTSr   ParseAsDictr   AiplatformEndpointOverrides	GetClientprojects_locations_schedulesr   schedules_utilCreateScheduleCreateRequestr   CreatedResourcename)	selfargsrelease_trackmessages
region_refr   
api_clientschedules_servicer   s	            r   Runz
Create.Run?   s     %%'M 1 1 34H%%++-J /F		2	2v
 >>-0j$AA"))

4
4T8
Dh 
8==zB
 
 
s   A)C55C>N)__name__
__module____qualname____doc__staticmethodr   r/    r   r   r   r   1   s      B Br   r   N)r3   'googlecloudsdk.api_lib.colab_enterpriser   (googlecloudsdk.api_lib.notebook_executorr   r$   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   ,googlecloudsdk.command_lib.notebook_executorr   googlecloudsdk.corer   _DETAILED_HELPDefaultUniverseOnlyReleaseTracksr   GAr   CreateCommandr   detailed_helpr5   r   r   <module>rB      s     5 8 P ( 7 > #	0 D%%(($*;*;*@*@A#T # B #L & r   