@remotion/serverless-client 4.0.364 → 4.0.366
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.
- package/dist/esm/index.mjs +1 -1
- package/package.json +5 -5
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -15
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -15
- package/dist/test/best-frames.test.d.ts +0 -1
- package/dist/test/best-frames.test.js +0 -16
- package/dist/test/dont-contain-forbidden.test.d.ts +0 -1
- package/dist/test/dont-contain-forbidden.test.js +0 -18
- package/dist/test/expected-out-name.test.d.ts +0 -1
- package/dist/test/expected-out-name.test.js +0 -168
- package/dist/test/min-max.test.d.ts +0 -1
- package/dist/test/min-max.test.js +0 -24
- package/dist/test/most-expensive-chunks.test.d.ts +0 -1
- package/dist/test/most-expensive-chunks.test.js +0 -163
- package/eslint.config.mjs +0 -5
- package/src/await.ts +0 -1
- package/src/best-frames-per-function-param.ts +0 -18
- package/src/calculate-chunk-times.ts +0 -42
- package/src/compress-props.ts +0 -179
- package/src/constants.ts +0 -408
- package/src/docs-url.ts +0 -1
- package/src/error-category.ts +0 -14
- package/src/estimate-price-from-bucket.ts +0 -59
- package/src/expected-out-name.ts +0 -83
- package/src/format-costs-info.ts +0 -24
- package/src/get-custom-out-name.ts +0 -44
- package/src/get-files-in-folder.ts +0 -6
- package/src/get-or-create-bucket.ts +0 -85
- package/src/get-overall-progress-from-storage.ts +0 -47
- package/src/get-overall-progress.ts +0 -42
- package/src/index.ts +0 -125
- package/src/input-props-keys.ts +0 -7
- package/src/inspect-error.ts +0 -63
- package/src/make-bucket-name.ts +0 -9
- package/src/make-timeout-error.ts +0 -51
- package/src/make-timeout-message.ts +0 -118
- package/src/min-max.ts +0 -34
- package/src/most-expensive-chunks.ts +0 -46
- package/src/overall-render-progress.ts +0 -30
- package/src/progress.ts +0 -330
- package/src/provider-implementation.ts +0 -268
- package/src/render-has-audio-video.ts +0 -28
- package/src/render-metadata.ts +0 -61
- package/src/render-progress.ts +0 -58
- package/src/return-values.ts +0 -45
- package/src/serialize-artifact.ts +0 -66
- package/src/stream-to-string.ts +0 -14
- package/src/streaming/streaming.ts +0 -148
- package/src/test/best-frames.test.ts +0 -15
- package/src/test/dont-contain-forbidden.test.ts +0 -14
- package/src/test/expected-out-name.test.ts +0 -200
- package/src/test/min-max.test.ts +0 -25
- package/src/test/most-expensive-chunks.test.ts +0 -167
- package/src/truthy.ts +0 -5
- package/src/types.ts +0 -82
- package/src/validate-bucket-name.ts +0 -34
- package/src/validate-download-behavior.ts +0 -26
- package/src/validate-frames-per-function.ts +0 -125
- package/src/validate-outname.ts +0 -63
- package/src/validate-privacy.ts +0 -20
- package/src/validate-webhook.ts +0 -18
- package/src/webhook-types.ts +0 -36
- package/src/write-error-to-storage.ts +0 -23
- package/tsconfig.json +0 -18
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {ServerlessRoutines} from './constants';
|
|
2
|
-
import {DOCS_URL} from './docs-url';
|
|
3
|
-
import type {ProviderSpecifics} from './provider-implementation';
|
|
4
|
-
import type {RenderMetadata} from './render-metadata';
|
|
5
|
-
import type {CloudProvider} from './types';
|
|
6
|
-
|
|
7
|
-
const MAX_MISSING_CHUNKS = 5;
|
|
8
|
-
|
|
9
|
-
const makeChunkMissingMessage = <Provider extends CloudProvider>({
|
|
10
|
-
missingChunks,
|
|
11
|
-
renderMetadata,
|
|
12
|
-
region,
|
|
13
|
-
providerSpecifics,
|
|
14
|
-
functionName,
|
|
15
|
-
}: {
|
|
16
|
-
missingChunks: number[];
|
|
17
|
-
renderMetadata: RenderMetadata<Provider>;
|
|
18
|
-
region: Provider['region'];
|
|
19
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
20
|
-
functionName: string;
|
|
21
|
-
}) => {
|
|
22
|
-
if (missingChunks.length === 0) {
|
|
23
|
-
return 'All chunks have been successfully rendered, but the main function has timed out.';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return [
|
|
27
|
-
`The following chunks are missing (showing ${Math.min(
|
|
28
|
-
MAX_MISSING_CHUNKS,
|
|
29
|
-
missingChunks.length,
|
|
30
|
-
)} out of ${missingChunks.length}):`,
|
|
31
|
-
...missingChunks
|
|
32
|
-
.map((ch) => {
|
|
33
|
-
const isLastChunk = ch === renderMetadata.totalChunks - 1;
|
|
34
|
-
const start = ch * renderMetadata.framesPerLambda;
|
|
35
|
-
const end =
|
|
36
|
-
renderMetadata.type === 'still'
|
|
37
|
-
? 0
|
|
38
|
-
: isLastChunk
|
|
39
|
-
? renderMetadata.frameRange[1]
|
|
40
|
-
: (ch + 1) * renderMetadata.framesPerLambda - 1;
|
|
41
|
-
|
|
42
|
-
const msg = `Chunk ${ch} (Frames ${start} - ${end})`;
|
|
43
|
-
|
|
44
|
-
return [
|
|
45
|
-
msg,
|
|
46
|
-
`▸ Logs for chunk ${ch}: ${providerSpecifics.getLoggingUrlForRendererFunction(
|
|
47
|
-
{
|
|
48
|
-
functionName,
|
|
49
|
-
region,
|
|
50
|
-
rendererFunctionName: null,
|
|
51
|
-
renderId: renderMetadata.renderId,
|
|
52
|
-
chunk: ch,
|
|
53
|
-
},
|
|
54
|
-
)}`,
|
|
55
|
-
].join('\n');
|
|
56
|
-
})
|
|
57
|
-
.slice(0, 5),
|
|
58
|
-
].join('\n');
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const makeTimeoutMessage = <Provider extends CloudProvider>({
|
|
62
|
-
timeoutInMilliseconds,
|
|
63
|
-
missingChunks,
|
|
64
|
-
renderMetadata,
|
|
65
|
-
renderId,
|
|
66
|
-
functionName,
|
|
67
|
-
region,
|
|
68
|
-
providerSpecifics,
|
|
69
|
-
}: {
|
|
70
|
-
timeoutInMilliseconds: number;
|
|
71
|
-
missingChunks: number[];
|
|
72
|
-
renderMetadata: RenderMetadata<Provider>;
|
|
73
|
-
renderId: string;
|
|
74
|
-
region: Provider['region'];
|
|
75
|
-
functionName: string;
|
|
76
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
77
|
-
}) => {
|
|
78
|
-
const cloudWatchRendererUrl =
|
|
79
|
-
providerSpecifics.getLoggingUrlForRendererFunction({
|
|
80
|
-
renderId,
|
|
81
|
-
functionName,
|
|
82
|
-
region,
|
|
83
|
-
rendererFunctionName: functionName,
|
|
84
|
-
chunk: null,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const cloudWatchLaunchUrl = providerSpecifics.getLoggingUrlForMethod({
|
|
88
|
-
renderId,
|
|
89
|
-
functionName,
|
|
90
|
-
method: ServerlessRoutines.launch,
|
|
91
|
-
region,
|
|
92
|
-
rendererFunctionName: functionName,
|
|
93
|
-
});
|
|
94
|
-
const message = [
|
|
95
|
-
`The main function timed out after ${timeoutInMilliseconds}ms.`,
|
|
96
|
-
makeChunkMissingMessage({
|
|
97
|
-
missingChunks,
|
|
98
|
-
renderMetadata,
|
|
99
|
-
region,
|
|
100
|
-
providerSpecifics,
|
|
101
|
-
functionName,
|
|
102
|
-
}),
|
|
103
|
-
'',
|
|
104
|
-
`Consider increasing the timeout of your function.`,
|
|
105
|
-
`▸ You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
|
|
106
|
-
`${DOCS_URL}/docs/lambda/cli/functions/deploy`,
|
|
107
|
-
'',
|
|
108
|
-
'▸ Visit the logs for the main function:',
|
|
109
|
-
cloudWatchLaunchUrl,
|
|
110
|
-
'▸ Visit the logs for the renderer functions:',
|
|
111
|
-
cloudWatchRendererUrl,
|
|
112
|
-
'',
|
|
113
|
-
'▸ Get help on debugging this error:',
|
|
114
|
-
`${DOCS_URL}/docs/lambda/troubleshooting/debug`,
|
|
115
|
-
].join('\n');
|
|
116
|
-
|
|
117
|
-
return message;
|
|
118
|
-
};
|
package/src/min-max.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Standard library Math.min and Math.max can throw
|
|
2
|
-
// if array length is very long. Fixing this with own implementation
|
|
3
|
-
|
|
4
|
-
export const min = (arr: number[]) => {
|
|
5
|
-
if (arr.length === 0) {
|
|
6
|
-
throw new Error('Array of 0 length');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
let smallest = arr[0];
|
|
10
|
-
for (let i = 0; i < arr.length; i++) {
|
|
11
|
-
const elem = arr[i];
|
|
12
|
-
if (elem < smallest) {
|
|
13
|
-
smallest = elem;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return smallest;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const max = (arr: number[]) => {
|
|
21
|
-
if (arr.length === 0) {
|
|
22
|
-
throw new Error('Array of 0 length');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let biggest = arr[0];
|
|
26
|
-
for (let i = 0; i < arr.length; i++) {
|
|
27
|
-
const elem = arr[i];
|
|
28
|
-
if (elem > biggest) {
|
|
29
|
-
biggest = elem;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return biggest;
|
|
34
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type {ParsedTiming} from './types';
|
|
2
|
-
|
|
3
|
-
export const OVERHEAD_TIME_PER_LAMBDA = 100;
|
|
4
|
-
|
|
5
|
-
export type ExpensiveChunk = {
|
|
6
|
-
chunk: number;
|
|
7
|
-
frameRange: [number, number];
|
|
8
|
-
timeInMilliseconds: number;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const getMostExpensiveChunks = ({
|
|
12
|
-
parsedTimings,
|
|
13
|
-
framesPerFunction: framesPerLambda,
|
|
14
|
-
firstFrame,
|
|
15
|
-
lastFrame,
|
|
16
|
-
}: {
|
|
17
|
-
parsedTimings: ParsedTiming[];
|
|
18
|
-
framesPerFunction: number;
|
|
19
|
-
firstFrame: number;
|
|
20
|
-
lastFrame: number;
|
|
21
|
-
}): ExpensiveChunk[] => {
|
|
22
|
-
const mostExpensiveChunks = parsedTimings
|
|
23
|
-
.slice(0)
|
|
24
|
-
.sort((a, b) => {
|
|
25
|
-
const durA = a.rendered - a.start;
|
|
26
|
-
const durB = b.rendered - b.start;
|
|
27
|
-
|
|
28
|
-
return durB - durA;
|
|
29
|
-
})
|
|
30
|
-
.slice(0, 5);
|
|
31
|
-
|
|
32
|
-
return mostExpensiveChunks.map((c) => {
|
|
33
|
-
const isLastChunk = c.chunk === parsedTimings.length - 1;
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
timeInMilliseconds: c.rendered - c.start,
|
|
37
|
-
chunk: c.chunk,
|
|
38
|
-
frameRange: [
|
|
39
|
-
framesPerLambda * c.chunk + firstFrame,
|
|
40
|
-
isLastChunk
|
|
41
|
-
? lastFrame
|
|
42
|
-
: framesPerLambda * (c.chunk + 1) - 1 + firstFrame,
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type {PostRenderData} from './constants';
|
|
2
|
-
import type {RenderMetadata} from './render-metadata';
|
|
3
|
-
import type {
|
|
4
|
-
ChunkRetry,
|
|
5
|
-
CloudProvider,
|
|
6
|
-
ParsedTiming,
|
|
7
|
-
ReceivedArtifact,
|
|
8
|
-
} from './types';
|
|
9
|
-
import type {FunctionErrorInfo} from './write-error-to-storage';
|
|
10
|
-
|
|
11
|
-
export type OverallRenderProgress<Provider extends CloudProvider> = {
|
|
12
|
-
chunks: number[];
|
|
13
|
-
framesRendered: number;
|
|
14
|
-
framesEncoded: number;
|
|
15
|
-
combinedFrames: number;
|
|
16
|
-
timeToCombine: number | null;
|
|
17
|
-
timeToEncode: number | null;
|
|
18
|
-
timeToRenderFrames: number | null;
|
|
19
|
-
lambdasInvoked: number;
|
|
20
|
-
retries: ChunkRetry[];
|
|
21
|
-
postRenderData: PostRenderData<Provider> | null;
|
|
22
|
-
timings: ParsedTiming[];
|
|
23
|
-
renderMetadata: RenderMetadata<Provider> | null;
|
|
24
|
-
errors: FunctionErrorInfo[];
|
|
25
|
-
timeoutTimestamp: number;
|
|
26
|
-
functionLaunched: number;
|
|
27
|
-
serveUrlOpened: number | null;
|
|
28
|
-
compositionValidated: number | null;
|
|
29
|
-
receivedArtifact: ReceivedArtifact<Provider>[];
|
|
30
|
-
};
|
package/src/progress.ts
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import {NoReactAPIs} from '@remotion/renderer/pure';
|
|
2
|
-
|
|
3
|
-
import {calculateChunkTimes} from './calculate-chunk-times';
|
|
4
|
-
import type {CustomCredentials} from './constants';
|
|
5
|
-
import {estimatePriceFromMetadata} from './estimate-price-from-bucket';
|
|
6
|
-
import {getExpectedOutName} from './expected-out-name';
|
|
7
|
-
import {formatCostsInfo} from './format-costs-info';
|
|
8
|
-
import {getOverallProgress} from './get-overall-progress';
|
|
9
|
-
import {getOverallProgressFromStorage} from './get-overall-progress-from-storage';
|
|
10
|
-
import {inspectErrors} from './inspect-error';
|
|
11
|
-
import {makeTimeoutError} from './make-timeout-error';
|
|
12
|
-
import type {ProviderSpecifics} from './provider-implementation';
|
|
13
|
-
import {lambdaRenderHasAudioVideo} from './render-has-audio-video';
|
|
14
|
-
import type {CleanupInfo, GenericRenderProgress} from './render-progress';
|
|
15
|
-
import {truthy} from './truthy';
|
|
16
|
-
import type {CloudProvider} from './types';
|
|
17
|
-
import type {EnhancedErrorInfo} from './write-error-to-storage';
|
|
18
|
-
|
|
19
|
-
export const getProgress = async <Provider extends CloudProvider>({
|
|
20
|
-
bucketName,
|
|
21
|
-
renderId,
|
|
22
|
-
expectedBucketOwner,
|
|
23
|
-
region,
|
|
24
|
-
memorySizeInMb,
|
|
25
|
-
timeoutInMilliseconds,
|
|
26
|
-
customCredentials,
|
|
27
|
-
providerSpecifics,
|
|
28
|
-
forcePathStyle,
|
|
29
|
-
functionName,
|
|
30
|
-
requestHandler,
|
|
31
|
-
}: {
|
|
32
|
-
bucketName: string;
|
|
33
|
-
renderId: string;
|
|
34
|
-
expectedBucketOwner: string | null;
|
|
35
|
-
region: Provider['region'];
|
|
36
|
-
memorySizeInMb: number;
|
|
37
|
-
timeoutInMilliseconds: number;
|
|
38
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
39
|
-
providerSpecifics: ProviderSpecifics<Provider>;
|
|
40
|
-
forcePathStyle: boolean;
|
|
41
|
-
functionName: string;
|
|
42
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
43
|
-
}): Promise<GenericRenderProgress<Provider>> => {
|
|
44
|
-
const overallProgress = await getOverallProgressFromStorage({
|
|
45
|
-
renderId,
|
|
46
|
-
bucketName,
|
|
47
|
-
expectedBucketOwner,
|
|
48
|
-
region,
|
|
49
|
-
providerSpecifics,
|
|
50
|
-
forcePathStyle,
|
|
51
|
-
requestHandler,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (overallProgress.postRenderData) {
|
|
55
|
-
if (!overallProgress.renderMetadata) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
'No render metadata found even though render is finished',
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (overallProgress.renderMetadata.type === 'still') {
|
|
62
|
-
throw new Error(
|
|
63
|
-
"You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! 😉",
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const outData = getExpectedOutName({
|
|
68
|
-
renderMetadata: overallProgress.renderMetadata,
|
|
69
|
-
bucketName,
|
|
70
|
-
customCredentials,
|
|
71
|
-
bucketNamePrefix: providerSpecifics.getBucketPrefix(),
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const totalFrameCount = NoReactAPIs.getFramesToRender(
|
|
75
|
-
overallProgress.renderMetadata.frameRange,
|
|
76
|
-
overallProgress.renderMetadata.everyNthFrame,
|
|
77
|
-
).length;
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
framesRendered: totalFrameCount,
|
|
81
|
-
bucket: bucketName,
|
|
82
|
-
renderSize: overallProgress.postRenderData.renderSize,
|
|
83
|
-
chunks: overallProgress.renderMetadata.totalChunks,
|
|
84
|
-
cleanup: {
|
|
85
|
-
doneIn: overallProgress.postRenderData.timeToCleanUp,
|
|
86
|
-
filesDeleted: overallProgress.postRenderData.filesCleanedUp,
|
|
87
|
-
minFilesToDelete: overallProgress.postRenderData.filesCleanedUp,
|
|
88
|
-
},
|
|
89
|
-
costs: {
|
|
90
|
-
accruedSoFar: overallProgress.postRenderData.cost.estimatedCost,
|
|
91
|
-
displayCost: overallProgress.postRenderData.cost.estimatedDisplayCost,
|
|
92
|
-
currency: overallProgress.postRenderData.cost.currency,
|
|
93
|
-
disclaimer: overallProgress.postRenderData.cost.disclaimer,
|
|
94
|
-
},
|
|
95
|
-
currentTime: Date.now(),
|
|
96
|
-
done: true,
|
|
97
|
-
encodingStatus: {
|
|
98
|
-
framesEncoded: totalFrameCount,
|
|
99
|
-
combinedFrames: totalFrameCount,
|
|
100
|
-
timeToCombine: overallProgress.postRenderData.timeToCombine,
|
|
101
|
-
},
|
|
102
|
-
errors: overallProgress.postRenderData.errors,
|
|
103
|
-
fatalErrorEncountered: false,
|
|
104
|
-
lambdasInvoked: overallProgress.renderMetadata.totalChunks,
|
|
105
|
-
outputFile: overallProgress.postRenderData.outputFile,
|
|
106
|
-
renderId,
|
|
107
|
-
timeToFinish: overallProgress.postRenderData.timeToFinish,
|
|
108
|
-
timeToFinishChunks: overallProgress.postRenderData.timeToRenderChunks,
|
|
109
|
-
timeToRenderFrames: overallProgress.postRenderData.timeToRenderFrames,
|
|
110
|
-
overallProgress: 1,
|
|
111
|
-
retriesInfo: overallProgress.postRenderData.retriesInfo,
|
|
112
|
-
outKey: outData.key,
|
|
113
|
-
outBucket: outData.renderBucketName,
|
|
114
|
-
mostExpensiveFrameRanges:
|
|
115
|
-
overallProgress.postRenderData.mostExpensiveFrameRanges ?? null,
|
|
116
|
-
timeToEncode: overallProgress.postRenderData.timeToEncode,
|
|
117
|
-
outputSizeInBytes: overallProgress.postRenderData.outputSize,
|
|
118
|
-
type: 'success',
|
|
119
|
-
estimatedBillingDurationInMilliseconds:
|
|
120
|
-
overallProgress.postRenderData.estimatedBillingDurationInMilliseconds,
|
|
121
|
-
timeToCombine: overallProgress.postRenderData.timeToCombine,
|
|
122
|
-
combinedFrames: totalFrameCount,
|
|
123
|
-
renderMetadata: overallProgress.renderMetadata,
|
|
124
|
-
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
125
|
-
compositionValidated: overallProgress.compositionValidated,
|
|
126
|
-
functionLaunched: overallProgress.functionLaunched,
|
|
127
|
-
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
128
|
-
artifacts: overallProgress.receivedArtifact,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const {renderMetadata} = overallProgress;
|
|
133
|
-
|
|
134
|
-
const errorExplanations = inspectErrors({
|
|
135
|
-
errors: overallProgress.errors,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const {hasAudio, hasVideo} = renderMetadata
|
|
139
|
-
? lambdaRenderHasAudioVideo(renderMetadata)
|
|
140
|
-
: {hasAudio: false, hasVideo: false};
|
|
141
|
-
|
|
142
|
-
const chunkCount = overallProgress.chunks.length ?? 0;
|
|
143
|
-
|
|
144
|
-
const cleanup: CleanupInfo = {
|
|
145
|
-
doneIn: null,
|
|
146
|
-
minFilesToDelete: 0,
|
|
147
|
-
filesDeleted: 0,
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
if (renderMetadata === null) {
|
|
151
|
-
return {
|
|
152
|
-
framesRendered: overallProgress.framesRendered ?? 0,
|
|
153
|
-
chunks: chunkCount,
|
|
154
|
-
done: false,
|
|
155
|
-
encodingStatus: {
|
|
156
|
-
framesEncoded: overallProgress.framesEncoded,
|
|
157
|
-
combinedFrames: overallProgress.combinedFrames,
|
|
158
|
-
timeToCombine: overallProgress.timeToCombine,
|
|
159
|
-
},
|
|
160
|
-
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
161
|
-
costs: formatCostsInfo(0),
|
|
162
|
-
renderId,
|
|
163
|
-
renderMetadata,
|
|
164
|
-
bucket: bucketName,
|
|
165
|
-
outputFile: null,
|
|
166
|
-
timeToFinish: null,
|
|
167
|
-
errors: errorExplanations,
|
|
168
|
-
fatalErrorEncountered: errorExplanations.some(
|
|
169
|
-
(f) => f.isFatal && !f.willRetry,
|
|
170
|
-
),
|
|
171
|
-
currentTime: Date.now(),
|
|
172
|
-
renderSize: 0,
|
|
173
|
-
lambdasInvoked: overallProgress.lambdasInvoked ?? 0,
|
|
174
|
-
cleanup,
|
|
175
|
-
timeToFinishChunks: null,
|
|
176
|
-
overallProgress: getOverallProgress({
|
|
177
|
-
encoding: 0,
|
|
178
|
-
invoking: 0,
|
|
179
|
-
frames: 0,
|
|
180
|
-
gotComposition: overallProgress.compositionValidated,
|
|
181
|
-
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
182
|
-
invokedLambda: overallProgress.lambdasInvoked,
|
|
183
|
-
combining: 0,
|
|
184
|
-
}),
|
|
185
|
-
retriesInfo: overallProgress.retries ?? [],
|
|
186
|
-
outKey: null,
|
|
187
|
-
outBucket: null,
|
|
188
|
-
mostExpensiveFrameRanges: null,
|
|
189
|
-
timeToEncode: overallProgress.timeToEncode,
|
|
190
|
-
outputSizeInBytes: null,
|
|
191
|
-
estimatedBillingDurationInMilliseconds: null,
|
|
192
|
-
combinedFrames: overallProgress.combinedFrames ?? 0,
|
|
193
|
-
timeToCombine: overallProgress.timeToCombine ?? null,
|
|
194
|
-
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
195
|
-
type: 'success',
|
|
196
|
-
compositionValidated: overallProgress.compositionValidated,
|
|
197
|
-
functionLaunched: overallProgress.functionLaunched,
|
|
198
|
-
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
199
|
-
artifacts: overallProgress.receivedArtifact,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const priceFromBucket = estimatePriceFromMetadata({
|
|
204
|
-
renderMetadata,
|
|
205
|
-
memorySizeInMb:
|
|
206
|
-
providerSpecifics.parseFunctionName(renderMetadata.rendererFunctionName)
|
|
207
|
-
?.memorySizeInMb ?? memorySizeInMb,
|
|
208
|
-
functionsInvoked: renderMetadata.estimatedRenderLambdaInvokations ?? 0,
|
|
209
|
-
diskSizeInMb: providerSpecifics.getEphemeralStorageForPriceCalculation(),
|
|
210
|
-
timings: overallProgress.timings ?? [],
|
|
211
|
-
region,
|
|
212
|
-
providerSpecifics,
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
const chunkMultiplier = [hasAudio, hasVideo].filter(truthy).length;
|
|
216
|
-
|
|
217
|
-
if (renderMetadata.type === 'still') {
|
|
218
|
-
throw new Error(
|
|
219
|
-
"You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! 😉",
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const allChunks =
|
|
224
|
-
(overallProgress.chunks ?? []).length / chunkMultiplier ===
|
|
225
|
-
(renderMetadata.totalChunks ?? Infinity);
|
|
226
|
-
|
|
227
|
-
const frameCount = NoReactAPIs.getFramesToRender(
|
|
228
|
-
renderMetadata.frameRange,
|
|
229
|
-
renderMetadata.everyNthFrame,
|
|
230
|
-
).length;
|
|
231
|
-
|
|
232
|
-
const missingChunks = new Array(renderMetadata.totalChunks)
|
|
233
|
-
.fill(true)
|
|
234
|
-
.map((_, i) => i)
|
|
235
|
-
.filter((index) => {
|
|
236
|
-
return (
|
|
237
|
-
typeof (overallProgress.chunks ?? []).find((c) => c === index) ===
|
|
238
|
-
'undefined'
|
|
239
|
-
);
|
|
240
|
-
});
|
|
241
|
-
// 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
|
|
242
|
-
|
|
243
|
-
// 1. If we have missing chunks, we consider it timed out
|
|
244
|
-
const isBeyondTimeoutAndMissingChunks =
|
|
245
|
-
Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 &&
|
|
246
|
-
missingChunks &&
|
|
247
|
-
missingChunks.length > 0;
|
|
248
|
-
|
|
249
|
-
// 2. If we have no missing chunks, but the encoding is not done, even after the additional `merge` function has been spawned, we consider it timed out
|
|
250
|
-
const isBeyondTimeoutAndHasStitchTimeout =
|
|
251
|
-
Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
|
|
252
|
-
|
|
253
|
-
const allErrors: EnhancedErrorInfo[] = [
|
|
254
|
-
isBeyondTimeoutAndMissingChunks || isBeyondTimeoutAndHasStitchTimeout
|
|
255
|
-
? makeTimeoutError({
|
|
256
|
-
timeoutInMilliseconds,
|
|
257
|
-
renderMetadata,
|
|
258
|
-
renderId,
|
|
259
|
-
missingChunks: missingChunks ?? [],
|
|
260
|
-
region,
|
|
261
|
-
functionName,
|
|
262
|
-
providerSpecifics,
|
|
263
|
-
})
|
|
264
|
-
: null,
|
|
265
|
-
...errorExplanations,
|
|
266
|
-
].filter(truthy);
|
|
267
|
-
|
|
268
|
-
return {
|
|
269
|
-
framesRendered: overallProgress.framesRendered ?? 0,
|
|
270
|
-
chunks: chunkCount,
|
|
271
|
-
done: false,
|
|
272
|
-
encodingStatus: {
|
|
273
|
-
framesEncoded: overallProgress.framesEncoded,
|
|
274
|
-
combinedFrames: overallProgress.combinedFrames,
|
|
275
|
-
timeToCombine: overallProgress.timeToCombine,
|
|
276
|
-
},
|
|
277
|
-
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
278
|
-
costs: priceFromBucket
|
|
279
|
-
? formatCostsInfo(priceFromBucket.accruedSoFar)
|
|
280
|
-
: formatCostsInfo(0),
|
|
281
|
-
renderId,
|
|
282
|
-
renderMetadata,
|
|
283
|
-
bucket: bucketName,
|
|
284
|
-
outputFile: null,
|
|
285
|
-
timeToFinish: null,
|
|
286
|
-
errors: allErrors,
|
|
287
|
-
fatalErrorEncountered: allErrors.some((f) => f.isFatal && !f.willRetry),
|
|
288
|
-
currentTime: Date.now(),
|
|
289
|
-
renderSize: 0,
|
|
290
|
-
lambdasInvoked: overallProgress.lambdasInvoked ?? 0,
|
|
291
|
-
cleanup,
|
|
292
|
-
timeToFinishChunks:
|
|
293
|
-
allChunks && overallProgress
|
|
294
|
-
? calculateChunkTimes({
|
|
295
|
-
type: 'absolute-time',
|
|
296
|
-
timings: overallProgress.timings,
|
|
297
|
-
})
|
|
298
|
-
: null,
|
|
299
|
-
overallProgress: getOverallProgress({
|
|
300
|
-
encoding: frameCount
|
|
301
|
-
? (overallProgress.framesEncoded ?? 0) / frameCount
|
|
302
|
-
: 0,
|
|
303
|
-
invoking:
|
|
304
|
-
(overallProgress.lambdasInvoked ?? 0) /
|
|
305
|
-
renderMetadata.estimatedRenderLambdaInvokations,
|
|
306
|
-
frames: (overallProgress.framesRendered ?? 0) / (frameCount ?? 1),
|
|
307
|
-
gotComposition: overallProgress.compositionValidated,
|
|
308
|
-
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
309
|
-
invokedLambda: overallProgress.lambdasInvoked,
|
|
310
|
-
combining: overallProgress.combinedFrames / (frameCount ?? 1),
|
|
311
|
-
}),
|
|
312
|
-
retriesInfo: overallProgress.retries ?? [],
|
|
313
|
-
outKey: null,
|
|
314
|
-
outBucket: null,
|
|
315
|
-
mostExpensiveFrameRanges: null,
|
|
316
|
-
timeToEncode: overallProgress.timeToEncode,
|
|
317
|
-
outputSizeInBytes: null,
|
|
318
|
-
estimatedBillingDurationInMilliseconds: priceFromBucket
|
|
319
|
-
? priceFromBucket.estimatedBillingDurationInMilliseconds
|
|
320
|
-
: null,
|
|
321
|
-
combinedFrames: overallProgress.combinedFrames ?? 0,
|
|
322
|
-
timeToCombine: overallProgress.timeToCombine ?? null,
|
|
323
|
-
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
324
|
-
type: 'success',
|
|
325
|
-
compositionValidated: overallProgress.compositionValidated,
|
|
326
|
-
functionLaunched: overallProgress.functionLaunched,
|
|
327
|
-
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
328
|
-
artifacts: overallProgress.receivedArtifact,
|
|
329
|
-
};
|
|
330
|
-
};
|