Created
October 19, 2018 17:41
-
-
Save robzienert/620a8c35c8d74b59add9fcaeb018ab1c to your computer and use it in GitHub Desktop.
Revisions
-
robzienert created this gist
Oct 19, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ @Component class AbortStageHandler( override val queue: Queue, override val eventRepository: ExecutionEventRepository, @Qualifier("queueEventPublisher") private val publisher: ApplicationEventPublisher, private val clock: Clock ) : OrcaMessageHandler<AbortStage> { override fun handle(message: AbortStage) { message.withStage { stage -> if (stage.status in setOf(RUNNING, NOT_STARTED)) { stage.status = TERMINAL stage.endTime = clock.millis() eventReposotory.record(StageAborted(stage, message)) queue.push(CancelStage(message)) if (stage.parentStageId == null) { queue.push(CompleteExecution(message)) } else { queue.push(CompleteStage(stage.parent())) } publisher.publishEvent(StageComplete(this, stage)) } } } override val messageType = AbortStage::class.java } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ @Component class AbortStageHandler( override val queue: Queue, override val repository: ExecutionRepository, @Qualifier("queueEventPublisher") private val publisher: ApplicationEventPublisher, private val clock: Clock ) : OrcaMessageHandler<AbortStage> { override fun handle(message: AbortStage) { message.withStage { stage -> if (stage.status in setOf(RUNNING, NOT_STARTED)) { stage.status = TERMINAL stage.endTime = clock.millis() repository.storeStage(stage) queue.push(CancelStage(message)) if (stage.parentStageId == null) { queue.push(CompleteExecution(message)) } else { queue.push(CompleteStage(stage.parent())) } publisher.publishEvent(StageComplete(this, stage)) } } } override val messageType = AbortStage::class.java }