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

[SPARK-24929][INFRA] Make merge script don't swallow KeyboardInterrupt #21880

Closed
wants to merge 3 commits into from
Closed
Changes from 2 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
5 changes: 4 additions & 1 deletion dev/merge_spark_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def choose_jira_assignee(issue, asf_jira):
annotations.append("Commentor")
print("[%d] %s (%s)" % (idx, author.displayName, ",".join(annotations)))
raw_assignee = input(
"Enter number of user, or userid, to assign to (blank to leave unassigned):")
"Enter number of user, or userid, to assign to (blank to leave unassigned):")
if raw_assignee == "":
return None
else:
Expand All @@ -331,6 +331,9 @@ def choose_jira_assignee(issue, asf_jira):
assignee = asf_jira.user(raw_assignee)
asf_jira.assign_issue(issue.key, assignee.key)
return assignee
except KeyboardInterrupt:
traceback.print_exc()
sys.exit(-1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to do this, rather than just

except KeyboardInterrupt:
  raise
except:
  ...

? That seems to do the right thing in a small test I tried, letting you break out of the loop:

while True:
  try:
    x = raw_input("enter a number: \n")
    print int(x)
  except KeyboardInterrupt:
    raise
  except:
    print "oops, entered " + x

sys.exit makes it impossible for an wrapping function to do its own handling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope. I don't have a special reason for it - just found that's used in this script and thought it's better to make sure exiting. The root exception handling already catches all the exceptions and looks the exception is being handled for now.
But yup let me change and test it in other PRs or this PR :-). not a big deal.

except:
traceback.print_exc()
print("Error assigning JIRA, try again (or leave blank and fix manually)")
Expand Down