in src/main/scala/com/twitter/iago/launcher/AuroraMode.scala [129:152]
def auroraKill(feederFlags: Seq[Flag[_]], serverFlags: Seq[Flag[_]]): Unit = {
def statusCmd(jobPath: String) = List("aurora", "job", "status", s"$jobPath")
def killCmd(jobPath: String) = List("aurora", "job", "killall", "--no-batching", s"$jobPath")
def killJobs(jobPath: String, jobShortName: String) = {
val jobStatusCmd = statusCmd(feederJobPath)
val rc = runCmd(jobStatusCmd, suppressOutput = true)
// check if jobs are running before trying to kill them
rc match {
case 0 =>
val jobKillCmd = killCmd(jobPath)
runCmdWithConfirmationOrAbort(
jobKillCmd,
prompt = s"Really kill all jobs in ($jobPath) (y/n)?",
errorMsg = s"Failed to kill $jobShortName jobs"
)
case 6 => log.info(s"No jobs present in $jobPath to kill.")
case _ => exitOnError(s"Couldn't obtain the status of $jobPath")
}
}
killJobs(feederJobPath, "feeder")
killJobs(serverJobPath, "server")
}