@remotion/lambda 3.0.19 → 3.0.22

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.
@@ -169,6 +169,14 @@ const renderCommand = async (args) => {
169
169
  ]
170
170
  .filter(Boolean)
171
171
  .join(', '));
172
+ if (newStatus.mostExpensiveFrameRanges) {
173
+ log_1.Log.verbose('Most expensive frame ranges:');
174
+ log_1.Log.verbose(newStatus.mostExpensiveFrameRanges
175
+ .map((f) => {
176
+ return `${f.frameRange[0]}-${f.frameRange[1]} (${f.timeInMilliseconds}ms)`;
177
+ })
178
+ .join(', '));
179
+ }
172
180
  (0, quit_1.quit)(0);
173
181
  }
174
182
  if (newStatus.fatalErrorEncountered) {
@@ -14,4 +14,4 @@ export declare const createPostRenderData: ({ renderId, region, memorySizeInMb,
14
14
  timeToDelete: number;
15
15
  errorExplanations: EnhancedErrorInfo[];
16
16
  outputFile: OutputFileMetadata;
17
- }) => Promise<PostRenderData>;
17
+ }) => PostRenderData;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPostRenderData = void 0;
4
4
  const estimate_price_1 = require("../../api/estimate-price");
5
5
  const constants_1 = require("../../shared/constants");
6
+ const get_most_expensive_chunks_1 = require("../../shared/get-most-expensive-chunks");
6
7
  const parse_lambda_timings_key_1 = require("../../shared/parse-lambda-timings-key");
7
8
  const calculate_chunk_times_1 = require("./calculate-chunk-times");
8
9
  const get_current_architecture_1 = require("./get-current-architecture");
@@ -10,13 +11,12 @@ const get_files_to_delete_1 = require("./get-files-to-delete");
10
11
  const get_lambdas_invoked_stats_1 = require("./get-lambdas-invoked-stats");
11
12
  const get_retry_stats_1 = require("./get-retry-stats");
12
13
  const get_time_to_finish_1 = require("./get-time-to-finish");
13
- const OVERHEAD_TIME_PER_LAMBDA = 100;
14
- const createPostRenderData = async ({ renderId, region, memorySizeInMb, renderMetadata, contents, timeToEncode, errorExplanations, timeToDelete, outputFile, }) => {
14
+ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata, contents, timeToEncode, errorExplanations, timeToDelete, outputFile, }) => {
15
15
  var _a;
16
16
  const initializedKeys = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaTimingsPrefix)(renderId)); });
17
17
  const parsedTimings = initializedKeys.map(({ Key }) => (0, parse_lambda_timings_key_1.parseLambdaTimingsKey)(Key));
18
18
  const times = parsedTimings
19
- .map((p) => p.rendered - p.start + OVERHEAD_TIME_PER_LAMBDA)
19
+ .map((p) => p.rendered - p.start + get_most_expensive_chunks_1.OVERHEAD_TIME_PER_LAMBDA)
20
20
  .reduce((a, b) => a + b);
