Skip to content

Commit d66a1cc

Browse files
committed
config: make backup_name_regex configurable
Signed-off-by: Seena Fallah <seenafallah@gmail.com>
1 parent 0015bd1 commit d66a1cc

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

config.py.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ address = 'http://paddles.front.sepia.ceph.com'
2525
job_log_href_templ = 'http://qa-proxy.ceph.com/teuthology/{run_name}/{job_id}/teuthology.log' # noqa
2626
default_latest_runs_count = 25
2727

28+
backup_name_regex = \
29+
'(?P<user>.*)-(?P<scheduled>[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<suite>.*)-(?P<branch>.*)-.*?-.*?-(?P<machine_type>.*?)' # noqa
30+
2831
# Pecan Application Configurations
2932
app = {
3033
'root': 'paddles.controllers.root.RootController',

paddles/models/runs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ def get_name_regexes(timestamp_regex, suite_names, distros, machine_types):
9393

9494

9595
class Run(Base):
96+
timestamp_format = '%Y-%m-%d_%H:%M:%S'
9697
timestamp_regex = \
9798
'[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}_[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}'
98-
timestamp_format = '%Y-%m-%d_%H:%M:%S'
9999
name_regexes = get_name_regexes(timestamp_regex, suite_names, distros,
100100
machine_types)
101-
backup_name_regex = '(?P<user>.*)-(?P<scheduled>%s)-(?P<suite>.*)-(?P<branch>.*)-.*?-.*?-(?P<machine_type>.*?)' % timestamp_regex # noqa
102101

103102
__tablename__ = 'runs'
104103
id = Column(Integer, primary_key=True)
@@ -175,14 +174,15 @@ def _parse_name(cls, name):
175174
name_match = re.match(cls.name_regexes[0], name) or \
176175
re.match(cls.name_regexes[1], name) or \
177176
re.match(cls.name_regexes[2], name) or \
178-
re.match(cls.backup_name_regex, name)
177+
re.match(conf.backup_name_regex, name)
179178
if name_match:
180179
match_dict = name_match.groupdict()
181180
for (key, value) in match_dict.iteritems():
182181
match_dict[key] = value.strip(' -')
183182

184-
match_dict['scheduled'] = datetime.strptime(
185-
match_dict['scheduled'], cls.timestamp_format)
183+
if 'scheduled' in match_dict:
184+
match_dict['scheduled'] = datetime.strptime(
185+
match_dict['scheduled'], cls.timestamp_format)
186186
return match_dict
187187
return dict()
188188

paddles/tests/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
address = 'http://localhost:%s' % server['port']
88
job_log_href_templ = 'http://qa-proxy.ceph.com/teuthology/{run_name}/{job_id}/teuthology.log' # noqa
99

10+
backup_name_regex = \
11+
'(?P<user>.*)-(?P<scheduled>[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<suite>.*)-(?P<branch>.*)-.*?-.*?-(?P<machine_type>.*?)' # noqa
12+
1013
default_latest_runs_count = 20
1114

1215
# Pecan Application Configurations

0 commit comments

Comments
 (0)