new-integration-tests/src/test/java/oracle/weblogic/kubernetes/assertions/impl/Kubernetes.java
public static boolean isJobComplete(String namespace, String labelSelectors, String jobName)
      throws ApiException {
    boolean completionStatus = false;
    LoggingFacade logger = getLogger();

    V1Job job = getJob(namespace, labelSelectors, jobName);
    if (job != null && job.getStatus() != null) {
      logger.info("\n" + dump(job.getStatus()));
      if (job.getStatus().getConditions() != null) {
        V1JobCondition jobCondition = job.getStatus().getConditions().stream().filter(
            v1JobCondition
              -> "Complete".equalsIgnoreCase(v1JobCondition.getType())
                  || "Failed".equalsIgnoreCase(v1JobCondition.getType()))
            .findAny()
            .orElse(null);
        if (jobCondition != null) {
          completionStatus = jobCondition.getStatus().equalsIgnoreCase("true");
          if (jobCondition.getType().equalsIgnoreCase("failed")) {
            logger.severe("Job {0} failed", jobName);
          } else if (jobCondition.getType().equalsIgnoreCase("complete")) {
            logger.info("Job {0} completed successfully ", jobName);
          }
        }
      }
    } else {
      logger.warning("Job doesn't exist");
    }
    return completionStatus;
  }
/**
   * Check if a pod completed running.
   *
   * @param namespace name of the namespace in which the job exists
   * @param labelSelectors labels to narrow the job list
   * @param jobName name of the job to check for its completion status
   * @return true if completed false otherwise
   * @throws ApiException when querying pod condition fails
   */
Check if a pod completed running.
Check if a pod completed running .
public static boolean isJobComplete(String namespace, String labelSelectors, String jobName)
      throws ApiException {
    boolean completionStatus = false;
    LoggingFacade logger = getLogger();
    V1Job job = getJob(namespace, labelSelectors, jobName);
    if (job != null && job.getStatus() != null) {
      logger.info("\n" + dump(job.getStatus()));
      if (job.getStatus().getConditions() != null) {
        V1JobCondition jobCondition = job.getStatus().getConditions().stream().filter(
            v1JobCondition
              -> "Complete".equalsIgnoreCase(v1JobCondition.getType())
                  || "Failed".equalsIgnoreCase(v1JobCondition.getType()))
            .findAny()
            .orElse(null);
        if (jobCondition != null) {
          completionStatus = jobCondition.getStatus().equalsIgnoreCase("true");
          if (jobCondition.getType().equalsIgnoreCase("failed")) {
            logger.severe("Job {0} failed", jobName);
          } else if (jobCondition.getType().equalsIgnoreCase("complete")) {
            logger.info("Job {0} completed successfully ", jobName);
          }
        }
      }
    } else {
      logger.warning("Job doesn't exist");
    }
    return completionStatus;
  }
public static boolean isJobComplete ( String namespace , String labelSelectors , String jobName ) throws ApiException { boolean completionStatus = false ; LoggingFacade logger = getLogger ( ) ; V1Job job = getJob ( namespace , labelSelectors , jobName ) ; if ( job != null && job . getStatus ( ) != null ) { logger . info ( "\n" + dump ( job . getStatus ( ) ) ) ; if ( job . getStatus ( ) . getConditions ( ) != null ) { V1JobCondition jobCondition = job . getStatus ( ) . getConditions ( ) . stream ( ) . filter ( v1JobCondition -> "Complete" . equalsIgnoreCase ( v1JobCondition . getType ( ) ) || "Failed" . equalsIgnoreCase ( v1JobCondition . getType ( ) ) ) . findAny ( ) . orElse ( null ) ; if ( jobCondition != null ) { completionStatus = jobCondition . getStatus ( ) . equalsIgnoreCase ( "true" ) ; if ( jobCondition . getType ( ) . equalsIgnoreCase ( "failed" ) ) { logger . severe ( "Job {0} failed" , jobName ) ; } else if ( jobCondition . getType ( ) . equalsIgnoreCase ( "complete" ) ) { logger . info ( "Job {0} completed successfully " , jobName ) ; } } } } else { logger . warning ( "Job doesn't exist" ) ; } return completionStatus ; }
Check if a pod completed running.
Check if a pod completed running .