@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
255 lines • 11.2 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AiSchedule = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* An online schedule that triggers running pipeline jobs or notebook execution jobs.
*
* ## Example Usage
*
* ### Vertex Ai Schedule
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "pipeline-job",
* location: "us-central1",
* uniformBucketLevelAccess: true,
* forceDestroy: true,
* });
* const schedule = new gcp.vertex.AiSchedule("schedule", {
* displayName: "test-schedule",
* location: "us-central1",
* maxConcurrentRunCount: "2",
* cron: "*/5 * * * *",
* allowQueueing: true,
* maxConcurrentActiveRunCount: "2",
* maxRunCount: "10",
* startTime: "2030-01-01T00:00:00Z",
* endTime: "2030-01-02T00:00:00Z",
* createPipelineJobRequest: {
* parent: project.then(project => `projects/${project.projectId}/locations/us-central1`),
* pipelineJob: {
* displayName: "test-pipeline-job",
* preflightValidations: true,
* labels: {
* key: "value-one",
* },
* pipelineSpec: JSON.stringify({
* pipelineInfo: {
* name: "hello-world",
* },
* root: {
* dag: {
* tasks: {},
* },
* },
* schemaVersion: "2.1.0",
* sdkVersion: "kfp-2.0.0",
* }),
* runtimeConfig: {
* gcsOutputDirectory: pulumi.interpolate`gs://${bucket.name}/pipeline_root`,
* failurePolicy: "PIPELINE_FAILURE_POLICY_FAIL_FAST",
* },
* },
* },
* });
* ```
* ### Vertex Ai Schedule Notebook
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "notebook-job",
* location: "us-central1",
* uniformBucketLevelAccess: true,
* forceDestroy: true,
* });
* const notebook = new gcp.storage.BucketObject("notebook", {
* name: "notebook.ipynb",
* content: "{ \"cells\": [], \"metadata\": {}, \"nbformat\": 4, \"nbminor\": 0 }",
* bucket: bucket.name,
* });
* const schedule = new gcp.vertex.AiSchedule("schedule", {
* displayName: "test-schedule-notebook",
* location: "us-central1",
* maxConcurrentRunCount: "2",
* cron: "*/5 * * * *",
* startTime: "2030-01-01T00:00:00Z",
* createNotebookExecutionJobRequest: {
* parent: project.then(project => `projects/${project.projectId}/locations/us-central1`),
* notebookExecutionJob: {
* displayName: "test-notebook-execution-job",
* gcsOutputUri: pulumi.interpolate`gs://${bucket.name}`,
* serviceAccount: project.then(project => `${project.number}-compute@developer.gserviceaccount.com`),
* gcsNotebookSource: {
* uri: pulumi.interpolate`gs://${bucket.name}/${notebook.name}`,
* generation: notebook.generation.apply(x =>String(x)),
* },
* customEnvironmentSpec: {
* machineSpec: {
* machineType: "n1-standard-4",
* acceleratorType: "NVIDIA_TESLA_T4",
* acceleratorCount: 1,
* },
* persistentDiskSpec: {
* diskSizeGb: "100",
* diskType: "pd-standard",
* },
* networkSpec: {
* enableInternetAccess: true,
* },
* },
* executionTimeout: "86400s",
* kernelName: "python3",
* labels: {
* test: "value",
* },
* },
* },
* });
* ```
*
* ## Import
*
* Schedule can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/schedules/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, Schedule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:vertex/aiSchedule:AiSchedule default projects/{{project}}/locations/{{location}}/schedules/{{name}}
* $ pulumi import gcp:vertex/aiSchedule:AiSchedule default {{project}}/{{location}}/{{name}}
* $ pulumi import gcp:vertex/aiSchedule:AiSchedule default {{location}}/{{name}}
* ```
*/
class AiSchedule extends pulumi.CustomResource {
/**
* Get an existing AiSchedule 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, id, state, opts) {
return new AiSchedule(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:vertex/aiSchedule:AiSchedule';
/**
* Returns true if the given object is an instance of AiSchedule. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === AiSchedule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowQueueing"] = state?.allowQueueing;
resourceInputs["catchUp"] = state?.catchUp;
resourceInputs["createNotebookExecutionJobRequest"] = state?.createNotebookExecutionJobRequest;
resourceInputs["createPipelineJobRequest"] = state?.createPipelineJobRequest;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["cron"] = state?.cron;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["endTime"] = state?.endTime;
resourceInputs["lastPauseTime"] = state?.lastPauseTime;
resourceInputs["lastResumeTime"] = state?.lastResumeTime;
resourceInputs["lastScheduledRunResponses"] = state?.lastScheduledRunResponses;
resourceInputs["location"] = state?.location;
resourceInputs["maxConcurrentActiveRunCount"] = state?.maxConcurrentActiveRunCount;
resourceInputs["maxConcurrentRunCount"] = state?.maxConcurrentRunCount;
resourceInputs["maxRunCount"] = state?.maxRunCount;
resourceInputs["name"] = state?.name;
resourceInputs["nextRunTime"] = state?.nextRunTime;
resourceInputs["project"] = state?.project;
resourceInputs["startTime"] = state?.startTime;
resourceInputs["startedRunCount"] = state?.startedRunCount;
resourceInputs["state"] = state?.state;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.maxConcurrentRunCount === undefined && !opts.urn) {
throw new Error("Missing required property 'maxConcurrentRunCount'");
}
resourceInputs["allowQueueing"] = args?.allowQueueing;
resourceInputs["createNotebookExecutionJobRequest"] = args?.createNotebookExecutionJobRequest;
resourceInputs["createPipelineJobRequest"] = args?.createPipelineJobRequest;
resourceInputs["cron"] = args?.cron;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["endTime"] = args?.endTime;
resourceInputs["location"] = args?.location;
resourceInputs["maxConcurrentActiveRunCount"] = args?.maxConcurrentActiveRunCount;
resourceInputs["maxConcurrentRunCount"] = args?.maxConcurrentRunCount;
resourceInputs["maxRunCount"] = args?.maxRunCount;
resourceInputs["project"] = args?.project;
resourceInputs["startTime"] = args?.startTime;
resourceInputs["catchUp"] = undefined /*out*/;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["lastPauseTime"] = undefined /*out*/;
resourceInputs["lastResumeTime"] = undefined /*out*/;
resourceInputs["lastScheduledRunResponses"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["nextRunTime"] = undefined /*out*/;
resourceInputs["startedRunCount"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AiSchedule.__pulumiType, name, resourceInputs, opts);
}
}
exports.AiSchedule = AiSchedule;
//# sourceMappingURL=aiSchedule.js.map