diff --git a/ci/build-helpers.sh b/ci/build-helpers.sh index 199e94f2..814f798c 100755 --- a/ci/build-helpers.sh +++ b/ci/build-helpers.sh @@ -45,7 +45,7 @@ function report_state () { ${NUM_BASE_COMMITS:+"num_base_commits=$NUM_BASE_COMMITS"} \ -- "host=\"$(hostname -s)\"" "state=\"$current_state\"" \ "prid=\"$PR_NUMBER\"" ${prtime:+prtime=$prtime} ${PR_OK:+prok=$PR_OK} \ - ${LAST_PUSH_TIME:+push=$LAST_PUSH_TIME} \ + ${LAST_PUSH_TIME:+waittime=$((time_now - LAST_PUSH_TIME))} \ ${HAVE_JALIEN_TOKEN:+have_jalien_token=$HAVE_JALIEN_TOKEN} # Push to Google Analytics if configured diff --git a/list-branch-pr b/list-branch-pr index 3743eea7..c223e650 100755 --- a/list-branch-pr +++ b/list-branch-pr @@ -24,6 +24,7 @@ import sys from argparse import ArgumentParser from collections import defaultdict +from datetime import datetime from gql import Client, gql from gql.transport.requests import RequestsHTTPTransport @@ -179,16 +180,15 @@ class RepoConfig: ("succeeded" if success else "failed") else: state = "skip" - print("pr: {number:6d}@{sha:.7s}: revd={reviewed:d} trust={trust:d} " - "tested={tested:d} success={success:d} => state={state}".format( - number=pull_number, sha=commit_hash, reviewed=reviewed, - trust=is_trusted, tested=tested, success=success, state=state - ), file=sys.stderr) + updated_time = last_commit["pushedDate"] + print(f"pr: {pull_number:6d}@{commit_hash:.7s}: upd={updated_time:s} " + f"revd={reviewed:d} trust={is_trusted:d} tested={tested:d} " + f"success={success:d} => state={state}", file=sys.stderr) return None if state == "skip" else (state, { "number": pull_number, "sha": commit_hash, "build_config": self.build_config, - "updated_at": last_commit["pushedDate"], + "updated_at": updated_time, }) def process_pulls(self, session, repo_info, show_base_branch=False): @@ -258,8 +258,11 @@ def main(args): # pr["updated_at"] can apparently be None sometimes, which breaks # sorting, so default to the empty string if so. for pull in sorted(prs, key=lambda pr: pr["updated_at"] or ""): - print(group, pull["number"], pull["sha"], - pull["build_config"], pull["updated_at"], sep="\t") + last_push_timestamp = \ + int(datetime.fromisoformat(pull["updated_at"]).timestamp) \ + if pull["updated_at"] else int(datetime.utcnow().timestamp) + print(group, pull["number"], pull["sha"], pull["build_config"], + last_push_timestamp, sep="\t") if grouped["untested"]: # If there are untested PRs waiting, build all of them first.