@@ -93,12 +93,11 @@ def get_name_regexes(timestamp_regex, suite_names, distros, machine_types):
9393
9494
9595class 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
0 commit comments