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

access_token

string

The access token used to authenticate.

allow_queueing

boolean

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:

  • false

  • true

auth_kind

string / required

The type of credential used.

Choices:

  • "accesstoken"

  • "application"

  • "machineaccount"

  • "serviceaccount"

create_notebook_execution_job_request

dictionary / required

Request for google_colab_notebook_execution.

This property is immutable, to change it, you must delete and recreate the resource.

notebook_execution_job

dictionary / required

The NotebookExecutionJob to create.

dataform_repository_source

dictionary

The Dataform Repository containing the input notebook.

commit_sha

string

The commit SHA to read repository with.

If unset, the file will be read at HEAD.

dataform_repository_resource_name

string / required

The resource name of the Dataform Repository.

display_name

string / required

The display name of the Notebook Execution.

execution_timeout

string

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”.

execution_user

string

The user email to run the execution as.

gcs_notebook_source

dictionary

The Cloud Storage uri for the input notebook.

generation

string

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.

uri

string / required

The Cloud Storage uri pointing to the ipynb file.

Format: gs://bucket/notebook_file.ipynb.

gcs_output_uri

string / required

The Cloud Storage location to upload the result to.

Format:`gs://bucket-name`.

notebook_runtime_template_resource_name

string / required

The NotebookRuntimeTemplate to source compute configuration from.

service_account

string

The service account to run the execution as.

cron

string / required

Cron schedule (https://en.wikipedia.org/wiki/Cron) to launch scheduled runs.

desired_state

string

Desired state of the Colab Schedule.

Set this field to `ACTIVE` to start/resume the schedule, and `PAUSED` to pause the schedule.

Choices:

  • "ACTIVE" ← (default)

  • "PAUSED"

display_name

string / required

The display name of the Schedule.

end_time

string

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.

env_type

string

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.

location

string / required

The location for the resource: https://cloud.google.com/colab/docs/locations.

max_concurrent_run_count

string / required

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.

max_run_count

string

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.

project

string

The Google Cloud Platform project to use.

scopes

list / elements=string

Array of scopes to be used.

service_account_contents

jsonarg

The contents of a Service Account JSON file,

either in a dictionary or as a JSON string that represents it.

service_account_email

string

An optional service account email address if machineaccount is

selected and the user does not wish to use the default email.

service_account_file

path

The path of a Service Account JSON file if serviceaccount

is selected as type.

start_time

string

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.

state

string

Whether the resource should exist in GCP.

Choices:

  • "present" ← (default)

  • "absent"

Notes

Note

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

changed

boolean

Whether the resource was changed.

Returned: always

name

string

The resource name of the Schedule.

Returned: success

state

string

Output only.

The state of the schedule.

Returned: success

Authors

  • Google Inc. (@googlecloudplatform)