@@ -33,31 +33,27 @@ twice and then DLQs it.
3333
3434## Classification
3535
36- After a log is stored, ` log_classifier ` is invoked with ` InvocationType: "Event" `
37- and the result is not awaited. ` github-status-test ` called it with an untimed
38- ` urlopen ` and blocked until classification finished, which is what produced its
39- 274s/344s/400s/900s duration tails — the fix is the invocation type, not a
40- separate function.
41-
42- It is reached through ` lambda:InvokeFunction ` rather than its public function URL
43- (` AuthType: NONE ` ), so the path from here to classification never crosses a
44- public endpoint. A function URL would not work anyway: those only support the
45- ` RequestResponse ` invocation type, so calling one means waiting for
46- classification to finish.
47-
48- ` log_classifier ` builds on ` lambda_http ` with only the ` apigw_http ` feature, so
49- ` classifier_payload() ` reproduces the API Gateway HTTP API v2.0 request it
50- expects even on a direct invoke. Verified against the deployed function: a
51- payload with no ` job_id ` returns its 400 "no job id provided" branch, and a
52- non-numeric one fails inside its ` parse::<usize>() ` , which together show both the
53- envelope and the query string are read.
54-
55- That envelope is coupling to another lambda's framework, and it would break if
56- ` log_classifier ` 's handler changed. Teaching it to accept a plain
57- ` {"job_id", "repo"} ` payload is the real fix, and lets its public function URL be
58- retired once ` backfillJobs.mjs ` , ` keep-going-call-log-classifier ` and
59- ` github-status-test ` move off it too — worth doing on its own, not as a rider on
60- this migration.
36+ After a log is stored, ` log_classifier ` is called through its function URL —
37+ byte for byte the call ` github-status-test ` makes today.
38+
39+ That call is synchronous. Function URLs only support the ` RequestResponse `
40+ invocation type, so this function's duration includes the classification, and
41+ ` github-status-test ` 's 274s/344s/400s/900s duration maxima come from exactly
42+ this. ** Keep the timeout at 900s** : on a slow classification a shorter one would
43+ kill the invocation mid-wait, and since callers invoke asynchronously, Lambda
44+ would then retry the whole thing and re-download the log.
45+
46+ Unlike in ` github-status-test ` the tail is no longer harmful. There it ran behind
47+ API Gateway on the webhook's critical path, so a slow classification risked a
48+ GitHub webhook timeout. Here the caller has already returned, and a long
49+ invocation costs GB-seconds and a concurrency slot, nothing more.
50+
51+ The way out is ` lambda:InvokeFunction ` with ` InvocationType: "Event" ` , which
52+ needs ` log_classifier ` to accept a plain ` {"job_id", "repo"} ` payload — it
53+ currently only parses the API Gateway request its ` lambda_http ` handler expects.
54+ That change also lets its ` AuthType: NONE ` function URL be retired, once
55+ ` backfillJobs.mjs ` , ` keep-going-call-log-classifier ` and ` github-status-test `
56+ move off it. Worth doing on its own, not as a rider on this migration.
6157
6258A failed handoff is logged and reported as ` classified: false ` , not raised.
6359Raising would make Lambda retry the whole function, re-downloading a
@@ -112,13 +108,12 @@ Notes on the app path:
112108
113109Not done by CI. Needed before the deploy workflow can run.
114110
115- 1 . Create the function: python3.12, x86_64, handler ` lambda_function.lambda_handler ` .
116- 512 MB and a 60s timeout are plenty — the old function averaged 200ms and its
117- long tail was the classifier ping this one does not make.
118- 2 . Give its execution role ` s3:PutObject ` on ` arn:aws:s3:::ossci-raw-job-status/log/* ` ,
119- ` lambda:InvokeFunction ` on
120- ` arn:aws:lambda:us-east-1:308535385114:function:log_classifier ` , plus the
121- usual CloudWatch Logs permissions.
111+ 1 . Create the function: python3.12, x86_64, handler ` lambda_function.lambda_handler ` ,
112+ 512 MB, ** 900s timeout** — matching ` github-status-test ` , because the
113+ synchronous classifier call means a slow classification is a slow invocation.
114+ 2 . Give its execution role ` s3:PutObject ` on ` arn:aws:s3:::ossci-raw-job-status/log/* `
115+ plus the usual CloudWatch Logs permissions. No ` lambda:InvokeFunction ` is
116+ needed while the classifier is reached over its function URL.
1221173 . Set the env vars above. Prefer fresh credentials over copying
123118 ` github-status-test ` 's, whose PATs sit in plaintext env vars and are due for
124119 rotation.
@@ -134,9 +129,8 @@ Not done by CI. Needed before the deploy workflow can run.
134129 ` OUR_AWS_ACCESS_KEY_ID ` before granting.
1351306 . Create the ` gha_workflow_gha-log-uploader-lambda ` IAM role the deploy workflow
136131 assumes, mirroring ` gha_workflow_github-status-test-lambda ` .
137- 7 . Nothing to wire for classification: this function invokes ` log_classifier `
138- directly, so there is no S3 notification to add. ` keep-going-call-log-classifier `
139- still covers the separate ` temp_logs/ ` prefix on ` gha-artifacts ` .
132+ 7 . Nothing to wire for classification: the classifier is called over its existing
133+ function URL, so there is no notification or extra permission to add.
140134
141135## Deployment
142136
0 commit comments