Skip to content
Permalink
Browse files

Public executor (#387)

* 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 committed Apr 1, 2019
1 parent 407d1cc commit 0efeee1a846c1f2fcc1b4fa68d172f3fd7f291db
Showing with 12 additions and 10 deletions.
  1. +3 −1 build.sbt
  2. +9 −9 core/src/main/scala/com/criteo/cuttle/Executor.scala
@@ -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"
@@ -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)
@@ -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,
@@ -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,

0 comments on commit 0efeee1

Please sign in to comment.
You can’t perform that action at this time.