-
Notifications
You must be signed in to change notification settings - Fork 39
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
New feature: can pause specific jobs upon startup #524
Conversation
@@ -86,6 +90,10 @@ class CuttleProject private[cuttle] (val name: String, | |||
if (paused) { | |||
logger.info("Pausing workflow") | |||
scheduler.pauseJobs(jobs.all, executor, xa)(Auth.User("Startup")) | |||
} else { | |||
val toPause = jobs.all.filter(j => j == jobsToBePausedOnStartup) | |||
logger.info(s"Pausing ${toPause.map(j=> s"${j.name} (${j.id})")}") |
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.
OPT: keep the same ident (filter(j=>...) vs (map(j=>...)
4758a60
to
238a644
Compare
@@ -86,6 +90,10 @@ class CuttleProject private[cuttle] (val name: String, | |||
if (paused) { | |||
logger.info("Pausing workflow") | |||
scheduler.pauseJobs(jobs.all, executor, xa)(Auth.User("Startup")) | |||
} else { | |||
val toPause = jobs.all.filter(_ == jobsToBePausedOnStartup) |
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.
Unless mistaking you are comparing a Set[Job]
with Job
(_ == jobsToBePausedOnStartup
), maybe jobs.intersect(jobsToBePausedOnStartup)
or something like?
Thanks for your contribution :)
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.
you are very right 🤦♂
91686ef
to
4b9f754
Compare
@@ -86,6 +90,10 @@ class CuttleProject private[cuttle] (val name: String, | |||
if (paused) { | |||
logger.info("Pausing workflow") | |||
scheduler.pauseJobs(jobs.all, executor, xa)(Auth.User("Startup")) | |||
} else { | |||
val toPause = jobs.all.intersect(jobsToBePausedOnStartup) | |||
logger.info(s"Pausing ${toPause.map(j => s"${j.name} (${j.id})").mkString(" ")}") |
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.
Also maybe an if (toPause.nonEmpty)
to prevent such logging with no jobs
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.
indeed
4b9f754
to
d06ce59
Compare
timeseries/src/main/scala/com/criteo/cuttle/timeseries/CuttleProject.scala
Outdated
Show resolved
Hide resolved
d06ce59
to
b6ebc46
Compare
No description provided.