@remotion/lambda 4.0.74 → 4.0.75

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.
@@ -8,4 +8,7 @@ export declare const estimatePriceFromBucket: ({ contents, renderMetadata, memor
8
8
  outputFileMetadata: OutputFileMetadata | null;
9
9
  diskSizeInMb: number;
10
10
  lambdasInvoked: number;
11
- }) => number | null;
11
+ }) => {
12
+ accruedSoFar: number;
13
+ estimatedBillingDurationInMilliseconds: number;
14
+ } | null;
@@ -27,17 +27,18 @@ const estimatePriceFromBucket = ({ contents, renderMetadata, memorySizeInMb, out
27
27
  .fill(true)
28
28
  .map(() => elapsedTime)
29
29
  .reduce((a, b) => a + b, 0);
30
+ const estimatedBillingDurationInMilliseconds = (0, calculate_chunk_times_1.calculateChunkTimes)({
31
+ contents,
32
+ renderId: renderMetadata.renderId,
33
+ type: 'combined-time-for-cost-calculation',
34
+ }) + timeElapsedOfUnfinished;
30
35
  const accruedSoFar = Number((0, estimate_price_1.estimatePrice)({
31
36
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
32
- durationInMilliseconds: (0, calculate_chunk_times_1.calculateChunkTimes)({
33
- contents,
34
- renderId: renderMetadata.renderId,
35
- type: 'combined-time-for-cost-calculation',
36
- }) + timeElapsedOfUnfinished,
37
+ durationInMilliseconds: estimatedBillingDurationInMilliseconds,
37
38
  memorySizeInMb,
38
39
  diskSizeInMb,
39
40
  lambdasInvoked,
40
41
  }).toPrecision(5));
41
- return accruedSoFar;
42
+ return { accruedSoFar, estimatedBillingDurationInMilliseconds };
42
43
  };
43
44
  exports.estimatePriceFromBucket = estimatePriceFromBucket;
@@ -12,11 +12,11 @@ const get_time_to_finish_1 = require("./get-time-to-finish");
12
12
  const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata, contents, timeToEncode, errorExplanations, timeToDelete, outputFile, }) => {
13
13
  const initializedKeys = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaTimingsPrefix)(renderId)); });
14
14
  const parsedTimings = initializedKeys.map(({ Key }) => (0, parse_lambda_timings_key_1.parseLambdaTimingsKey)(Key));
15
- const times = parsedTimings
15
+ const estimatedBillingDurationInMilliseconds = parsedTimings
16
16
  .map((p) => p.rendered - p.start + get_most_expensive_chunks_1.OVERHEAD_TIME_PER_LAMBDA)
17
17
  .reduce((a, b) => a + b);
18
18
  const cost = (0, estimate_price_1.estimatePrice)({
19
- durationInMilliseconds: times,
19
+ durationInMilliseconds: estimatedBillingDurationInMilliseconds,
20
20
  memorySizeInMb,
21
21
  region,
22
22
  lambdasInvoked: renderMetadata.estimatedTotalLambdaInvokations,
@@ -74,6 +74,7 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
74
74
  retriesInfo,
75
75
  mostExpensiveFrameRanges: (0, get_most_expensive_chunks_1.getMostExpensiveChunks)(parsedTimings, renderMetadata.framesPerLambda, renderMetadata.frameRange[0], renderMetadata.frameRange[1]),
76
76
  deleteAfter: renderMetadata.deleteAfter,
77
+ estimatedBillingDurationInMilliseconds,
77
78
  };
78
79
  };
79
80
  exports.createPostRenderData = createPostRenderData;
@@ -73,6 +73,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
73
73
  timeToEncode: postRenderData.timeToEncode,
74
74
  outputSizeInBytes: postRenderData.outputSize,
75
75
  type: 'success',
76
+ estimatedBillingDurationInMilliseconds: postRenderData.estimatedBillingDurationInMilliseconds,
76
77
  };
77
78
  }
