MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / queryJobEvents

Function queryJobEvents

jenkins/scripts/open_search_query.py:39–95  ·  view source on GitHub ↗

Query OpenSearch database for job events with pagination. Args: commitID: Git commit SHA to filter by (optional) stageName: Stage name to filter by (optional) onlySuccess: If True, only return PASSED tests (default: True) Returns: List of all matching test r

(commitID="", stageName="", onlySuccess=True)

Source from the content-addressed store, hash-verified

37
38
39def queryJobEvents(commitID="", stageName="", onlySuccess=True):
40 """Query OpenSearch database for job events with pagination.
41
42 Args:
43 commitID: Git commit SHA to filter by (optional)
44 stageName: Stage name to filter by (optional)
45 onlySuccess: If True, only return PASSED tests (default: True)
46
47 Returns:
48 List of all matching test result records
49 """
50 mustConditions = []
51 if commitID:
52 mustConditions.append({"term": {"s_trigger_mr_commit": commitID}})
53 if stageName:
54 mustConditions.append({"term": {"s_stage_name": stageName}})
55 if onlySuccess:
56 mustConditions.append({"term": {"s_status": "PASSED"}})
57
58 all_results = []
59 page_size = 1000
60 from_index = 0
61
62 while True:
63 requestBody = {
64 "query": {"bool": {"must": mustConditions}},
65 "_source": [
66 "s_job_name",
67 "s_status",
68 "s_build_id",
69 "s_turtle_name",
70 "s_test_name",
71 "s_gpu_type",
72 ],
73 "size": page_size,
74 "from": from_index,
75 }
76
77 formattedRequestBody = json.dumps(requestBody)
78 response = OpenSearchDB.queryFromOpenSearchDB(
79 formattedRequestBody, "swdl-trtllm-infra-ci-prod-test_info"
80 )
81 if response is None:
82 print("Failed to query from OpenSearchDB")
83 break
84 data = response.json()
85
86 hits = data["hits"]["hits"]
87 if not hits:
88 break
89
90 all_results.extend(hits)
91 from_index += page_size
92
93 print(f"Fetched {len(all_results)} records...")
94
95 return all_results
96

Callers 1

getPassedTestListFunction · 0.85

Calls 2

queryFromOpenSearchDBMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected