Skip to content

Commit

Permalink
Public executor (#387)
Browse files Browse the repository at this point in the history
* Change executor's methods visibility

We need to be able to access the executor's running executions from
outside of cuttle's scope
  • Loading branch information
bubblesly authored Apr 1, 2019
1 parent 407d1cc commit 0efeee1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
val devMode = settingKey[Boolean]("Some build optimization are applied in devMode.")
val writeClasspath = taskKey[File]("Write the project classpath to a file.")

val VERSION = "0.9.3"

val VERSION = "0.9.4"


lazy val catsCore = "1.5.0"
lazy val circe = "0.10.1"
Expand Down
18 changes: 9 additions & 9 deletions core/src/main/scala/com/criteo/cuttle/Executor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ class Executor[S <: Scheduling] (
}
}

private[cuttle] def allRunning: Seq[ExecutionLog] =
def allRunning: Seq[ExecutionLog] =
flagWaitingExecutions(runningState.single.keys.toSeq).map {
case (execution, status) =>
execution.toExecutionLog(status)
Expand All @@ -489,18 +489,18 @@ class Executor[S <: Scheduling] (
private[cuttle] def jobStatsForLastThirtyDays(jobId: String): IO[Seq[ExecutionStat]] =
queries.jobStatsForLastThirtyDays(jobId).transact(xa)

private[cuttle] def runningExecutions: Seq[(Execution[S], ExecutionStatus)] =
def runningExecutions: Seq[(Execution[S], ExecutionStatus)] =
flagWaitingExecutions(runningState.single.keys.toSeq)

private[cuttle] def runningExecutionsSizeTotal(filteredJobs: Set[String]): Int =
def runningExecutionsSizeTotal(filteredJobs: Set[String]): Int =
runningState.single.keys.count(e => filteredJobs.contains(e.job.id))

private[cuttle] def runningExecutionsSizes(filteredJobs: Set[String]): (Int, Int) = {
def runningExecutionsSizes(filteredJobs: Set[String]): (Int, Int) = {
val statuses =
flagWaitingExecutions(runningState.single.keys.toSeq.filter(e => filteredJobs.contains(e.job.id))).map(_._2)
(statuses.count(_ == ExecutionRunning), statuses.count(_ == ExecutionWaiting))
}
private[cuttle] def runningExecutions(filteredJobs: Set[String],
def runningExecutions(filteredJobs: Set[String],
sort: String,
asc: Boolean,
offset: Int,
Expand All @@ -524,19 +524,19 @@ class Executor[S <: Scheduling] (
execution.toExecutionLog(status)
})

private[cuttle] def allFailingExecutions: Seq[Execution[S]] =
def allFailingExecutions: Seq[Execution[S]] =
throttledState.single.keys.toSeq

private[cuttle] def allFailingJobsWithContext: Set[(Job[S], S#Context)] =
def allFailingJobsWithContext: Set[(Job[S], S#Context)] =
allFailingExecutions.map(e => (e.job, e.context)).toSet

// Count as failing all jobs that have failed and are not running (throttledState)
// and all jobs that have recently failed and are now running.
private[cuttle] def failingExecutionsSize(filteredJobs: Set[String]): Int =
def failingExecutionsSize(filteredJobs: Set[String]): Int =
throttledState.single.keys.filter(e => filteredJobs.contains(e.job.id)).size +
retryingExecutionsSize(filteredJobs)

private[cuttle] def failingExecutions(filteredJobs: Set[String],
def failingExecutions(filteredJobs: Set[String],
sort: String,
asc: Boolean,
offset: Int,
Expand Down

0 comments on commit 0efeee1

Please sign in to comment.