google.cloud.gcp_colab_schedule module – Creates a GCP Colab.Schedule resource
Note
This module is part of the google.cloud collection (version 1.13.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install google.cloud.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: google.cloud.gcp_colab_schedule.
Synopsis
‘Colab Enterprise Notebook Execution Schedules.’
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.8
requests >= 2.18.4
google-auth >= 2.25.1
Parameters
Parameter |
Comments |
|---|---|
The access token used to authenticate. |
|
Whether new scheduled runs can be queued when max_concurrent_runs limit is reached. If set to true, new runs will be queued instead of skipped. Default to false. Choices:
|
|
The type of credential used. Choices:
|
|
Request for google_colab_notebook_execution. This property is immutable, to change it, you must delete and recreate the resource. |
|
The NotebookExecutionJob to create. |
|
The Dataform Repository containing the input notebook. |
|
The commit SHA to read repository with. If unset, the file will be read at HEAD. |
|
The resource name of the Dataform Repository. |
|
The display name of the Notebook Execution. |
|
Max running time of the execution job in seconds (default 86400s / 24 hrs). A duration in seconds with up to nine fractional digits, ending with “s”. Example: “3.5s”. |
|
The user email to run the execution as. |
|
The Cloud Storage uri for the input notebook. |
|
The version of the Cloud Storage object to read. If unset, the current version of the object is read. See https://cloud.google.com/storage/docs/metadata#generation-number. |
|
The Cloud Storage uri pointing to the ipynb file. Format: gs://bucket/notebook_file.ipynb. |
|
The Cloud Storage location to upload the result to. Format:`gs://bucket-name`. |
|
The NotebookRuntimeTemplate to source compute configuration from. |
|
The service account to run the execution as. |
|
Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled runs. |
|
Desired state of the Colab Schedule. Set this field to `ACTIVE` to start/resume the schedule, and `PAUSED` to pause the schedule. Choices:
|
|
The display name of the Schedule. |
|
Timestamp after which no new runs can be scheduled. If specified, the schedule will be completed when either end_time is reached or when scheduled_run_count >= max_run_count. Must be in the RFC 3339 (https://www.ietf.org/rfc/rfc3339.txt) format. |
|
Specifies which Ansible environment you’re running this module within. This should not be set unless you know what you’re doing. This only alters the User Agent string for any API requests. |
|
The location for the resource: https://cloud.google.com/colab/docs/locations. |
|
Maximum number of runs that can be started concurrently for this Schedule. This is the limit for starting the scheduled requests and not the execution of the notebook execution jobs created by the requests. |
|
Maximum run count of the schedule. If specified, The schedule will be completed when either startedRunCount >= maxRunCount or when endTime is reached. If not specified, new runs will keep getting scheduled until this Schedule is paused or deleted. Already scheduled runs will be allowed to complete. Unset if not specified. |
|
The Google Cloud Platform project to use. |
|
Array of scopes to be used. |
|
The contents of a Service Account JSON file, either in a dictionary or as a JSON string that represents it. |
|
An optional service account email address if machineaccount is selected and the user does not wish to use the default email. |
|
The path of a Service Account JSON file if serviceaccount is selected as type. |
|
The timestamp after which the first run can be scheduled. Defaults to the schedule creation time. Must be in the RFC 3339 (https://www.ietf.org/rfc/rfc3339.txt) format. |
|
Whether the resource should exist in GCP. Choices:
|
Notes
Note
API Reference: https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.schedules
Schedule a notebook run Guide: https://cloud.google.com/colab/docs/schedule-notebook-run
For authentication, you can set auth_kind using the
GCP_AUTH_KINDenv variable.For authentication, you can set service_account_file using the
GCP_SERVICE_ACCOUNT_FILEenv variable.For authentication, you can set service_account_contents using the
GCP_SERVICE_ACCOUNT_CONTENTSenv variable.For authentication, you can set service_account_email using the
GCP_SERVICE_ACCOUNT_EMAILenv variable.For authentication, you can set access_token using the
GCP_ACCESS_TOKENenv variable.For authentication, you can set scopes using the
GCP_SCOPESenv variable.Environment variables values will only be used if the playbook values are not set.
The
service_account_email,service_account_file,service_account_fileandaccess_tokenoptions are mutually exclusive.
Examples
- name: Create Basic Schedule
google.cloud.gcp_colab_schedule:
display_name: my-schedule
state: present
location: us-central1
max_concurrent_run_count: 2
cron: "TZ=America/Los_Angeles * * * * *"
create_notebook_execution_job_request:
notebook_execution_job:
display_name: my-notebook-execution
gcs_notebook_source:
uri: gs://my-bucket/input/my-notebook.json
notebook_runtime_template_resource_name: projects/my-project/locations/us-central1/notebookRuntimeTemplates/my-runtime-template
gcs_output_uri: gs://my-bucket/output/
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
################################################################################
- name: Create Paused Schedule
google.cloud.gcp_colab_schedule:
display_name: my-schedule
state: present
location: us-central1
desired_state: PAUSED
max_concurrent_run_count: 2
cron: "TZ=America/Los_Angeles * * * * *"
create_notebook_execution_job_request:
notebook_execution_job:
display_name: my-notebook-execution
gcs_notebook_source:
uri: gs://my-bucket/input/my-notebook.json
notebook_runtime_template_resource_name: projects/my-project/locations/us-central1/notebookRuntimeTemplates/my-runtime-template
gcs_output_uri: gs://my-bucket/output/
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Whether the resource was changed. Returned: always |
|
The resource name of the Schedule. Returned: success |
|
Output only. The state of the schedule. Returned: success |