78
79
  const contents = await (0, io_1.lambdaLs)({
@@ -111,7 +112,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
111
112
  customCredentials,
112
113
  })
113
114
  : null;
114
- const accruedSoFar = Number((0, calculate_price_from_bucket_1.estimatePriceFromBucket)({
115
+ const priceFromBucket = (0, calculate_price_from_bucket_1.estimatePriceFromBucket)({
115
116
  contents,
116
117
  renderMetadata,
117
118
  memorySizeInMb,
@@ -120,7 +121,7 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
120
121
  // We cannot determine the ephemeral storage size, so we
121
122
  // overestimate the price, but will only have a miniscule effect (~0.2%)
122
123
  diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
123
- }));
124
+ });
124
125
  const cleanup = (0, get_cleanup_progress_1.getCleanupProgress)({
125
126
  chunkCount: (_c = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _c !== void 0 ? _c : 0,
126
127
  contents,
@@ -203,7 +204,9 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
203
204
  chunks: chunkCount,
204
205
  done: false,
205
206
  encodingStatus,
206
- costs: (0, format_costs_info_1.formatCostsInfo)(accruedSoFar),
207
+ costs: priceFromBucket
208
+ ? (0, format_costs_info_1.formatCostsInfo)(priceFromBucket.accruedSoFar)
209
+ : (0, format_costs_info_1.formatCostsInfo)(0),
207
210
  renderId,
208
211
  renderMetadata,
209
212
  bucket: bucketName,
@@ -245,6 +248,9 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
245
248
  mostExpensiveFrameRanges: null,
246
249
  timeToEncode: null,
247
250
  outputSizeInBytes: (_j = outputFile === null || outputFile === void 0 ? void 0 : outputFile.size) !== null && _j !== void 0 ? _j : null,
251
+ estimatedBillingDurationInMilliseconds: priceFromBucket
252
+ ? priceFromBucket.estimatedBillingDurationInMilliseconds
253
+ : null,
248
254
  type: 'success',
249
255
  };
250
256
  };
@@ -354,6 +354,7 @@ export type PostRenderData = {
354
354
  timeToRenderChunks: number;
355
355
  retriesInfo: ChunkRetry[];
356
356
  mostExpensiveFrameRanges: ExpensiveChunk[] | undefined;
357
+ estimatedBillingDurationInMilliseconds: number;
357
358
  deleteAfter: DeleteAfter | null;
358
359
  };
359
360
  export type CostsInfo = {
@@ -393,6 +394,7 @@ export type RenderProgress = {
393
394
  framesRendered: number;
394
395
  outputSizeInBytes: number | null;
395
396
  type: 'success';
397
+ estimatedBillingDurationInMilliseconds: number | null;
396
398
  };
397
399
  export type Privacy = 'public' | 'private' | 'no-acl';
398
400
  export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.74",
3
+ "version": "4.0.75",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,10 +26,10 @@
26
26
  "aws-policies": "^1.0.1",
27
27
  "mime-types": "2.1.34",
28
28
  "zod": "3.22.3",
29
- "@remotion/bundler": "4.0.74",
30
- "remotion": "4.0.74",
31
- "@remotion/cli": "4.0.74",
32
- "@remotion/renderer": "4.0.74"
29
+ "@remotion/bundler": "4.0.75",
30
+ "@remotion/renderer": "4.0.75",
31
+ "@remotion/cli": "4.0.75",
32
+ "remotion": "4.0.75"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jonny/eslint-config": "3.0.276",
@@ -43,11 +43,11 @@
43
43
  "ts-node": "^10.8.0",
44
44
  "vitest": "0.31.1",
45
45
  "zip-lib": "^0.7.2",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.74",
47
- "@remotion/bundler": "4.0.74"
46
+ "@remotion/bundler": "4.0.75",
47
+ "@remotion/compositor-linux-arm64-gnu": "4.0.75"
48
48
  },
49
49
  "peerDependencies": {
50
- "@remotion/bundler": "4.0.74"
50
+ "@remotion/bundler": "4.0.75"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
Binary file