Package de.dlr.proseo.planner.util
Klasse JobStepUtil
java.lang.Object
de.dlr.proseo.planner.util.JobStepUtil
Utility class for managing job steps.
- Autor:
- Ernst Melchinger
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibung(Package privat) ProductionPlannerConfiguration
The planner configuration(Package privat) org.springframework.boot.web.client.RestTemplateBuilder
REST template builder(Package privat) ProductionPlannerSecurityConfig
The planner security configuration -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungCancels a job step.void
Checks whether all products associated with a completed job step exist.checkFinish
(JobStep js) Checks whether a job step has been finished.void
Checks all unsatisfied queries of job steps across all facilities to determine if they can be started.void
checkForJobStepsToRun
(KubeConfig kc, long pcId, Boolean onlyRun, Boolean onlyWaiting) Checks for job steps of a specific product class that can be started on the specified Kubernetes configuration.void
checkJobStepQueries
(JobStep js, Boolean force) Checks the input product queries of a job step when the job is released or started.checkJobStepToRun
(KubeConfig kc, long jsId) Checks if a job step can be run on the specified processing facility defined in the Kubernetes configuration.void
checkJobToRun
(KubeConfig kc, long jobId) Checks unsatisfied queries of job steps in a job assigned to a processing facility defined in the Kubernetes config and starts ready job steps.void
checkOrderToRun
(KubeConfig kc, long orderId) Check unsatisfied queries of job steps in processing order on processing facility (defined in Kube config).checkProducts
(List<Product> list, ProcessingFacility pf) Checks whether all products in the list exist and have been generated on the specified processing facility.Closes a job step.void
collectProducts
(Product p, List<Product> list) Recursively collects products from a product tree into a list, starting from the root product.Deletes a job step if it is in a deletable state.deleteForced
(JobStep js) Deletes a job step forcefully, including those that are not finished.Deletes the satisfied product queries associated with a job step if it's in a deletable state.findOrderedByJobStepStateAndMission
(JobStep.JobStepState state, String mission, int limit) Retrieves job steps with a specific job step state, associated with a given mission code.Resume job stepRetries a job step, attempting to re-execute it if it previously failed.void
searchForJobStepsToRun
(long pfId, long pcId, boolean onlyWaiting) Searches for job steps with unsatisfied product queries associated with a given processing facility and product class.startJobStep
(JobStep js) Initiates the execution of a job step on a Kubernetes cluster.Suspends a job step, either forcefully terminating it or waiting until completion.
-
Felddetails
-
config
The planner configuration -
securityConfig
The planner security configuration -
rtb
@Autowired org.springframework.boot.web.client.RestTemplateBuilder rtbREST template builder
-
-
Konstruktordetails
-
JobStepUtil
public JobStepUtil()
-
-
Methodendetails
-
getProductQueryService
-
findOrderedByJobStepStateAndMission
public List<JobStep> findOrderedByJobStepStateAndMission(JobStep.JobStepState state, String mission, int limit) Retrieves job steps with a specific job step state, associated with a given mission code. Results are ordered by processing completion time in descending order, limited to a specified number.- Parameter:
state
- The job step statemission
- The mission codelimit
- The maximum number of entries to return- Gibt zurück:
- A list of job steps meeting the criteria
-
searchForJobStepsToRun
public void searchForJobStepsToRun(long pfId, long pcId, boolean onlyWaiting) Searches for job steps with unsatisfied product queries associated with a given processing facility and product class. If any queries are now satisfied, changes the state of the corresponding job steps to READY.- Parameter:
pfId
- The ID of the processing facilitypcId
- The ID of the product classonlyWaiting
- Flag indicating whether to include only job steps in the WAITING_INPUT state
-
suspend
@Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage suspend(JobStep js, Boolean force) Suspends a job step, either forcefully terminating it or waiting until completion.- Parameter:
js
- The job step to suspendforce
- True to forcibly terminate the job step, false to wait until completion- Gibt zurück:
- A PlannerResultMessage indicating the outcome of the suspension attempt
-
cancel
Cancels a job step.- Parameter:
js
- The job step to cancel- Gibt zurück:
- A PlannerResultMessage indicating the outcome of the cancellation attempt
-
close
Closes a job step.- Parameter:
id
- The ID of the job step to close- Gibt zurück:
- A PlannerResultMessage indicating the outcome of the closure attempt
-
retry
Retries a job step, attempting to re-execute it if it previously failed.- Parameter:
js
- The job step to retry- Gibt zurück:
- A PlannerResultMessage indicating the outcome of the retry attempt
-
checkFinish
Checks whether a job step has been finished.- Parameter:
js
- The job step to check- Gibt zurück:
- true if the job step has finished, false otherwise
-
delete
Deletes a job step if it is in a deletable state.- Parameter:
js
- The job step to delete- Gibt zurück:
- true if the job step is deleted, false otherwise
-
deleteSatisfiedProductQueries
Deletes the satisfied product queries associated with a job step if it's in a deletable state.- Parameter:
jsId
- The ID of the job step- Gibt zurück:
- true if the satisfied product queries are deleted, false otherwise
-
deleteForced
Deletes a job step forcefully, including those that are not finished.- Parameter:
js
- The job step to delete- Gibt zurück:
- true if the job step is deleted, false otherwise
-
resume
Resume job step- Parameter:
js
- Job step- Gibt zurück:
- Result message
-
startJobStep
Initiates the execution of a job step on a Kubernetes cluster.- Parameter:
js
- The job step to start- Gibt zurück:
- True if the job step was successfully started, false otherwise
-
checkJobStepQueries
Checks the input product queries of a job step when the job is released or started. If force is true, checks all queries.- Parameter:
js
- The job step to checkforce
- If true, forces the check on all queries
-
checkForJobStepsToRun
public void checkForJobStepsToRun()Checks all unsatisfied queries of job steps across all facilities to determine if they can be started. -
checkForJobStepsToRun
Checks for job steps of a specific product class that can be started on the specified Kubernetes configuration. If onlyRun is false, also checks unsatisfied queries on the processing facility defined in the Kubernetes configuration.- Parameter:
kc
- The Kubernetes configuration to checkpcId
- The ID of the product class to check foronlyRun
- Indicates whether to only check for job steps to run without checking unsatisfied queriesonlyWaiting
- Indicates whether to only check for job steps in waiting state
-
checkJobStepToRun
Checks if a job step can be run on the specified processing facility defined in the Kubernetes configuration. This method is synchronized to prevent interference between different threads (simultaneous event-triggered dispatching).- Parameter:
kc
- The Kubernetes configuration specifying the processing facilityjsId
- The ID of the job step to check for running- Gibt zurück:
- true if the job step can be run, false otherwise
-
checkJobToRun
Checks unsatisfied queries of job steps in a job assigned to a processing facility defined in the Kubernetes config and starts ready job steps. This method is synchronized to prevent interference between different threads (simultaneous event-triggered dispatching).- Parameter:
kc
- KubeConfigjobId
- ID of the job to be checked- Löst aus:
InterruptedException
- If the thread is interrupted during execution
-
checkOrderToRun
Check unsatisfied queries of job steps in processing order on processing facility (defined in Kube config). Start ready job steps on facility. Method is synchronized to avoid different threads (simultaneous event-triggered dispatching) to interfere with each other.- Parameter:
kc
- KubeConfigorderId
- The ID of the ProcessingOrder to check
-
checkCreatedProducts
Checks whether all products associated with a completed job step exist. If not, removes any missing products and cleans up dependencies.- Parameter:
js
- The job step to be checked
-
collectProducts
@Transactional(isolation=REPEATABLE_READ) public void collectProducts(Product p, List<Product> list) Recursively collects products from a product tree into a list, starting from the root product.- Parameter:
p
- The root product of the treelist
- The list to collect the products into
-
checkProducts
@Transactional(isolation=REPEATABLE_READ) public Boolean checkProducts(List<Product> list, ProcessingFacility pf) Checks whether all products in the list exist and have been generated on the specified processing facility.- Parameter:
list
- The list of products to be checkedpf
- The processing facility to check against- Gibt zurück:
- True if all products in the list are generated on the specified processing facility, false otherwise
-