Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Refactor pendingpatches #111

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

major
Copy link
Contributor

@major major commented Jul 13, 2018

This PR adjusts sktm to store patches in the database as soon as they are received. It also transforms the pendingpatches table into a linkage between a list of patches and a Jenkins job that is testing those patches.

This work is required so that sktm can exit after queueing jobs and check on those jobs later as described in #110.

Allow sktm to store the name and build ID of the Jenkins job that
is spawned to run tests.

Signed-off-by: Major Hayden <[email protected]>
@major major added the enhancement New feature or request label Jul 13, 2018
@major major self-assigned this Jul 13, 2018
Add patches to the `patch` table as soon as they are received.

Alter the `pendingpatches` table to link test jobs (`pendingjobs`)
with patches in the `patch` table. Store each test job in the
`pendingjobs` table and refer to the table when checking on tested
patches.

Signed-off-by: Major Hayden <[email protected]>
@major major force-pushed the patch-table-source-of-truth branch from 5387015 to 70b3535 Compare July 13, 2018 19:45
@coveralls
Copy link

coveralls commented Jul 13, 2018

Pull Request Test Coverage Report for Build 351

  • 16 of 28 (57.14%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 29.518%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sktm/init.py 0 12 0.0%
Totals Coverage Status
Change from base Build 343: 1.0%
Covered Lines: 323
Relevant Lines: 924

💛 - Coveralls

@major major mentioned this pull request Jul 13, 2018
1 task
Copy link
Contributor

@veruu veruu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the overall sentiment of this pull, but have some concerns about some of the changes as well :) Can you please check if my thoughts make sense?

@@ -0,0 +1,8 @@
-- NOTE: Apply this change only when no patches are pending.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that this is due to not knowing how to link the pending jobs with patches in the table, but there's a chance people applying the migration wouldn't open and read the file itself since they don't need to. Can you make a subsection in the README (under Database upgrading) for migration limitations, and mention this condition there?

for patch_url in patch_urls]

# Add the patches to the database
self.db.commit_series(patches)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patches should be included in the patch table only after they completed the testing. I understand that you want to save every grabbed patch into the table, but the table was meant to say "this is what was fully processed" and now we won't have that. Granted, the question is whether we do need that functionality, but that belongs more to the discussion around #80.

[(patch_id, patch_date, sourceid, tstamp) for
(patch_id, patch_date) in series_data])
self.cur.executemany(
'INSERT OR REPLACE INTO pendingpatches '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we can have same patch IDs across different Patchworks, we might end up overwriting entries we shouldn't. We are lucky we haven't run into this issue yet, but since you are touching the same logic here and carrying the bug over, can you fix the bug as well?

for series in series_dropped:
logging.info("dropped series: %s", series.get_obj_url_list())

# Retrieve all data and save dropped patches in the DB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see issue #100 and commit 0051c4c for explanation why this was added. We don't want to be rechecking patches that were supposed to be dropped all over again until new patch is added to the project. If you want to do it other way feel free to do so but please don't reintroduce the bug :)

@major
Copy link
Contributor Author

major commented Jul 16, 2018

@veruu What if we did something like this:

  1. Insert all patches into the patch table as soon as sktm sees them
  2. Add a column to the patch table to hold the Jenkins job name/build id (this would signify that the patch is currently being tested)
  3. Delete the pendingpatches table
  4. Adjust the id in the patch table to be an auto incremented integer
  5. Rename id to patch_id in the patch table
  6. Add a unique constraint for patchsource_id and patch_id in the patch table

This would reduce the complexity in the database and let the patch table be the source of truth for sktm.

@major
Copy link
Contributor Author

major commented Jul 16, 2018

The downside would be that we would have the Jenkins data appearing repeatedly in the patch table. We could still have a pendingjobs table and link to that if it makes more sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants