@@ -160,6 +160,52 @@ def __get_sourceid(self, baseurl, project_id):
160160
161161 return result [0 ]
162162
163+ def add_pending_job (self , job_name , build_id ):
164+ """Add a Jenkins job to the list of pending jobs.
165+
166+ Args:
167+ job_name: Job name in jenkins
168+ build_id: Build ID for the Jenkins job
169+ """
170+ self .cur .execute (
171+ "INSERT INTO pendingjobs (job_name, build_id) VALUES (?,?)" ,
172+ (job_name , build_id )
173+ )
174+ self .conn .commit ()
175+
176+ def get_pending_jobs (self ):
177+ """Get a list of pending Jenkins jobs."""
178+ self .cur .execute ("SELECT * FROM pendingjobs" )
179+ return self .cur .fetchall ()
180+
181+ def remove_pending_job (self , pendingjob_id ):
182+ """Remove a pending job and any associated pending patches.
183+
184+ Args:
185+ pendingjob_id: ID of a job from the pendingjobs table.
186+ """
187+ self .cur .execute (
188+ "DELETE FROM pendingjobs WHERE id = ?" , str (pendingjob_id )
189+ )
190+ self .cur .execute (
191+ "DELETE FROM pendingpatches WHERE pendingjob_id = ?" ,
192+ str (pendingjob_id )
193+ )
194+ self .conn .commit ()
195+
196+ def get_patches_for_job (self , pendingjob_id ):
197+ """Get a list of pending patches for a Jenkins job.
198+
199+ Args:
200+ pendingjob_id: ID of a job from the pendingjobs table.
201+ """
202+ pendingjob_id = str (pendingjob_id )
203+ self .cur .execute (
204+ "SELECT * FROM pendingpatches WHERE pendingjob_id = ?" ,
205+ (pendingjob_id )
206+ )
207+ return self .cur .fetchall ()
208+
163209 def get_last_checked_patch (self , baseurl , project_id ):
164210 """Get the patch id of the last patch that was checked.
165211
0 commit comments