Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: make backup_name_regex configurable #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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