mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
This reverts commit fc3a5d8117.
Reverted https://github.com/pytorch/pytorch/pull/78932 on behalf of https://github.com/janeyx99 due to Broke ROCm tests when introducing rockset requirement https://hud.pytorch.org/minihud#fc3a5d81171ba465e3d62ffbda9713b53039b5f0
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
from typing import Any, Dict
|
|
from datetime import datetime, timedelta
|
|
from gitutils import _check_output
|
|
|
|
from rockset import Client, ParamDict # type: ignore[import]
|
|
import os
|
|
|
|
rs = Client(api_key=os.getenv("ROCKSET_API_KEY", None))
|
|
qlambda = rs.QueryLambda.retrieve(
|
|
'commit_jobs_batch_query',
|
|
version='15aba20837ae9d75',
|
|
workspace='commons')
|
|
|
|
def parse_args() -> Any:
|
|
from argparse import ArgumentParser
|
|
parser = ArgumentParser("Print latest commits")
|
|
parser.add_argument("--minutes", type=int, default=30, help="duration in minutes of last commits")
|
|
return parser.parse_args()
|
|
|
|
def print_latest_commits(minutes: int = 30) -> None:
|
|
current_time = datetime.now()
|
|
time_since = current_time - timedelta(minutes=minutes)
|
|
timestamp_since = datetime.timestamp(time_since)
|
|
commits = _check_output(
|
|
[
|
|
"git",
|
|
"rev-list",
|
|
f"--max-age={timestamp_since}",
|
|
"--remotes=*origin/master",
|
|
],
|
|
encoding="ascii",
|
|
).splitlines()
|
|
|
|
params = ParamDict()
|
|
params['shas'] = ",".join(commits)
|
|
results = qlambda.execute(parameters=params)
|
|
|
|
for commit in commits:
|
|
print_commit_status(commit, results)
|
|
|
|
def print_commit_status(commit: str, results: Dict[str, Any]) -> None:
|
|
print(commit)
|
|
for check in results['results']:
|
|
if check['sha'] == commit:
|
|
print(f"\t{check['conclusion']:>10}: {check['name']}")
|
|
|
|
def main() -> None:
|
|
args = parse_args()
|
|
print_latest_commits(args.minutes)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|