Skip to content

Conversation

@jinxing64
Copy link

What changes were proposed in this pull request?

TaskSetManager is now using System.getCurrentTimeMillis when mark task as finished in handleSuccessfulTask and handleFailedTask. Thus developer cannot set the tasks finishing time in unit test. When handleSuccessfulTask, task's duration = System.getCurrentTimeMillis - launchTime(which can be set by clock), the result is not correct.

How was this patch tested?

Existing tests.

@jinxing64
Copy link
Author

I found this when do #17112, which is for measuring the approach I proposed in #16867.

@SparkQA
Copy link

SparkQA commented Mar 2, 2017

Test build #73749 has finished for PR 17133 at commit 56cd922.

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

@srowen
Copy link
Member

srowen commented Mar 2, 2017

CC @devaraj-kavali and possibly @zsxwing ?

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Other than the cryptic comments, looks ok to me.

val info = taskInfos(tid)
val index = info.index
info.markFinished(TaskState.FINISHED)
// Mark task as finished. Note that finishing time here should be bigger than 0.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what this comment is trying to say, especially since there's no check anywhere for "finishing time > 0" in the code here.

Also, grammar nit: it should be "larger than 0".

Copy link
Author

@jinxing64 jinxing64 Mar 3, 2017

Choose a reason for hiding this comment

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

Thanks for review :) what I want to say is that finishTime of TaskInfo should be set larger than 0(when do unit test), otherwise TaskInfo.finishTime will return false. I removed the comments and added an assert inside TaskInfo.

@SparkQA
Copy link

SparkQA commented Mar 3, 2017

Test build #73795 has finished for PR 17133 at commit 716b9a1.

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

@SparkQA
Copy link

SparkQA commented Mar 3, 2017

Test build #73807 has finished for PR 17133 at commit 37f26e3.

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


private[spark] def markFinished(state: TaskState, time: Long = System.currentTimeMillis) {
// finishTime should be set larger than 0, otherwise "finished" below will return false.
assert(time != 0)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: shouldn't you then assert that time > 0 given the comment? do you really mean to assert this, or is it an argument check?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I want to assert that time>0

@SparkQA
Copy link

SparkQA commented Mar 3, 2017

Test build #73839 has finished for PR 17133 at commit 38f9df2.

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

@SparkQA
Copy link

SparkQA commented Mar 3, 2017

Test build #73849 has finished for PR 17133 at commit 5617118.

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

gettingResultTime = time
}

private[spark] def markFinished(state: TaskState, time: Long = System.currentTimeMillis) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about removing the default value for the argument? I only see one other call site for this method that would need to be changed.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, good idea.

@SparkQA
Copy link

SparkQA commented Mar 4, 2017

Test build #73881 has finished for PR 17133 at commit 84e0615.

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

@jinxing64
Copy link
Author

@vanzin @srowen
I refined according to the comments, please take a look when you have time :)

@vanzin
Copy link
Contributor

vanzin commented Mar 9, 2017

Merging to master.

@asfgit asfgit closed this in 3232e54 Mar 9, 2017
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.

4 participants