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

[WIP][SPARK-7018][Build]: Refactor dev/run-tests-jenkins into Python #7401

Closed
wants to merge 34 commits into from

Conversation

brennonyork
Copy link

First draft, and WIP, of the refactoring of the run-tests-jenkins script into Python. Currently a few things are left out that, could and I think should, be smaller JIRA's after this.

  1. There are still a few areas where we use environment variables where we don't need to (like CURRENT_BLOCK). I might get around to fixing this one in lieu of everything else, but wanted to point that out.
  2. The PR tests are still written in bash. I opted to not change those and just rewrite the runner into Python. This is a great follow-on JIRA IMO.
  3. All of the linting scripts are still in bash as well and would likely do to just add those in as follow-on JIRA's as well.

Still a WIP now, but would love to get initial rounds of feedback as we iterate on this / test with Jenkins.

@JoshRosen
Copy link
Contributor

Sweet, thanks for submitting this! I'm going to take a quick pass through it now and will loop back later for more feedback.

@@ -19,3 +19,14 @@

SPARK_HOME = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))
USER_HOME = os.environ.get("HOME")
ERROR_CODES = { "BLOCK_GENERAL" : 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

Style nit: the problem with putting the first element of the dict on the same line as the opening { is that the indentation of all of the other elements is dependent on the variable name. If we were to rename ERROR_CODES to something else then all of the indentation would have to change. Instead, I'd move BLOCK_GENERAL to the next line and just indent the elements four spaces.

print(*args, file=sys.stderr)


def post_message(mssg, comments_url):
Copy link
Contributor

Choose a reason for hiding this comment

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

This name is ambiguous; I'd name this something like "post_comment_to_github".

mssg is also a bit of an odd variable name; can we just do msg instead?

Also, what's commments_url? Could you pass in the pull request number and use this to construct the URL instead?

@JoshRosen
Copy link
Contributor

Can you add run-tests-jenkins.py to the list of files that are checked by the Python linter? See dev/lint-python for the list of files that we check. This will ensure that pep8 is run on your code.

# must be less than the timeout configured on Jenkins (currently 180m)
tests_timeout = "175m"

# Array to capture all tests to run on the pull request. These tests are held under the
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment seems misplaced, since this array holds test names, not test results.

@JoshRosen
Copy link
Contributor

I left a pass of comments. I think it would be good to try to move more of the code into Python and to only shell out to external scripts when running PR checks, unit tests, or when performing Git commands. Things like globbing files or sending HTTP requests should be done using Python standard libraries.

I think there are also a number of small bugs that will prevent this from running correctly as-is. I found a number of these by running the prospector linter on this file.

@shaneknapp
Copy link
Contributor

I'm ooo today and can check tomorrow
On Jul 27, 2015 10:57 AM, "Brennon York" notifications@github.com wrote:

@shaneknapp https://github.com/shaneknapp do you know why this PRB
https://amplab.cs.berkeley.edu/jenkins/job/SlowSparkPullRequestBuilder/120/console
is failing? Is there something new going on with Jenkins?


Reply to this email directly or view it on GitHub
#7401 (comment).

@brennonyork
Copy link
Author

jenkins retest this please

@SparkQA
Copy link

SparkQA commented Jul 28, 2015

Test build #137 has started for PR 7401 at commit 0ad51b4.

@SparkQA
Copy link

SparkQA commented Jul 28, 2015

Test build #38716 has started for PR 7401 at commit 0ad51b4.

@JoshRosen
Copy link
Contributor

Just a head's up: given that we're in the middle of the 1.5.0 deadline crunch I don't think that we can afford to risk build breaks due to infra changes right now. As a result, I think that we might want to hold off on merging this for a week. Just wanted to let you know so that you don't burn a ton of cycles working on this only to have us delay further. Note, though, that it's unlikely that we'll merge other changes to the build infra, so hopefully the risk of conflicts will be somewhat minimal.

print_err(" > data: %s" % posted_message)


def send_archived_logs():
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI we no longer need this feature and are going to remove it. Just commenting here so that it's not accidentally re-added as part of this PR.

@davies
Copy link
Contributor

davies commented Oct 6, 2015

@brennonyork Could you fix the conflict, hopefully we can merge it this week.

@JoshRosen
Copy link
Contributor

It looks like the main source of conflict is #7883, so we'll have to port those changes to this script.

@brennonyork
Copy link
Author

Hey guys, sorry I've been away from this recently, been busy with some other things. I'll get the merge conflicts fixed and fix a few other things done here shortly.

@brennonyork
Copy link
Author

jenkins, retest this please

@SparkQA
Copy link

SparkQA commented Oct 16, 2015

Test build #43861 has finished for PR 7401 at commit 206930e.

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

@brennonyork
Copy link
Author

jenkins, retest this please

@SparkQA
Copy link

SparkQA commented Oct 17, 2015

Test build #43887 has finished for PR 7401 at commit 206930e.

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


# format: http://linux.die.net/man/1/timeout
# must be less than the timeout configured on Jenkins (currently 180m)
tests_timeout = "175m"
Copy link
Contributor

Choose a reason for hiding this comment

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

This number has been bumped up recently:

# must be less than the timeout configured on Jenkins (currently 300m)
TESTS_TIMEOUT="250m"

@JoshRosen
Copy link
Contributor

Hey @brennonyork, thanks for updating. I think this is really close to being merged. The final thing that I'm going to check is that the changes from #7878 are here, too (sorry for missing that one earlier).

# The merge-base of this and master in the case of a clean merge is the most recent commit
# against master.
ghprb_pull_id = os.environ["ghprbPullId"]
ghprb_actual_commit = os.environ["ghprbActualCommit"]
Copy link
Contributor

Choose a reason for hiding this comment

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

To preserve the changes from #7878, I think that we need to store the PR title here...

https://github.com/apache/spark/pull/7878/files#diff-c33fd29dc79bfbfd375ef84df36e82df

@JoshRosen
Copy link
Contributor

I'd like to play around with this a bit myself, so I'm going to open a new PR containing your code, then perform the final edits that I suggested above. This looks good to me overall, so I'm going to see if I can just perform the edit steps required to get it merged today (I'm aiming to get this in on a weekend day when Jenkins is a little less busy, so that any build-breaks or problems which might come up have less impact).

@brennonyork
Copy link
Author

@JoshRosen not a problem and completely understand on getting this merged this weekend. Let me know if you need any help from here.

@JoshRosen
Copy link
Contributor

Cool, thanks. I've opened #9161 so that I can test out a few things (injecting style failures in R, trying the Maven pull request builder feature, etc.). Thanks for being so patient with this; this refactoring is going to unlock a lot of other nice tooling improvements.

@asfgit asfgit closed this in d3180c2 Oct 19, 2015
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.

5 participants