Skip to content

Conversation

huydhn
Copy link
Contributor

@huydhn huydhn commented Jun 6, 2025

Courtesy of Claude code. This is the initial version of an API that I'm building to allow people to upload benchmark results. This works in conjunction with pytorch/pytorch-integration-testing#36

I will need to prepare a Terraform change for the lambda, but the API works as follows:

import requests

with open("FILE_TO_BE_UPLOADED.json") as f:
    content = f.read()

json_data = {
    "username": "REDACT",
    "password": "REDACT",
    "content": content,
    "path": "v3/foobar/debug.json",
}

headers = {
    "content-type": "application/json"
}

url = "https://qrr6jzjpvyyd77fkj6mqkes4mq0tpirr.lambda-url.us-east-1.on.aws"
requests.post(url, json=json_data, headers=headers)

cc @zhe-thoughts @ZainRizvi

Signed-off-by: Huy Do <huydhn@gmail.com>
@vercel
Copy link

vercel bot commented Jun 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
torchci ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2025 8:26pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 6, 2025
huydhn added 2 commits June 5, 2025 17:41
Signed-off-by: Huy Do <huydhn@gmail.com>
Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn requested review from a team and ZainRizvi June 6, 2025 02:17
@huydhn huydhn marked this pull request as ready for review June 6, 2025 02:17
huydhn added 3 commits June 5, 2025 19:18
Signed-off-by: Huy Do <huydhn@gmail.com>
Signed-off-by: Huy Do <huydhn@gmail.com>
Signed-off-by: Huy Do <huydhn@gmail.com>
Copy link
Collaborator

@zxiiro zxiiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. My comments are just opinions so feel free to do with them what you think is best.

),
}

# Upload the content to S3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this comment is unnecessary since the function name it's commenting on is already descriptive.

"body": json.dumps({"message": f"Missing required parameter: {str(e)}"}),
}

# Check if the path already exists in the bucket
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this comment is unnecessary since check_path_exists() is already self describing function name.

),
}

# Extract authentication parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code below imo is pretty clear. I don't think the comment here is necessary.

"body": json.dumps({"message": "Authentication credentials are required"}),
}

# Validate authentication
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code below imo is pretty clear. I don't think the comment here is necessary.

"body": json.dumps({"message": "Invalid authentication credentials"}),
}

# Extract input parameters from the event
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case the comment gives less detail the the code it's describing. I'd just remove the comment altogether.

@huydhn
Copy link
Contributor Author

huydhn commented Jun 6, 2025

Let me clear up those redundant comments, I guess Claude wants to make sure that I understand what it is doing :)

huydhn added 2 commits June 6, 2025 13:06
Signed-off-by: Huy Do <huydhn@gmail.com>
Signed-off-by: Huy Do <huydhn@gmail.com>
@huydhn huydhn merged commit 13a990b into main Jun 6, 2025
6 checks passed
@huydhn huydhn deleted the api-upload-benchmark-results branch June 6, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants