Klasse KubeJob

java.lang.Object
de.dlr.proseo.planner.kubernetes.KubeJob

@Component public class KubeJob extends Object
A KubeJob describes the complete information to run a Kubernetes job.
Autor:
Ernst Melchinger
  • Konstruktordetails

    • KubeJob

      public KubeJob()
      Instantiate a kube job with a list of pod names
    • KubeJob

      public KubeJob(Long jobId, String jobOrderFileName)
      Instantiate a Kubernetes job with ID and Job Order file name
      Parameter:
      jobId - the job ID
      jobOrderFileName - the Job Order file name
  • Methodendetails

    • getJobId

      public long getJobId()
      Returns the job ID.
      Gibt zurück:
      the jobId
    • getJobName

      public String getJobName()
      Returns the job name.
      Gibt zurück:
      the jobName
    • getPodNames

      public ArrayList<String> getPodNames()
      Returns the list of pod names associated with the job. If the pod names are not already populated, a search for pods is performed.
      Gibt zurück:
      the podNames
    • getContainerName

      public String getContainerName()
      Returns the name of the container associated with the job.
      Gibt zurück:
      the containerName
    • getJobOrderFileName

      public String getJobOrderFileName()
      Returns the name of the job order file (JOF).
      Gibt zurück:
      the jobOrderFileName
    • setJobOrderFileName

      public void setJobOrderFileName(String jobOrderFileName)
      Sets the name of the job order file (JOF).
      Parameter:
      jobOrderFileName - the jobOrderFileName to set
    • getJobOrder

      public JobOrder getJobOrder()
      Returns the processing order to which the job is associated.
      Gibt zurück:
      the jobOrder
    • setJobOrder

      public void setJobOrder(JobOrder jobOrder)
      Sets the job order for the job.
      Parameter:
      jobOrder - the jobOrder to set
    • addArg

      public void addArg(String arg)
      Add an argument to the list of command arguments.
      Parameter:
      arg - The command argument to add
    • rebuild

      public KubeJob rebuild(KubeConfig kubeConfig, io.kubernetes.client.openapi.models.V1Job job)
      Rebuilds the kube job entries of a processing facility after a restart of the planner.
      Parameter:
      kubeConfig - The processing facility's kube configuration
      job - The Kubernetes job to rebuild
      Gibt zurück:
      The created kube job or null if it is not a prosEO job
    • createJob

      public KubeJob createJob(KubeConfig kubeConfig, String stdoutLogLevel, String stderrLogLevel) throws Exception
      Creates a Kubernetes job on the processing facility based on the provided parameters. TODO Add retry of database update after job has been sent to Kubernetes
      Parameter:
      kubeConfig - The processing facility's kube configuration
      stdoutLogLevel - The log level for stdout
      stderrLogLevel - The log level for stderr
      Gibt zurück:
      The kube job
      Löst aus:
      Exception - if an error occurs during job creation
    • getKubeConfig

      public KubeConfig getKubeConfig()
      Gets the kube configuration
      Gibt zurück:
      the kubeConfig
    • searchPod

      public void searchPod()
      Searches for pods associated with the kube job and populates the podNames list with the names of the found pods.
    • finish

      public void finish(KubeConfig kubeConfig, String jobName)
      If the kube configuration is available, search for pods associated with the job, retrieve the job information, and update the job step accordingly. Then, start a KubeJobFinish thread to monitor the completion of the kube job.
      Parameter:
      kubeConfig - The kube configuration associated with the processing facility
      jobName - The name of the kube job
    • updateInfo

      public Boolean updateInfo(String jobName)
      Update all the information of a Kubernetes job which is stored in the job step. This method retrieves the information of a Kubernetes job with the provided name and updates the corresponding job step accordingly. It also performs additional checks and updates based on the job and pod status. The method returns the success status of the update operation.
      Parameter:
      jobName - The name of the Kubernetes job
      Gibt zurück:
      The result of the update operation: TRUE if the update was successful, FALSE if an error occurred, and CHANGED if the job step was modified by others during the update process
    • updateFinishInfoAndDelete

      public boolean updateFinishInfoAndDelete(String jobName)
      Retrieves and store the completion information of the Kubernetes job specified by the given job name. Additionally, perform cleanup operations and delete the Kubernetes job.
      Parameter:
      jobName - The name of the Kubernetes job
      Gibt zurück:
      True if the update and deletion were successful, false otherwise
    • getJobStepLogPrim

      public String getJobStepLogPrim(io.kubernetes.client.openapi.models.V1Pod pod)
      Retrieves the log information for a job step from the associated pod.
      Parameter:
      pod - The V1Pod object representing the associated pod
      Gibt zurück:
      The log information for the job step