@catladder/pipeline 3.4.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { createYamlLocalPipeline } from "./__utils__/helpers";
2
+ import config from "./cloud-run-with-gpu";
3
+
4
+ /**
5
+ * This test is auto-generated.
6
+ * Modifications will be overwritten on every `yarn test` run!
7
+ */
8
+
9
+ it("matches snapshot for cloud-run-with-gpu local pipeline YAML", async () => {
10
+ expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
11
+ });
@@ -0,0 +1,30 @@
1
+ import type { Config } from "../src";
2
+
3
+ const config = {
4
+ appName: "test-app",
5
+ customerName: "pan",
6
+ components: {
7
+ api: {
8
+ dir: "api",
9
+ build: {
10
+ type: "node",
11
+ },
12
+ deploy: {
13
+ type: "google-cloudrun",
14
+ projectId: "google-project-id",
15
+ region: "europe-west4", // verify in which regions GPUs are available, europe-west6 is not supported as of time of writing
16
+ service: {
17
+ gpu: 1,
18
+ gpuType: "nvidia-l4",
19
+ memory: "32Gi",
20
+ },
21
+ },
22
+ },
23
+ },
24
+ } satisfies Config;
25
+
26
+ export default config;
27
+
28
+ export const information = {
29
+ title: "Cloud Run: With GPU",
30
+ };
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.4.0",
56
+ "version": "3.6.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -59,11 +59,13 @@ export const getServiceDeployScript = (
59
59
  ingress: customConfig?.ingress ?? "all",
60
60
  "cpu-boost": true,
61
61
  "execution-environment": customConfig?.executionEnvironment,
62
+ gpu: customConfig?.gpu,
63
+ "gpu-type": customConfig?.gpuType,
62
64
  },
63
65
  ...createVolumeConfig(customConfig?.volumes, "service"),
64
66
  );
65
-
66
- return `${gcloudRunCmd()} deploy ${fullServiceName} ${argsString}`;
67
+ const version = requiresBeta(customConfig) ? "beta" : undefined;
68
+ return `${gcloudRunCmd(version)} deploy ${fullServiceName} ${argsString}`;
67
69
  };
68
70
 
69
71
  export const getServiceDeleteScript = (
@@ -84,3 +86,16 @@ export const getServiceDeleteScript = (
84
86
  `${gcloudRunCmd()} services delete ${fullServiceName} ${commonArgsString}`,
85
87
  ];
86
88
  };
89
+ const requiresBeta = (config: DeployConfigCloudRunService | undefined) => {
90
+ if (!config) {
91
+ return false;
92
+ }
93
+
94
+ if (config.gpuType) {
95
+ return true;
96
+ }
97
+ if (config.gpu && config.gpu > 0) {
98
+ return true;
99
+ }
100
+ return false;
101
+ };
@@ -168,6 +168,18 @@ export type DeployConfigCloudRunService = {
168
168
  *
169
169
  */
170
170
  http2?: boolean;
171
+
172
+ /**
173
+ * Number of GPUs to use. Defaults to 0
174
+ *
175
+ * This is a preview feature and not all regions support it.
176
+ */
177
+ gpu?: number;
178
+
179
+ /**
180
+ * gpu type to use. Refer to https://cloud.google.com/run/docs/configuring/services/gpu#gcloud for defaults
181
+ */
182
+ gpuType?: string;
171
183
  } & DeployConfigCloudRunWithVolumes &
172
184
  DeployConfigCloudRunNetworkConfig;
173
185