-
Notifications
You must be signed in to change notification settings - Fork 529
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
Support Mesos fetcher cache (and other options). #637
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,7 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler, | |
disabled = childJob.disabled, | ||
softError = childJob.softError, | ||
uris = childJob.uris, | ||
fetch = childJob.fetch, | ||
highPriority = childJob.highPriority | ||
) | ||
jobScheduler.updateJob(childJob, newChild) | ||
|
@@ -201,13 +202,19 @@ class JobManagementResource @Inject()(val jobScheduler: JobScheduler, | |
@Timed | ||
def list(): Response = { | ||
try { | ||
val jobs = ListBuffer[BaseJob]() | ||
import scala.collection.JavaConversions._ | ||
jobGraph.dag.vertexSet().map({ | ||
job => | ||
jobs += jobGraph.getJobForName(job).get | ||
}) | ||
Response.ok(jobs.toList).build | ||
val jobs = jobGraph.dag.vertexSet() | ||
.map { jobGraph.getJobForName } | ||
.flatten | ||
.map { // copies fetch in uris or uris in fetch (only one can be set) __only__ in REST get, for compatibility | ||
case j : ScheduleBasedJob => | ||
if(j.fetch.isEmpty) j.copy(fetch = j.uris.map { Fetch(_) }) | ||
else j.copy(uris = j.fetch.map { _.uri }) | ||
case j : DependencyBasedJob => | ||
if(j.fetch.isEmpty) j.copy(fetch = j.uris.map { Fetch(_) }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code is duplicated on matching each type. Consider moving it to a method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This cannot be moved to a method, due to the fact that there is a case class duplicate between Best course of action would be to refactor to remove duplicates in the model (out of scope of this PR). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to the lack of standard copy command this is okay. |
||
else j.copy(uris = j.fetch.map { _.uri }) | ||
} | ||
Response.ok(jobs).build | ||
} catch { | ||
case ex: Exception => | ||
log.log(Level.WARNING, "Exception while serving request", ex) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.apache.mesos.chronos.scheduler.jobs | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
/** | ||
* Created by Sylvain Veyrié on 17/02/2016. | ||
*/ | ||
case class Fetch( | ||
@JsonProperty uri: String, | ||
@JsonProperty executable: Boolean = false, | ||
@JsonProperty cache: Boolean = false, | ||
@JsonProperty extract: Boolean = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's Scala string interpolation. I don't think Chronos can be built < Scala 2.10.