find.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python3
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. import time
  11. from materialize.buildkite_insights.buildkite_api import builds_api, generic_api
  12. def main() -> None:
  13. # Used to find recent instances of https://github.com/MaterializeInc/database-issues/issues/7338
  14. # 2 weeks ~ 2000 builds
  15. data = builds_api.get_builds_of_all_pipelines(max_fetches=20, branch=None)
  16. for build in data:
  17. request_path = f"organizations/materialize/pipelines/{build['pipeline']['slug']}/builds/{build['number']}/artifacts"
  18. params = {"per_page": "100"}
  19. result = generic_api.get_multiple(request_path, params, max_fetches=None)
  20. for artifact in result:
  21. # Some core files are corrupted, probably because they get dumped during shutdown, ignore them
  22. if (
  23. "core" in artifact["filename"]
  24. and build["pipeline"]["slug"] != "coverage"
  25. and artifact["file_size"] > 100000
  26. ):
  27. print(
  28. f"{build['started_at']}: {artifact['filename']} in https://buildkite.com/materialize/{build['pipeline']['slug']}/builds/{build['number']}#{artifact['job_id']}"
  29. )
  30. time.sleep(2)
  31. if __name__ == "__main__":
  32. main()