5
5
It will filter only completed kernel builds, limit to 100 events per request,
6
6
and retrieve corresponding nodes with artifacts.
7
7
"""
8
+ import argparse
8
9
import requests
9
10
import json
10
11
import sys
20
21
# saving last processed timestamp to a file or database
21
22
timestamp = "1970-01-01T00:00:00.000000"
22
23
23
- def pollevents (timestamp ):
24
- url = BASE_URI + EVENTS_PATH + f"?kind=kbuild&state=done&limit=100&recursive=true&from={ timestamp } "
24
+
25
+ """
26
+ kind:
27
+
28
+ There are a few different kinds:
29
+
30
+ * checkout: a new git tree checkout to be tested. Maestro frequently cuts
31
+ new tree checkout from tree it is subscribed to. See 'config/pipeline.yaml'
32
+ * kbuild: a new kernel build for a given config and arch
33
+ * job: the execution of a test suite
34
+ * test: the execution of a test inside a job
35
+
36
+
37
+ state:
38
+
39
+ In this example we track state=done to get an event when Maestro is ready to
40
+ provide all the information about the node. Eg for checkout it will provide
41
+ the commit hash to test and for builds the location of the kernel binaries built.
42
+ """
43
+
44
+ def pollevents (timestamp , kind ):
45
+ url = BASE_URI + EVENTS_PATH + f"?state=done&kind={ kind } &limit=100&recursive=true&from={ timestamp } "
25
46
print (url )
26
47
response = requests .get (url )
27
48
response .raise_for_status ()
@@ -30,9 +51,13 @@ def pollevents(timestamp):
30
51
31
52
def main ():
32
53
global timestamp
54
+
55
+ parser = argparse .ArgumentParser (description = "Listen to events in Maestro." )
56
+ parser .add_argument ("--kind" , default = "kbuild" , help = "The kind of events" )
57
+ args = parser .parse_args ()
33
58
while True :
34
59
try :
35
- events = pollevents (timestamp )
60
+ events = pollevents (timestamp , args . kind )
36
61
if len (events ) == 0 :
37
62
print ("No new events, sleeping for 30 seconds" )
38
63
time .sleep (30 )
0 commit comments