@@ -283,33 +283,41 @@ def resolve_jira_issues(title, merge_branches, comment):
283
283
284
284
def standardize_jira_ref (text ):
285
285
"""
286
- Standardize the [MODULE] SPARK-XXXXX prefix
287
- Converts "[SPARK-XXX][mllib] Issue", "[MLLib] SPARK-XXX. Issue" or "SPARK XXX [MLLIB]: Issue" to "[MLLIB] SPARK-XXX: Issue"
286
+ Standardize the [SPARK-XXXXX] [MODULE] prefix
287
+ Converts "[SPARK-XXX][mllib] Issue", "[MLLib] SPARK-XXX. Issue" or "SPARK XXX [MLLIB]: Issue" to "[SPARK-XXX] [MLLIB] Issue"
288
288
289
289
>>> standardize_jira_ref("[SPARK-5821] [SQL] ParquetRelation2 CTAS should check if delete is successful")
290
- '[SQL] SPARK-5821: ParquetRelation2 CTAS should check if delete is successful'
290
+ '[SPARK-5821] [SQL] ParquetRelation2 CTAS should check if delete is successful'
291
291
>>> standardize_jira_ref("[SPARK-4123][Project Infra][WIP]: Show new dependencies added in pull requests")
292
- '[PROJECT INFRA] [WIP] SPARK-4123: Show new dependencies added in pull requests'
292
+ '[SPARK-4123] [ PROJECT INFRA] [WIP] Show new dependencies added in pull requests'
293
293
>>> standardize_jira_ref("[MLlib] Spark 5954: Top by key")
294
- '[MLLIB] SPARK-5954: Top by key'
294
+ '[SPARK-5954] [MLLIB] Top by key'
295
+ >>> standardize_jira_ref("[SPARK-979] a LRU scheduler for load balancing in TaskSchedulerImpl")
296
+ '[SPARK-979] a LRU scheduler for load balancing in TaskSchedulerImpl'
297
+ >>> standardize_jira_ref("SPARK-1094 Support MiMa for reporting binary compatibility accross versions.")
298
+ '[SPARK-1094] Support MiMa for reporting binary compatibility accross versions.'
299
+ >>> standardize_jira_ref("[WIP] [SPARK-1146] Vagrant support for Spark")
300
+ '[SPARK-1146] [WIP] Vagrant support for Spark'
301
+ >>> standardize_jira_ref("SPARK-1032. If Yarn app fails before registering, app master stays aroun...")
302
+ '[SPARK-1032] If Yarn app fails before registering, app master stays aroun...'
295
303
"""
296
- #If the string is compliant, no need to process any further
297
- if (re .search (r'\[[A-Z0-9_]+\] SPARK-[0-9]{3,5}: \S+' , text )):
304
+ # If the string is compliant, no need to process any further
305
+ if (re .search (r'^\[ SPARK-[0-9]{3,6}\] (\[[A-Z0-9_\s,]+\] )+ \S+' , text )):
298
306
return text
299
307
300
308
# Extract JIRA ref(s):
301
309
jira_refs = deque ()
302
- pattern = re .compile (r'(SPARK[-\s]*[0-9]{3,5 })' , re .IGNORECASE )
310
+ pattern = re .compile (r'(SPARK[-\s]*[0-9]{3,6 })' , re .IGNORECASE )
303
311
while (pattern .search (text ) is not None ):
304
312
ref = pattern .search (text ).groups ()[0 ]
305
313
# Replace any whitespace with a dash & convert to uppercase
306
- jira_refs .append (re .sub (r'\s+' , '-' , ref .upper ()))
314
+ jira_refs .append ('[' + re .sub (r'\s+' , '-' , ref .upper ()) + ']' )
307
315
text = text .replace (ref , '' )
308
316
309
317
# Extract spark component(s):
310
318
components = deque ()
311
- # Look for alphanumeric chars, spaces, and/or commas
312
- pattern = re .compile (r'(\[[\w\s,]+\])' , re .IGNORECASE )
319
+ # Look for alphanumeric chars, spaces, dashes, periods, and/or commas
320
+ pattern = re .compile (r'(\[[\w\s,-\. ]+\])' , re .IGNORECASE )
313
321
while (pattern .search (text ) is not None ):
314
322
component = pattern .search (text ).groups ()[0 ]
315
323
# Convert to uppercase
@@ -321,22 +329,22 @@ def standardize_jira_ref(text):
321
329
if (pattern .search (text ) is not None ):
322
330
text = pattern .search (text ).groups ()[0 ]
323
331
324
- # Assemble full text (module(s), JIRA ref(s), remaining text)
325
- if (len (components ) < 1 ):
326
- components = ""
327
- component_text = ' ' .join (components ).strip ()
332
+ # Assemble full text (JIRA ref(s), module(s), remaining text)
328
333
if (len (jira_refs ) < 1 ):
329
334
jira_ref_text = ""
330
335
jira_ref_text = ' ' .join (jira_refs ).strip ()
336
+ if (len (components ) < 1 ):
337
+ components = ""
338
+ component_text = ' ' .join (components ).strip ()
331
339
332
340
if (len (jira_ref_text ) < 1 and len (component_text ) < 1 ):
333
341
clean_text = text .strip ()
334
342
elif (len (jira_ref_text ) < 1 ):
335
343
clean_text = component_text + ' ' + text .strip ()
336
344
elif (len (component_text ) < 1 ):
337
- clean_text = jira_ref_text + ': ' + text .strip ()
345
+ clean_text = jira_ref_text + ' ' + text .strip ()
338
346
else :
339
- clean_text = component_text + ' ' + jira_ref_text + ': ' + text .strip ()
347
+ clean_text = jira_ref_text + ' ' + component_text + ' ' + text .strip ()
340
348
341
349
return clean_text
342
350
0 commit comments