diff options
-rwxr-xr-x | bin/reproducible_common.py | 4 | ||||
-rwxr-xr-x | bin/reproducible_db_maintenance.py | 10 | ||||
-rwxr-xr-x | bin/reproducible_remote_scheduler.py | 4 | ||||
-rwxr-xr-x | bin/reproducible_scheduler.py | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index 9a73a2c4..58f60e27 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -17,12 +17,12 @@ import errno import sqlite3 import logging import argparse -import datetime import psycopg2 import html as HTML from string import Template from subprocess import call from traceback import print_exception +from datetime import datetime, timedelta DEBUG = False QUIET = False @@ -229,7 +229,7 @@ def _gen_links(suite, arch): def write_html_page(title, body, destfile, suite=defaultsuite, arch=defaultarch, noheader=False, style_note=False, noendpage=False): - now = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') + now = datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC') html = '' html += html_header.substitute(page_title=title) if not noheader: diff --git a/bin/reproducible_db_maintenance.py b/bin/reproducible_db_maintenance.py index b2947384..8b802200 100755 --- a/bin/reproducible_db_maintenance.py +++ b/bin/reproducible_db_maintenance.py @@ -13,7 +13,7 @@ from reproducible_common import * -now = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") +now = datetime.now().strftime("%Y-%m-%d-%H-%M-%S") # the original schema is here @@ -420,12 +420,12 @@ def db_update(): log.info('Found schema updates.') for update in range(current+1, last+1): log.info('Applying database update #' + str(update) + '. Queries:') - startTime = datetime.datetime.now() + startTime = datetime.now() for query in schema_updates[update]: log.info('\t' + query) query_db(query) log.info(str(len(schema_updates[update])) + ' queries executed in ' + - str(datetime.datetime.now() - startTime)) + str(datetime.now() - startTime)) return True @@ -440,7 +440,7 @@ if __name__ == '__main__': changed_created = db_create_tables() changed = db_update() if changed or changed_created: - log.info('Total execution time: ' + str(datetime.datetime.now() - - datetime.datetime.strptime(now, "%Y-%m-%d-%H-%M-%S"))) + log.info('Total execution time: ' + str(datetime.now() - + datetime.strptime(now, "%Y-%m-%d-%H-%M-%S"))) else: log.info('No pending updates.') diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py index aeca6f0b..55b76636 100755 --- a/bin/reproducible_remote_scheduler.py +++ b/bin/reproducible_remote_scheduler.py @@ -119,11 +119,11 @@ message += ': ' + ' '.join(pkgs)[0:256] + blablabla + artifacts_txt # schedule on the full hour so we can recognize them easily epoch = int(time.time()) yesterday = epoch - 60*60*24 -now = datetime.datetime.now() +now = datetime.now() days = int(now.strftime('%j'))*2 hours = int(now.strftime('%H'))*2 minutes = int(now.strftime('%M')) -time_delta = datetime.timedelta(days=days, hours=hours, minutes=minutes) +time_delta = timedelta(days=days, hours=hours, minutes=minutes) date = (now - time_delta).strftime('%Y-%m-%d %H:%M') log.debug('date_scheduled = ' + date + ' time_delta = ' + str(time_delta)) diff --git a/bin/reproducible_scheduler.py b/bin/reproducible_scheduler.py index 1f6500bd..cfa03d00 100755 --- a/bin/reproducible_scheduler.py +++ b/bin/reproducible_scheduler.py @@ -301,9 +301,9 @@ def scheduler(): 'WHERE s.suite="{suite}"'.format(suite=suite) now_queued_here[suite] = int(query_db(query)[0][0]) + len(untested[suite]+new[suite]+old[suite]) # schedule packages differently in the queue... - schedule_packages(untested[suite], datetime.datetime.now()) - schedule_packages(new[suite], datetime.datetime.now()+datetime.timedelta(minutes=-720)) - schedule_packages(old[suite], datetime.datetime.now()+datetime.timedelta(minutes=720)) + schedule_packages(untested[suite], datetime.now()) + schedule_packages(new[suite], datetime.now()+timedelta(minutes=-720)) + schedule_packages(old[suite], datetime.now()+timedelta(minutes=720)) log.info('### Suite ' + suite + ' done ###') log.info('==============================================================') # update the scheduled page |