[Qa-jenkins-scm] [jenkins.debian.net] 04/07: reproducible: reschedule: add a --dry-run option to do exactly that (doh!)

Holger Levsen holger at moszumanska.debian.org
Sun Jul 5 13:12:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 9b7b7c740f82bc46e98942fee3ba3065bf4093dc
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Sun Jun 21 14:45:17 2015 +0000

    reproducible: reschedule: add a --dry-run option to do exactly that (doh!)
---
 bin/reproducible_remote_scheduler.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 79b6054..ad29f6b 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -18,6 +18,7 @@ parser = argparse.ArgumentParser(
            ' IRC channel unless -n is provided.\nSpecifying both -r and -i ' +
            'means "all packages with that issue AND that status"')
 group = parser.add_mutually_exclusive_group()
+parser.add_argument('--dry-run', action='store_true')
 group.add_argument('-a', '--artifacts', default=False, action='store_true',
                    help='Save artifacts (for further offline study)')
 group.add_argument('-n', '--no-notify', default=False, action='store_true',
@@ -81,8 +82,10 @@ packages = scheduling_args.packages
 artifacts = scheduling_args.artifacts
 notify = not scheduling_args.no_notify or scheduling_args.noisy
 debug_url = scheduling_args.noisy
+dry_run = scheduling_args.dry_run
 
 log.debug('Requester: ' + requester)
+log.debug('Dry run: ' + str(dry_run))
 log.debug('Local call: ' + str(local))
 log.debug('Reason: ' + reason)
 log.debug('Artifacts: ' + str(artifacts))
@@ -229,13 +232,17 @@ query1 = '''REPLACE INTO schedule
 query2 = '''INSERT INTO manual_scheduler
     (package_id, requester, date_request) VALUES (?, ?, ?)'''
 
-cursor = conn_db.cursor()
-cursor.executemany(query1, to_schedule)
-cursor.executemany(query2, save_schedule)
-conn_db.commit()
+if not dry_run:
+    cursor = conn_db.cursor()
+    cursor.executemany(query1, to_schedule)
+    cursor.executemany(query2, save_schedule)
+    conn_db.commit()
+else:
+    log.info('Ran with --dry-run, I did scheduled nothing')
 
 log.info(bcolors.GOOD + message + bcolors.ENDC)
 if not (local and requester == "jenkins maintenance job") and len(ids) != 0:
-    irc_msg(message)
+    if not dry_run:
+        irc_msg(message)
 
 generate_schedule()  # the html page

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list