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

Conversation

HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Jul 26, 2018

What changes were proposed in this pull request?

If you want to get out of the loop to assign JIRA's user by command+c (KeyboardInterrupt), I am unable to get out. I faced this problem when the user doesn't have a contributor role and I just wanted to cancel and manually take an action to the JIRA.

Before:

JIRA is unassigned, choose assignee
[0] todd.chen (Reporter)
Enter number of user, or userid,  to assign to (blank to leave unassigned):Traceback (most recent call last):
  File "./dev/merge_spark_pr.py", line 322, in choose_jira_assignee
    "Enter number of user, or userid,  to assign to (blank to leave unassigned):")
KeyboardInterrupt
Error assigning JIRA, try again (or leave blank and fix manually)
JIRA is unassigned, choose assignee
[0] todd.chen (Reporter)
Enter number of user, or userid,  to assign to (blank to leave unassigned):Traceback (most recent call last):
  File "./dev/merge_spark_pr.py", line 322, in choose_jira_assignee
    "Enter number of user, or userid,  to assign to (blank to leave unassigned):")
KeyboardInterrupt

After:

JIRA is unassigned, choose assignee
[0] Dongjoon Hyun (Reporter)
Enter number of user, or userid to assign to (blank to leave unassigned):Traceback (most recent call last):
  File "./dev/merge_spark_pr.py", line 322, in choose_jira_assignee
    "Enter number of user, or userid to assign to (blank to leave unassigned):")
KeyboardInterrupt
Restoring head pointer to master
git checkout master
Already on 'master'
git branch

How was this patch tested?

I tested this manually (I use my own merging script with few fixes).

@HyukjinKwon
Copy link
Member Author

cc @squito

@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93593 has finished for PR 21880 at commit ef2303d.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93591 has finished for PR 21880 at commit e87c268.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member Author

retest this please

Copy link
Contributor

@squito squito left a comment

Choose a reason for hiding this comment

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

oops, thanks for catching this. A small suggestion on handling the keyboard interrupt, but fine for me either way

lgtm

@@ -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.

@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93598 has finished for PR 21880 at commit ef2303d.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 26, 2018

Test build #93600 has finished for PR 21880 at commit 8b6ea00.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member Author

Manually tested.

Merged to master.

@HyukjinKwon
Copy link
Member Author

Thanks @squito.

@asfgit asfgit closed this in f9c9d80 Jul 27, 2018
@HyukjinKwon HyukjinKwon deleted the key-error branch October 16, 2018 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants