Skip to content

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Jul 11, 2019

What changes were proposed in this pull request?

dev/merge_spark_pr.py script always fail for some users because they have different name and key.

JIRA Client expects name, but we are using key. This PR fixes it.

# This is JIRA client code `/usr/local/lib/python2.7/site-packages/jira/client.py`
def assign_issue(self, issue, assignee):
    """Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.

    :param issue: the issue ID or key to assign
    :param assignee: the user to assign the issue to

    :type issue: int or str
    :type assignee: str

    :rtype: bool
    """
    url = self._options['server'] + \
        '/rest/api/latest/issue/' + str(issue) + '/assignee'
    payload = {'name': assignee}
    r = self._session.put(
        url, data=json.dumps(payload))
    raise_on_error(r)
    return True

How was this patch tested?

Manual with the committer ID/password.

import jira.client
asf_jira = jira.client.JIRA({'server': 'https://issues.apache.org/jira'}, basic_auth=('yourid', 'passwd'))
asf_jira.assign_issue("SPARK-28354", "q79969786")   # This will raise exception.
asf_jira.assign_issue("SPARK-28354", "yumwang")     # This works.

@dongjoon-hyun
Copy link
Member Author

cc @squito , @vanzin , @srowen

@SparkQA
Copy link

SparkQA commented Jul 11, 2019

Test build #107553 has finished for PR 25120 at commit f6c0137.

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

@dongjoon-hyun
Copy link
Member Author

Retest this please.

@srowen
Copy link
Member

srowen commented Jul 11, 2019

Sure, if it works better that's good. I consistently get a failure when assigning JIRAs to Yuming Wang -- have you seen that too? maybe this fixes it.

@dongjoon-hyun
Copy link
Member Author

dongjoon-hyun commented Jul 12, 2019

Yes. Right. That's the exact reason for this fix. I also hit the failures during merging his PRs. :D

@SparkQA
Copy link

SparkQA commented Jul 12, 2019

Test build #107556 has finished for PR 25120 at commit f6c0137.

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

@HyukjinKwon
Copy link
Member

Yea .. get the failure to Yuming Wang too ..

@HyukjinKwon
Copy link
Member

@wangyum, this PR is for you. hahaha

@HyukjinKwon
Copy link
Member

Merged to master.

@wangyum
Copy link
Member

wangyum commented Jul 12, 2019

Thank you @dongjoon-hyun @srowen @HyukjinKwon

@dongjoon-hyun
Copy link
Member Author

Thank you all!

@dongjoon-hyun dongjoon-hyun deleted the SPARK-28354 branch July 12, 2019 13:57
vinodkc pushed a commit to vinodkc/spark that referenced this pull request Jul 18, 2019
## What changes were proposed in this pull request?

`dev/merge_spark_pr.py` script always fail for some users because they have different `name` and `key`.

- https://issues.apache.org/jira/rest/api/2/user?username=yumwang

JIRA Client expects `name`, but we are using `key`. This PR fixes it.
```python
# This is JIRA client code `/usr/local/lib/python2.7/site-packages/jira/client.py`
def assign_issue(self, issue, assignee):
    """Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.

    :param issue: the issue ID or key to assign
    :param assignee: the user to assign the issue to

    :type issue: int or str
    :type assignee: str

    :rtype: bool
    """
    url = self._options['server'] + \
        '/rest/api/latest/issue/' + str(issue) + '/assignee'
    payload = {'name': assignee}
    r = self._session.put(
        url, data=json.dumps(payload))
    raise_on_error(r)
    return True
```

## How was this patch tested?

Manual with the committer ID/password.

```python
import jira.client
asf_jira = jira.client.JIRA({'server': 'https://issues.apache.org/jira'}, basic_auth=('yourid', 'passwd'))
asf_jira.assign_issue("SPARK-28354", "q79969786")   # This will raise exception.
asf_jira.assign_issue("SPARK-28354", "yumwang")     # This works.
```

Closes apache#25120 from dongjoon-hyun/SPARK-28354.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: HyukjinKwon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants