Skip to content

Commit 63bbd55

Browse files
authored
[Queue Time Histogram] Add Job Queue Time Lambda (#6435)
# Description Add aws lambda to generate in-queue job histgram, steps: 1. add logic to generate snapshot of in-queue jobs **[This PR]** 2. add logic to generate histogram 3. suppport multi-threading for backfilling the snapshot data we generate includes: { queue_s, repo, workflow_name , job_name, htm_url, machine_type, time, runner_labels} the runner_labels includes the machine_type, and other categories such as linux, dynamic etc Design Doc:[doc](https://docs.google.com/document/d/1OiPv-ku_NvMgvnaMIbtnIEHTixJY28CBaKeMKJtglEk/edit?tab=t.0#heading=h.87bg49h503n7) # working result in s3 (Ran locally) [s3 link](https://us-east-1.console.aws.amazon.com/s3/object/ossci-raw-job-status?region=us-east-1&bucketType=general&prefix=job_queue_times_historical/pytorch/pytorch/1742367310.txt)
1 parent c62e321 commit 63bbd55

File tree

9 files changed

+1088
-0
lines changed

9 files changed

+1088
-0
lines changed

.github/workflows/tests.yml

+18
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ jobs:
3939
# Test tools
4040
python3 -m unittest discover -vs tools/tests -p 'test_*.py'
4141
42+
test-aws-lambda:
43+
name: Test aws lambda
44+
if: ${{ github.repository == 'pytorch/test-infra' }}
45+
uses: ./.github/workflows/linux_job_v2.yml
46+
with:
47+
docker-image: python:3.10-slim-bullseye
48+
runner: linux.large
49+
script: |
50+
# Environment setup
51+
echo ::group::setup Python environment
52+
python -m venv .venv/
53+
source .venv/bin/activate
54+
pip install -r aws/lambda/tests/test_requirements.txt
55+
echo ::endgroup::
56+
57+
# Test aws lambda
58+
pytest -v aws/lambda/tests
59+
4260
test-github-scripts:
4361
name: Test github scripts
4462
if: ${{ github.repository == 'pytorch/test-infra' }}

.lintrunner.toml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ include_patterns = [
4343
'torchci/**/*.py',
4444
'torchci/**/*.pyi',
4545
'.github/scripts/*.py',
46+
'aws/lambda/oss-ci-job-queue-time/*.py',
4647
'aws/lambda/whl_metadata_upload_pep658/**/*.py',
4748
]
4849
command = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.zip
2+
deployment/
3+
venv/
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
all: run-local
2+
3+
clean:
4+
rm -rf deployment
5+
rm -rf venv
6+
rm -rf deployment.zip
7+
8+
venv/bin/python:
9+
virtualenv venv
10+
venv/bin/pip install -r requirements.txt
11+
12+
deployment.zip:
13+
mkdir -p deployment
14+
cp lambda_function.py ./deployment/.
15+
pip3.10 install -r requirements.txt -t ./deployment/. --platform manylinux2014_x86_64 --only-binary=:all: --implementation cp --python-version 3.10 --upgrade
16+
cd ./deployment && zip -q -r ../deployment.zip .
17+
18+
.PHONY: create-deployment-package
19+
create-deployment-package: deployment.zip

0 commit comments

Comments
 (0)