Skip to content

Commit

Permalink
config: make backup_name_regex configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Seena Fallah <[email protected]>
  • Loading branch information
clwluvw committed Jan 17, 2021
1 parent 0015bd1 commit 9f75fa2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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<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

# Pecan Application Configurations
app = {
'root': 'paddles.controllers.root.RootController',
Expand Down
8 changes: 4 additions & 4 deletions paddles/models/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class Run(Base):
timestamp_format = '%Y-%m-%d_%H:%M:%S'
name_regexes = get_name_regexes(timestamp_regex, suite_names, distros,
machine_types)
backup_name_regex = '(?P<user>.*)-(?P<scheduled>%s)-(?P<suite>.*)-(?P<branch>.*)-.*?-.*?-(?P<machine_type>.*?)' % timestamp_regex # noqa

__tablename__ = 'runs'
id = Column(Integer, primary_key=True)
Expand Down Expand Up @@ -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()

Expand Down
3 changes: 3 additions & 0 deletions paddles/tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
address = 'http://localhost:%s' % server['port']
job_log_href_templ = 'http://qa-proxy.ceph.com/teuthology/{run_name}/{job_id}/teuthology.log' # noqa

backup_name_regex = \
'(?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

default_latest_runs_count = 20

# Pecan Application Configurations
Expand Down

0 comments on commit 9f75fa2

Please sign in to comment.