21
21
  const cost = (0, estimate_price_1.estimatePrice)({
22
22
  durationInMiliseconds: times,
@@ -47,7 +47,7 @@ const createPostRenderData = async ({ renderId, region, memorySizeInMb, renderMe
47
47
  if (timeToInvokeLambdas === null) {
48
48
  throw new Error('should have timing for all lambdas');
49
49
  }
50
- const data = {
50
+ return {
51
51
  cost: {
52
52
  currency: 'USD',
53
53
  disclaimer: 'Estimated cost for lambda invocations only. Does not include cost for S3 storage and data transfer.',
@@ -78,7 +78,7 @@ const createPostRenderData = async ({ renderId, region, memorySizeInMb, renderMe
78
78
  }),
79
79
  timeToInvokeLambdas,
80
80
  retriesInfo,
81
+ mostExpensiveFrameRanges: (0, get_most_expensive_chunks_1.getMostExpensiveChunks)(parsedTimings, renderMetadata.framesPerLambda),
81
82
  };
82
- return data;
83
83
  };
84
84
  exports.createPostRenderData = createPostRenderData;
@@ -23,7 +23,7 @@ const get_time_to_finish_1 = require("./get-time-to-finish");
23
23
  const inspect_errors_1 = require("./inspect-errors");
24
24
  const io_1 = require("./io");
25
25
  const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMiliseconds, }) => {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
27
27
  const postRenderData = await (0, get_post_render_data_1.getPostRenderData)({
28
28
  bucketName,
29
29
  region,
@@ -68,6 +68,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
68
68
  retriesInfo: postRenderData.retriesInfo,
69
69
  outKey: outData.key,
70
70
  outBucket: outData.renderBucketName,
71
+ mostExpensiveFrameRanges: (_a = postRenderData.mostExpensiveFrameRanges) !== null && _a !== void 0 ? _a : null,
71
72
  };
72
73
  }
73
74
  const contents = await (0, io_1.lambdaLs)({
@@ -114,27 +115,27 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
114
115
  memorySizeInMb,
115
116
  outputFileMetadata: outputFile,
116
117
  architecture: (0, get_current_architecture_1.getCurrentArchitecture)(),
117
- lambdasInvoked: (_a = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _a !== void 0 ? _a : 0,
118
+ lambdasInvoked: (_b = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _b !== void 0 ? _b : 0,
118
119
  // We cannot determine the ephemeral storage size, so we
119
120
  // overestimate the price, but will only have a miniscule effect (~0.2%)
120
121
  diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
121
122
  }));
122
123
  const cleanup = (0, get_cleanup_progress_1.getCleanupProgress)({
123
- chunkCount: (_b = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _b !== void 0 ? _b : 0,
124
+ chunkCount: (_c = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _c !== void 0 ? _c : 0,
124
125
  contents,
125
- output: (_c = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _c !== void 0 ? _c : null,
126
+ output: (_d = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _d !== void 0 ? _d : null,
126
127
  renderId,
127
128
  });
128
129
  const timeToFinish = (0, get_time_to_finish_1.getTimeToFinish)({
129
- lastModified: (_d = outputFile === null || outputFile === void 0 ? void 0 : outputFile.lastModified) !== null && _d !== void 0 ? _d : null,
130
+ lastModified: (_e = outputFile === null || outputFile === void 0 ? void 0 : outputFile.lastModified) !== null && _e !== void 0 ? _e : null,
130
131
  renderMetadata,
131
132
  });
132
133
  const chunks = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.chunkKey)(renderId)); });
133
- const allChunks = chunks.length === ((_e = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _e !== void 0 ? _e : Infinity);
134
+ const allChunks = chunks.length === ((_f = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _f !== void 0 ? _f : Infinity);
134
135
  const renderSize = contents
135
136
  .map((c) => { var _a; return (_a = c.Size) !== null && _a !== void 0 ? _a : 0; })
136
137
  .reduce((a, b) => a + b, 0);
137
- const lambdasInvokedStats = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, (_f = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _f !== void 0 ? _f : null, (_g = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.startedDate) !== null && _g !== void 0 ? _g : null);
138
+ const lambdasInvokedStats = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)(contents, renderId, (_g = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.estimatedRenderLambdaInvokations) !== null && _g !== void 0 ? _g : null, (_h = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.startedDate) !== null && _h !== void 0 ? _h : null);
138
139
  const retriesInfo = (0, get_retry_stats_1.getRetryStats)({
139
140
  contents,
140
141
  renderId,
@@ -146,7 +147,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
146
147
  lambdaInvokeStatus: lambdasInvokedStats,
147
148
  });
148
149
  const chunkCount = outputFile
149
- ? (_h = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _h !== void 0 ? _h : 0
150
+ ? (_j = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _j !== void 0 ? _j : 0
150
151
  : chunks.length;
151
152
  // We add a 20 second buffer for it, since AWS timeshifts can be quite a lot. Once it's 20sec over the limit, we consider it timed out
152
153
  const isBeyondTimeout = renderMetadata &&
@@ -177,7 +178,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
177
178
  renderId,
178
179
  renderMetadata,
179
180
  bucket: bucketName,
180
- outputFile: (_j = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _j !== void 0 ? _j : null,
181
+ outputFile: (_k = outputFile === null || outputFile === void 0 ? void 0 : outputFile.url) !== null && _k !== void 0 ? _k : null,
181
182
  timeToFinish,
182
183
  errors: allErrors,
183
184
  fatalErrorEncountered: allErrors.some((f) => f.isFatal && !f.willRetry),
@@ -192,7 +193,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
192
193
  type: 'absolute-time',
193
194
  })
194
195
  : null,
195
- timeToInvokeLambdas: (_k = encodingStatus === null || encodingStatus === void 0 ? void 0 : encodingStatus.timeToInvoke) !== null && _k !== void 0 ? _k : lambdasInvokedStats.timeToInvokeLambdas,
196
+ timeToInvokeLambdas: (_l = encodingStatus === null || encodingStatus === void 0 ? void 0 : encodingStatus.timeToInvoke) !== null && _l !== void 0 ? _l : lambdasInvokedStats.timeToInvokeLambdas,
196
197
  overallProgress: (0, get_overall_progress_1.getOverallProgress)({
197
198
  cleanup: cleanup ? cleanup.filesDeleted / cleanup.minFilesToDelete : 0,
198
199
  encoding: finalEncodingStatus && renderMetadata
@@ -212,6 +213,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
212
213
  outBucket: outputFile && renderMetadata
213
214
  ? (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName).renderBucketName
214
215
  : null,
216
+ mostExpensiveFrameRanges: null,
215
217
  };
216
218
  };
217
219
  exports.getProgress = getProgress;
@@ -3,6 +3,7 @@ import { Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile, V
3
3
  import { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
5
5
  import { AwsRegion } from '../pricing/aws-regions';
6
+ import { ExpensiveChunk } from './get-most-expensive-chunks';
6
7
  import { LambdaArchitecture } from './validate-architecture';
7
8
  export declare const MIN_MEMORY = 512;
8
9
  export declare const MAX_MEMORY = 10240;
@@ -210,7 +211,7 @@ export declare type RenderMetadata = {
210
211
  renderId: string;
211
212
  outName: OutNameInput | undefined;
212
213
  };
213
- export declare type LambdaVersions = '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
214
+ export declare type LambdaVersions = '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
214
215
  export declare const CURRENT_VERSION: LambdaVersions;
215
216
  export declare type PostRenderData = {
216
217
  cost: {
@@ -233,6 +234,7 @@ export declare type PostRenderData = {
233
234
  timeToRenderChunks: number;
234
235
  timeToInvokeLambdas: number;
235
236
  retriesInfo: ChunkRetry[];
237
+ mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
236
238
  };
237
239
  export declare type CostsInfo = {
238
240
  accruedSoFar: number;
@@ -267,6 +269,7 @@ export declare type RenderProgress = {
267
269
  timeToInvokeLambdas: number | null;
268
270
  overallProgress: number;
269
271
  retriesInfo: ChunkRetry[];
272
+ mostExpensiveFrameRanges: ExpensiveChunk[] | null;
270
273
  };
271
274
  export declare type Privacy = 'public' | 'private';
272
275
  export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
@@ -84,6 +84,6 @@ var LambdaRoutines;
84
84
  LambdaRoutines["renderer"] = "renderer";
85
85
  LambdaRoutines["still"] = "still";
86
86
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
87
- exports.CURRENT_VERSION = '2022-06-14';
87
+ exports.CURRENT_VERSION = '2022-06-22';
88
88
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
89
89
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -0,0 +1,8 @@
1
+ import { ParsedTiming } from './parse-lambda-timings-key';
2
+ export declare const OVERHEAD_TIME_PER_LAMBDA = 100;
3
+ export declare type ExpensiveChunk = {
4
+ chunk: number;
5
+ frameRange: [number, number];
6
+ timeInMilliseconds: number;
7
+ };
8
+ export declare const getMostExpensiveChunks: (parsedTimings: ParsedTiming[], framesPerLambda: number) => ExpensiveChunk[];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMostExpensiveChunks = exports.OVERHEAD_TIME_PER_LAMBDA = void 0;
4
+ exports.OVERHEAD_TIME_PER_LAMBDA = 100;
5
+ const getMostExpensiveChunks = (parsedTimings, framesPerLambda) => {
6
+ const mostExpensiveChunks = parsedTimings
7
+ .slice(0)
8
+ .sort((a, b) => {
9
+ const durA = a.rendered - a.start;
10
+ const durB = b.rendered - b.start;
11
+ return durB - durA;
12
+ })
13
+ .slice(0, 5);
14
+ return mostExpensiveChunks.map((c) => {
15
+ return {
16
+ timeInMilliseconds: c.rendered - c.start,
17
+ chunk: c.chunk,
18
+ frameRange: [
19
+ framesPerLambda * c.chunk,
20
+ framesPerLambda * (c.chunk + 1) - 1,
21
+ ],
22
+ };
23
+ });
24
+ };
25
+ exports.getMostExpensiveChunks = getMostExpensiveChunks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.0.19",
3
+ "version": "3.0.22",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -31,14 +31,12 @@
31
31
  "@aws-sdk/client-service-quotas": "3.58.0",
32
32
  "@aws-sdk/lib-storage": "3.58.0",
33
33
  "@aws-sdk/s3-request-presigner": "3.58.0",
34
- "@remotion/bundler": "3.0.19",
35
- "@remotion/cli": "3.0.19",
36
- "@remotion/renderer": "3.0.19",
34
+ "@remotion/bundler": "3.0.22",
35
+ "@remotion/cli": "3.0.22",
36
+ "@remotion/renderer": "3.0.22",
37
37
  "aws-policies": "^1.0.1",
38
- "dotenv": "^10.0.0",
39
38
  "mime-types": "2.1.34",
40
- "minimist": "1.2.6",
41
- "remotion": "3.0.19"
39
+ "remotion": "3.0.22"
42
40
  },
43
41
  "peerDependencies": {
44
42
  "react": ">=16.8.0",
@@ -52,7 +50,6 @@
52
50
  "@types/node": "^14.14.14",
53
51
  "@types/prompt": "^1.1.0",
54
52
  "eslint": "8.13.0",
55
- "execa": "5.1.1",
56
53
  "jest": "^27.2.4",
57
54
  "prettier": "^2.4.1",
58
55
  "prettier-plugin-organize-imports": "^2.3.4",
@@ -64,5 +61,5 @@
64
61
  "publishConfig": {
65
62
  "access": "public"
66
63
  },
67
- "gitHead": "388ef0a2eacf9dbadbc860fdb8d6b3e32acb10f3"
64
+ "gitHead": "e79cfa299f58a26c84a637174875941898cdab97"
68
65
  }
Binary file