Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Conversation

@lins05
Copy link

@lins05 lins05 commented Apr 29, 2017

Close #225

@lins05
Copy link
Author

lins05 commented Apr 29, 2017

cc @ash211

.pods()
.withName(kubernetesAppId)
.watch(loggingWatch)) { _ =>
loggingWatch.start
Copy link

Choose a reason for hiding this comment

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

nit: methods with side effects that have no parameters usually get the parentheses: .start()

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</dependency>
Copy link

Choose a reason for hiding this comment

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

I'm not fully following here -- why does this change to the logging watcher require adding explicit dependencies on jetty ? Or are these separate changes?

Copy link
Author

Choose a reason for hiding this comment

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

It's required to only build the kubernetes sub module (much faster compare to a full build), e.g. :

build/mvn -Pkubernetes -Phadoop-2.6 -pl resource-managers/kubernetes/core install

Since jars of jetty artifacts are shaded in the top-level pom.xml, we need to reference them explicitly here, like what we already did for guava libs.

Copy link

Choose a reason for hiding this comment

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

So if we didn't have this addition, would we still be able to build the whole module? I don't see any new jetty-related code in this diff, so it seems like the pom change is independent from the exiting on apiserver unavailable change.

cc @mccheah

Copy link
Author

Choose a reason for hiding this comment

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

OK, I've removed this part to make this PR atomic. PTAL.


def start(): Unit = {
if (interval > 0) {
scheduler.scheduleWithFixedDelay(logRunnable, 0, interval, TimeUnit.MILLISECONDS)
Copy link

Choose a reason for hiding this comment

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

I think a more direct fix for this LoggingPodStatusWatcher holding the JVM open issue is to make sure that the scheduleThreadPool is launching daemon threads vs non-daemon threads.

That way we don't need to introduce this additional start method and can leave the scheduler start as a side effect of the constructor (and other scenarios where the scheduler fails to get stopped won't hold the JVM open)

What if scheduler = ThreadUtils.newDaemonSingleThreadExecutor("logging-pod-status-watcher") ?

Copy link
Author

Choose a reason for hiding this comment

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

+1 for using daemon threads, but IMHO it's better to explicitly start the timer so it's a bit easier to reason about the control flow.

@lins05
Copy link
Author

lins05 commented May 16, 2017

@ash211 Updated, PTAL

@ash211
Copy link

ash211 commented May 16, 2017

@lins05 it looks like the latest push doesn't build on Jenkins:

[error] /home/jenkins/workspace/PR-spark-k8s-full-build/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/kubernetes/submit/v1/LoggingPodStatusWatcher.scala:56: value scheduleWithFixedDelay is not a member of java.util.concurrent.ExecutorService
[error]       scheduler.scheduleWithFixedDelay(logRunnable, 0, interval, TimeUnit.MILLISECONDS)
[error]                 ^

http://spark-k8s-jenkins.pepperdata.org:8080/job/PR-spark-k8s-full-build/302/consoleFull#-1164448660c3852bdb-3a63-45ca-a0d4-973026729059

@lins05
Copy link
Author

lins05 commented May 17, 2017

@ash211 Fixed. Was in a hurry yesterday and forgot to run a full compilation.

Copy link

@ash211 ash211 left a comment

Choose a reason for hiding this comment

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

LGTM, let's merge when build passes

@ash211 ash211 merged commit 6882a1b into apache-spark-on-k8s:branch-2.1-kubernetes May 18, 2017
foxish pushed a commit that referenced this pull request Jul 24, 2017
* Exit properly when the k8s cluster is not available.

* add jetty to k8s module dependency so we can use only rebuild the k8s module.

* CR

* Fixed single thread scheduler.

* Fixed scalastyle check.

* CR
puneetloya pushed a commit to puneetloya/spark that referenced this pull request Mar 11, 2019
…-k8s#256)

* Exit properly when the k8s cluster is not available.

* add jetty to k8s module dependency so we can use only rebuild the k8s module.

* CR

* Fixed single thread scheduler.

* Fixed scalastyle check.

* CR
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants