Package de.dlr.proseo.planner.kubernetes
Klasse KubeJob
java.lang.Object
de.dlr.proseo.planner.kubernetes.KubeJob
A KubeJob describes the complete information to run a Kubernetes job.
- Autor:
- Ernst Melchinger
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Add an argument to the list of command arguments.createJob
(KubeConfig kubeConfig, String stdoutLogLevel, String stderrLogLevel) Creates a Kubernetes job on the processing facility based on the provided parameters.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.Returns the name of the container associated with the job.long
getJobId()
Returns the job ID.Returns the job name.Returns the processing order to which the job is associated.Returns the name of the job order file (JOF).getJobStepLogPrim
(io.kubernetes.client.openapi.models.V1Pod pod) Retrieves the log information for a job step from the associated pod.Gets the kube configurationReturns the list of pod names associated with the job.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.void
Searches for pods associated with the kube job and populates the podNames list with the names of the found pods.void
setJobOrder
(JobOrder jobOrder) Sets the job order for the job.void
setJobOrderFileName
(String jobOrderFileName) Sets the name of the job order file (JOF).boolean
updateFinishInfoAndDelete
(String jobName) Retrieves and store the completion information of the Kubernetes job specified by the given job name.updateInfo
(String jobName) Update all the information of a Kubernetes job which is stored in the job step.
-
Konstruktordetails
-
KubeJob
public KubeJob()Instantiate a kube job with a list of pod names -
KubeJob
Instantiate a Kubernetes job with ID and Job Order file name- Parameter:
jobId
- the job IDjobOrderFileName
- the Job Order file name
-
-
Methodendetails
-
getJobId
public long getJobId()Returns the job ID.- Gibt zurück:
- the jobId
-
getJobName
Returns the job name.- Gibt zurück:
- the jobName
-
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
Returns the name of the container associated with the job.- Gibt zurück:
- the containerName
-
getJobOrderFileName
Returns the name of the job order file (JOF).- Gibt zurück:
- the jobOrderFileName
-
setJobOrderFileName
Sets the name of the job order file (JOF).- Parameter:
jobOrderFileName
- the jobOrderFileName to set
-
getJobOrder
Returns the processing order to which the job is associated.- Gibt zurück:
- the jobOrder
-
setJobOrder
Sets the job order for the job.- Parameter:
jobOrder
- the jobOrder to set
-
addArg
Add an argument to the list of command arguments.- Parameter:
arg
- The command argument to add
-
rebuild
Rebuilds the kube job entries of a processing facility after a restart of the planner.- Parameter:
kubeConfig
- The processing facility's kube configurationjob
- 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 configurationstdoutLogLevel
- The log level for stdoutstderrLogLevel
- The log level for stderr- Gibt zurück:
- The kube job
- Löst aus:
Exception
- if an error occurs during job creation
-
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
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 facilityjobName
- The name of the kube job
-
updateInfo
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
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
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
-