@Test public void testNotRunningIfStackFailedOrBeingDeleted() throws JobExecutionException { setStackStatus(DetailedStackStatus.DELETE_COMPLETED); underTest.executeInternal(jobExecutionContext); verify(clusterApiConnectors, times(0)).getConnector(stack); }
@Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { if (flowLogService.isOtherFlowRunning(getStackId())) { LOGGER.debug("StackStatusCheckerJob cannot run, because flow is running for stack: {}", getStackId()); return; } try { Stack stack = stackService.get(getStackId()); buildMdcContext(stack); if (unshedulableStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync will be unscheduled, stack state is {}", stack.getStatus()); jobService.unschedule(getLocalId()); } else if (null == stack.getStatus() || ignoredStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync is skipped, stack state is {}", stack.getStatus()); } else if (syncableStates().contains(stack.getStatus())) { ThreadBasedUserCrnProvider.doAs(DATAHUB_INTERNAL_ACTOR_CRN, () -> doSync(stack)); } else { LOGGER.warn("Unhandled stack status, {}", stack.getStatus()); } } catch (Exception e) { LOGGER.info("Exception during cluster state check.", e); } finally { MDCBuilder.cleanupMdc(); } }
StackStatusCheckerJob extends StatusCheckerJob { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { if (flowLogService.isOtherFlowRunning(getStackId())) { LOGGER.debug("StackStatusCheckerJob cannot run, because flow is running for stack: {}", getStackId()); return; } try { Stack stack = stackService.get(getStackId()); buildMdcContext(stack); if (unshedulableStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync will be unscheduled, stack state is {}", stack.getStatus()); jobService.unschedule(getLocalId()); } else if (null == stack.getStatus() || ignoredStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync is skipped, stack state is {}", stack.getStatus()); } else if (syncableStates().contains(stack.getStatus())) { ThreadBasedUserCrnProvider.doAs(DATAHUB_INTERNAL_ACTOR_CRN, () -> doSync(stack)); } else { LOGGER.warn("Unhandled stack status, {}", stack.getStatus()); } } catch (Exception e) { LOGGER.info("Exception during cluster state check.", e); } finally { MDCBuilder.cleanupMdc(); } } }
StackStatusCheckerJob extends StatusCheckerJob { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { if (flowLogService.isOtherFlowRunning(getStackId())) { LOGGER.debug("StackStatusCheckerJob cannot run, because flow is running for stack: {}", getStackId()); return; } try { Stack stack = stackService.get(getStackId()); buildMdcContext(stack); if (unshedulableStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync will be unscheduled, stack state is {}", stack.getStatus()); jobService.unschedule(getLocalId()); } else if (null == stack.getStatus() || ignoredStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync is skipped, stack state is {}", stack.getStatus()); } else if (syncableStates().contains(stack.getStatus())) { ThreadBasedUserCrnProvider.doAs(DATAHUB_INTERNAL_ACTOR_CRN, () -> doSync(stack)); } else { LOGGER.warn("Unhandled stack status, {}", stack.getStatus()); } } catch (Exception e) { LOGGER.info("Exception during cluster state check.", e); } finally { MDCBuilder.cleanupMdc(); } }  }
StackStatusCheckerJob extends StatusCheckerJob { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { if (flowLogService.isOtherFlowRunning(getStackId())) { LOGGER.debug("StackStatusCheckerJob cannot run, because flow is running for stack: {}", getStackId()); return; } try { Stack stack = stackService.get(getStackId()); buildMdcContext(stack); if (unshedulableStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync will be unscheduled, stack state is {}", stack.getStatus()); jobService.unschedule(getLocalId()); } else if (null == stack.getStatus() || ignoredStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync is skipped, stack state is {}", stack.getStatus()); } else if (syncableStates().contains(stack.getStatus())) { ThreadBasedUserCrnProvider.doAs(DATAHUB_INTERNAL_ACTOR_CRN, () -> doSync(stack)); } else { LOGGER.warn("Unhandled stack status, {}", stack.getStatus()); } } catch (Exception e) { LOGGER.info("Exception during cluster state check.", e); } finally { MDCBuilder.cleanupMdc(); } }   }
StackStatusCheckerJob extends StatusCheckerJob { @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { if (flowLogService.isOtherFlowRunning(getStackId())) { LOGGER.debug("StackStatusCheckerJob cannot run, because flow is running for stack: {}", getStackId()); return; } try { Stack stack = stackService.get(getStackId()); buildMdcContext(stack); if (unshedulableStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync will be unscheduled, stack state is {}", stack.getStatus()); jobService.unschedule(getLocalId()); } else if (null == stack.getStatus() || ignoredStates().contains(stack.getStatus())) { LOGGER.debug("Stack sync is skipped, stack state is {}", stack.getStatus()); } else if (syncableStates().contains(stack.getStatus())) { ThreadBasedUserCrnProvider.doAs(DATAHUB_INTERNAL_ACTOR_CRN, () -> doSync(stack)); } else { LOGGER.warn("Unhandled stack status, {}", stack.getStatus()); } } catch (Exception e) { LOGGER.info("Exception during cluster state check.", e); } finally { MDCBuilder.cleanupMdc(); } }    }