diff --git a/config.py.in b/config.py.in index 31dccd2..e8a88b9 100644 --- a/config.py.in +++ b/config.py.in @@ -25,6 +25,9 @@ address = 'http://paddles.front.sepia.ceph.com' job_log_href_templ = 'http://qa-proxy.ceph.com/teuthology/{run_name}/{job_id}/teuthology.log' # noqa default_latest_runs_count = 25 +backup_name_regex = \ + '(?P.*)-(?P[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}_[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2})-(?P.*)-(?P.*)-.*?-.*?-(?P.*?)' # noqa + # Pecan Application Configurations app = { 'root': 'paddles.controllers.root.RootController', diff --git a/paddles/models/runs.py b/paddles/models/runs.py index d7250a4..5797822 100644 --- a/paddles/models/runs.py +++ b/paddles/models/runs.py @@ -93,12 +93,11 @@ def get_name_regexes(timestamp_regex, suite_names, distros, machine_types): class Run(Base): + timestamp_format = '%Y-%m-%d_%H:%M:%S' timestamp_regex = \ '[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}_[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}' - timestamp_format = '%Y-%m-%d_%H:%M:%S' name_regexes = get_name_regexes(timestamp_regex, suite_names, distros, machine_types) - backup_name_regex = '(?P.*)-(?P%s)-(?P.*)-(?P.*)-.*?-.*?-(?P.*?)' % timestamp_regex # noqa __tablename__ = 'runs' id = Column(Integer, primary_key=True) @@ -175,14 +174,15 @@ def _parse_name(cls, name): name_match = re.match(cls.name_regexes[0], name) or \ re.match(cls.name_regexes[1], name) or \ re.match(cls.name_regexes[2], name) or \ - re.match(cls.backup_name_regex, name) + re.match(conf.backup_name_regex, name) if name_match: match_dict = name_match.groupdict() for (key, value) in match_dict.iteritems(): match_dict[key] = value.strip(' -') - match_dict['scheduled'] = datetime.strptime( - match_dict['scheduled'], cls.timestamp_format) + if 'scheduled' in match_dict: + match_dict['scheduled'] = datetime.strptime( + match_dict['scheduled'], cls.timestamp_format) return match_dict return dict()