Skip to content
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

Merged
merged 1 commit into from
Feb 19, 2020

Conversation

brisssou
Copy link
Contributor

No description provided.

@@ -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})")}")
Copy link
Contributor

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=>...)

@@ -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)
Copy link
Contributor

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are very right 🤦‍♂

@brisssou brisssou force-pushed the pausing_specific branch 2 times, most recently from 91686ef to 4b9f754 Compare February 19, 2020 13:49
@@ -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(" ")}")
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed

@vguerci vguerci merged commit a168805 into criteo:master Feb 19, 2020
scala-steward pushed a commit to scala-steward/cuttle that referenced this pull request Feb 19, 2020
yetanotherion pushed a commit to yetanotherion/cuttle that referenced this pull request Apr 6, 2020
yetanotherion added a commit that referenced this pull request Apr 6, 2020
Co-authored-by: Jon Alberdi <j.alberdi@criteo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants