@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
582 lines • 21.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* 'An instance of a notebook Execution'
*
* To get more information about NotebookExecution, see:
*
* * [API documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookExecutionJobs)
* * How-to Guides
* * [Schedule a notebook run](https://cloud.google.com/colab/docs/schedule-notebook-run)
*
* ## Example Usage
*
* ### Colab Notebook Execution Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const myRuntimeTemplate = new gcp.colab.RuntimeTemplate("my_runtime_template", {
* name: "runtime-template-name",
* displayName: "Runtime template",
* location: "us-central1",
* machineSpec: {
* machineType: "e2-standard-4",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* });
* const outputBucket = new gcp.storage.Bucket("output_bucket", {
* name: "my_bucket",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const notebook_execution = new gcp.colab.NotebookExecution("notebook-execution", {
* displayName: "Notebook execution basic",
* location: "us-central1",
* directNotebookSource: {
* content: std.base64encode({
* input: ` {
* \\"cells\\": [
* {
* \\"cell_type\\": \\"code\\",
* \\"execution_count\\": null,
* \\"metadata\\": {},
* \\"outputs\\": [],
* \\"source\\": [
* \\"print(\\\\\\"Hello, World!\\\\\\")\\"
* ]
* }
* ],
* \\"metadata\\": {
* \\"kernelspec\\": {
* \\"display_name\\": \\"Python 3\\",
* \\"language\\": \\"python\\",
* \\"name\\": \\"python3\\"
* },
* \\"language_info\\": {
* \\"codemirror_mode\\": {
* \\"name\\": \\"ipython\\",
* \\"version\\": 3
* },
* \\"file_extension\\": \\".py\\",
* \\"mimetype\\": \\"text/x-python\\",
* \\"name\\": \\"python\\",
* \\"nbconvert_exporter\\": \\"python\\",
* \\"pygments_lexer\\": \\"ipython3\\",
* \\"version\\": \\"3.8.5\\"
* }
* },
* \\"nbformat\\": 4,
* \\"nbformat_minor\\": 4
* }
* `,
* }).then(invoke => invoke.result),
* },
* notebookRuntimeTemplateResourceName: pulumi.interpolate`projects/${myRuntimeTemplate.project}/locations/${myRuntimeTemplate.location}/notebookRuntimeTemplates/${myRuntimeTemplate.name}`,
* gcsOutputUri: pulumi.interpolate`gs://${outputBucket.name}`,
* serviceAccount: "my@service-account.com",
* }, {
* dependsOn: [
* myRuntimeTemplate,
* outputBucket,
* ],
* });
* ```
* ### Colab Notebook Execution Custom Env
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const myNetwork = new gcp.compute.Network("my_network", {
* name: "colab-test-default",
* autoCreateSubnetworks: false,
* });
* const mySubnetwork = new gcp.compute.Subnetwork("my_subnetwork", {
* name: "colab-test-default",
* network: myNetwork.id,
* region: "us-central1",
* ipCidrRange: "10.0.1.0/24",
* });
* const outputBucket = new gcp.storage.Bucket("output_bucket", {
* name: "my_bucket",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const notebook_execution = new gcp.colab.NotebookExecution("notebook-execution", {
* displayName: "Notebook execution basic",
* location: "us-central1",
* directNotebookSource: {
* content: std.base64encode({
* input: ` {
* \\"cells\\": [
* {
* \\"cell_type\\": \\"code\\",
* \\"execution_count\\": null,
* \\"metadata\\": {},
* \\"outputs\\": [],
* \\"source\\": [
* \\"print(\\\\\\"Hello, World!\\\\\\")\\"
* ]
* }
* ],
* \\"metadata\\": {
* \\"kernelspec\\": {
* \\"display_name\\": \\"Python 3\\",
* \\"language\\": \\"python\\",
* \\"name\\": \\"python3\\"
* },
* \\"language_info\\": {
* \\"codemirror_mode\\": {
* \\"name\\": \\"ipython\\",
* \\"version\\": 3
* },
* \\"file_extension\\": \\".py\\",
* \\"mimetype\\": \\"text/x-python\\",
* \\"name\\": \\"python\\",
* \\"nbconvert_exporter\\": \\"python\\",
* \\"pygments_lexer\\": \\"ipython3\\",
* \\"version\\": \\"3.8.5\\"
* }
* },
* \\"nbformat\\": 4,
* \\"nbformat_minor\\": 4
* }
* `,
* }).then(invoke => invoke.result),
* },
* customEnvironmentSpec: {
* machineSpec: {
* machineType: "n1-standard-2",
* acceleratorType: "NVIDIA_TESLA_T4",
* acceleratorCount: 1,
* },
* persistentDiskSpec: {
* diskType: "pd-standard",
* diskSizeGb: "200",
* },
* networkSpec: {
* enableInternetAccess: true,
* network: myNetwork.id,
* subnetwork: mySubnetwork.id,
* },
* },
* gcsOutputUri: pulumi.interpolate`gs://${outputBucket.name}`,
* serviceAccount: "my@service-account.com",
* }, {
* dependsOn: [outputBucket],
* });
* ```
* ### Colab Notebook Execution Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myRuntimeTemplate = new gcp.colab.RuntimeTemplate("my_runtime_template", {
* name: "runtime-template-name",
* displayName: "Runtime template",
* location: "us-central1",
* machineSpec: {
* machineType: "e2-standard-4",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* });
* const outputBucket = new gcp.storage.Bucket("output_bucket", {
* name: "my_bucket",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const notebook = new gcp.storage.BucketObject("notebook", {
* name: "hello_world.ipynb",
* bucket: outputBucket.name,
* content: ` {
* \\"cells\\": [
* {
* \\"cell_type\\": \\"code\\",
* \\"execution_count\\": null,
* \\"metadata\\": {},
* \\"outputs\\": [],
* \\"source\\": [
* \\"print(\\\\\\"Hello, World!\\\\\\")\\"
* ]
* }
* ],
* \\"metadata\\": {
* \\"kernelspec\\": {
* \\"display_name\\": \\"Python 3\\",
* \\"language\\": \\"python\\",
* \\"name\\": \\"python3\\"
* },
* \\"language_info\\": {
* \\"codemirror_mode\\": {
* \\"name\\": \\"ipython\\",
* \\"version\\": 3
* },
* \\"file_extension\\": \\".py\\",
* \\"mimetype\\": \\"text/x-python\\",
* \\"name\\": \\"python\\",
* \\"nbconvert_exporter\\": \\"python\\",
* \\"pygments_lexer\\": \\"ipython3\\",
* \\"version\\": \\"3.8.5\\"
* }
* },
* \\"nbformat\\": 4,
* \\"nbformat_minor\\": 4
* }
* `,
* });
* const notebook_execution = new gcp.colab.NotebookExecution("notebook-execution", {
* notebookExecutionJobId: "colab-notebook-execution",
* displayName: "Notebook execution full",
* location: "us-central1",
* executionTimeout: "86400s",
* gcsNotebookSource: {
* uri: pulumi.interpolate`gs://${notebook.bucket}/${notebook.name}`,
* generation: notebook.generation.apply(x =>String(x)),
* },
* serviceAccount: "my@service-account.com",
* gcsOutputUri: pulumi.interpolate`gs://${outputBucket.name}`,
* notebookRuntimeTemplateResourceName: pulumi.interpolate`projects/${myRuntimeTemplate.project}/locations/${myRuntimeTemplate.location}/notebookRuntimeTemplates/${myRuntimeTemplate.name}`,
* }, {
* dependsOn: [
* notebook,
* outputBucket,
* myRuntimeTemplate,
* ],
* });
* ```
* ### Colab Notebook Execution Dataform
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myRuntimeTemplate = new gcp.colab.RuntimeTemplate("my_runtime_template", {
* name: "runtime-template-name",
* displayName: "Runtime template",
* location: "us-central1",
* machineSpec: {
* machineType: "e2-standard-4",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* });
* const outputBucket = new gcp.storage.Bucket("output_bucket", {
* name: "my_bucket",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* });
* const secret = new gcp.secretmanager.Secret("secret", {
* secretId: "secret",
* replication: {
* auto: {},
* },
* });
* const secretVersion = new gcp.secretmanager.SecretVersion("secret_version", {
* secret: secret.id,
* secretData: "secret-data",
* });
* const dataformRepository = new gcp.dataform.Repository("dataform_repository", {
* name: "dataform-repository",
* displayName: "dataform_repository",
* npmrcEnvironmentVariablesSecretVersion: secretVersion.id,
* kmsKeyName: "my-crypto-key",
* labels: {
* label_foo1: "label-bar1",
* },
* gitRemoteSettings: {
* url: "https://github.com/OWNER/REPOSITORY.git",
* defaultBranch: "main",
* authenticationTokenSecretVersion: secretVersion.id,
* },
* workspaceCompilationOverrides: {
* defaultDatabase: "database",
* schemaSuffix: "_suffix",
* tablePrefix: "prefix_",
* },
* });
* const notebook_execution = new gcp.colab.NotebookExecution("notebook-execution", {
* displayName: "Notebook execution Dataform",
* location: "us-central1",
* dataformRepositorySource: {
* commitSha: "randomsha123",
* dataformRepositoryResourceName: pulumi.interpolate`projects/${myRuntimeTemplate.project}/locations/${myRuntimeTemplate.location}/repositories/${dataformRepository.name}`,
* },
* notebookRuntimeTemplateResourceName: pulumi.interpolate`projects/${myRuntimeTemplate.project}/locations/${myRuntimeTemplate.location}/notebookRuntimeTemplates/${myRuntimeTemplate.name}`,
* gcsOutputUri: pulumi.interpolate`gs://${outputBucket.name}`,
* serviceAccount: "my@service-account.com",
* }, {
* dependsOn: [
* myRuntimeTemplate,
* outputBucket,
* secretVersion,
* dataformRepository,
* secret,
* ],
* });
* ```
*
* ## Import
*
* NotebookExecution can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/notebookExecutionJobs/{{notebook_execution_job_id}}`
* * `{{project}}/{{location}}/{{notebook_execution_job_id}}`
* * `{{location}}/{{notebook_execution_job_id}}`
*
* When using the `pulumi import` command, NotebookExecution can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:colab/notebookExecution:NotebookExecution default projects/{{project}}/locations/{{location}}/notebookExecutionJobs/{{notebook_execution_job_id}}
* $ pulumi import gcp:colab/notebookExecution:NotebookExecution default {{project}}/{{location}}/{{notebook_execution_job_id}}
* $ pulumi import gcp:colab/notebookExecution:NotebookExecution default {{location}}/{{notebook_execution_job_id}}
* ```
*/
export declare class NotebookExecution extends pulumi.CustomResource {
/**
* Get an existing NotebookExecution resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NotebookExecutionState, opts?: pulumi.CustomResourceOptions): NotebookExecution;
/**
* Returns true if the given object is an instance of NotebookExecution. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is NotebookExecution;
/**
* Compute configuration to use for an execution job
* Structure is documented below.
*/
readonly customEnvironmentSpec: pulumi.Output<outputs.colab.NotebookExecutionCustomEnvironmentSpec | undefined>;
/**
* The Dataform Repository containing the input notebook.
* Structure is documented below.
*/
readonly dataformRepositorySource: pulumi.Output<outputs.colab.NotebookExecutionDataformRepositorySource | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* The content of the input notebook in ipynb format.
* Structure is documented below.
*/
readonly directNotebookSource: pulumi.Output<outputs.colab.NotebookExecutionDirectNotebookSource | undefined>;
/**
* Required. The display name of the Notebook Execution.
*/
readonly displayName: pulumi.Output<string>;
/**
* Max running time of the execution job in seconds (default 86400s / 24 hrs).
*/
readonly executionTimeout: pulumi.Output<string | undefined>;
/**
* The user email to run the execution as.
*/
readonly executionUser: pulumi.Output<string | undefined>;
/**
* The Cloud Storage uri for the input notebook.
* Structure is documented below.
*/
readonly gcsNotebookSource: pulumi.Output<outputs.colab.NotebookExecutionGcsNotebookSource | undefined>;
/**
* The Cloud Storage location to upload the result to. Format:`gs://bucket-name`
*/
readonly gcsOutputUri: pulumi.Output<string>;
/**
* The location for the resource: https://cloud.google.com/colab/docs/locations
*/
readonly location: pulumi.Output<string>;
/**
* User specified ID for the Notebook Execution Job
*/
readonly notebookExecutionJobId: pulumi.Output<string>;
/**
* The NotebookRuntimeTemplate to source compute configuration from.
*/
readonly notebookRuntimeTemplateResourceName: pulumi.Output<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* The service account to run the execution as.
*/
readonly serviceAccount: pulumi.Output<string | undefined>;
/**
* Create a NotebookExecution resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: NotebookExecutionArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering NotebookExecution resources.
*/
export interface NotebookExecutionState {
/**
* Compute configuration to use for an execution job
* Structure is documented below.
*/
customEnvironmentSpec?: pulumi.Input<inputs.colab.NotebookExecutionCustomEnvironmentSpec | undefined>;
/**
* The Dataform Repository containing the input notebook.
* Structure is documented below.
*/
dataformRepositorySource?: pulumi.Input<inputs.colab.NotebookExecutionDataformRepositorySource | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* The content of the input notebook in ipynb format.
* Structure is documented below.
*/
directNotebookSource?: pulumi.Input<inputs.colab.NotebookExecutionDirectNotebookSource | undefined>;
/**
* Required. The display name of the Notebook Execution.
*/
displayName?: pulumi.Input<string | undefined>;
/**
* Max running time of the execution job in seconds (default 86400s / 24 hrs).
*/
executionTimeout?: pulumi.Input<string | undefined>;
/**
* The user email to run the execution as.
*/
executionUser?: pulumi.Input<string | undefined>;
/**
* The Cloud Storage uri for the input notebook.
* Structure is documented below.
*/
gcsNotebookSource?: pulumi.Input<inputs.colab.NotebookExecutionGcsNotebookSource | undefined>;
/**
* The Cloud Storage location to upload the result to. Format:`gs://bucket-name`
*/
gcsOutputUri?: pulumi.Input<string | undefined>;
/**
* The location for the resource: https://cloud.google.com/colab/docs/locations
*/
location?: pulumi.Input<string | undefined>;
/**
* User specified ID for the Notebook Execution Job
*/
notebookExecutionJobId?: pulumi.Input<string | undefined>;
/**
* The NotebookRuntimeTemplate to source compute configuration from.
*/
notebookRuntimeTemplateResourceName?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* The service account to run the execution as.
*/
serviceAccount?: pulumi.Input<string | undefined>;
}
/**
* The set of arguments for constructing a NotebookExecution resource.
*/
export interface NotebookExecutionArgs {
/**
* Compute configuration to use for an execution job
* Structure is documented below.
*/
customEnvironmentSpec?: pulumi.Input<inputs.colab.NotebookExecutionCustomEnvironmentSpec | undefined>;
/**
* The Dataform Repository containing the input notebook.
* Structure is documented below.
*/
dataformRepositorySource?: pulumi.Input<inputs.colab.NotebookExecutionDataformRepositorySource | undefined>;
/**
* Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
* When a 'terraform destroy' or 'pulumi up' would delete the resource,
* the command will fail if this field is set to "PREVENT" in Terraform state.
* When set to "ABANDON", the command will remove the resource from Terraform
* management without updating or deleting the resource in the API.
* When set to "DELETE", deleting the resource is allowed.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* The content of the input notebook in ipynb format.
* Structure is documented below.
*/
directNotebookSource?: pulumi.Input<inputs.colab.NotebookExecutionDirectNotebookSource | undefined>;
/**
* Required. The display name of the Notebook Execution.
*/
displayName: pulumi.Input<string>;
/**
* Max running time of the execution job in seconds (default 86400s / 24 hrs).
*/
executionTimeout?: pulumi.Input<string | undefined>;
/**
* The user email to run the execution as.
*/
executionUser?: pulumi.Input<string | undefined>;
/**
* The Cloud Storage uri for the input notebook.
* Structure is documented below.
*/
gcsNotebookSource?: pulumi.Input<inputs.colab.NotebookExecutionGcsNotebookSource | undefined>;
/**
* The Cloud Storage location to upload the result to. Format:`gs://bucket-name`
*/
gcsOutputUri: pulumi.Input<string>;
/**
* The location for the resource: https://cloud.google.com/colab/docs/locations
*/
location: pulumi.Input<string>;
/**
* User specified ID for the Notebook Execution Job
*/
notebookExecutionJobId?: pulumi.Input<string | undefined>;
/**
* The NotebookRuntimeTemplate to source compute configuration from.
*/
notebookRuntimeTemplateResourceName?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* The service account to run the execution as.
*/
serviceAccount?: pulumi.Input<string | undefined>;
}
//# sourceMappingURL=notebookExecution.d.ts.map