Klasse JobStepUtil

java.lang.Object
de.dlr.proseo.planner.util.JobStepUtil

@Component public class JobStepUtil extends Object
Utility class for managing job steps.
Autor:
Ernst Melchinger
  • Felddetails

  • Konstruktordetails

    • JobStepUtil

      public JobStepUtil()
  • Methodendetails

    • getProductQueryService

      public ProductQueryService 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 state
      mission - The mission code
      limit - 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 facility
      pcId - The ID of the product class
      onlyWaiting - 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 suspend
      force - 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

      @Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage cancel(JobStep js)
      Cancels a job step.
      Parameter:
      js - The job step to cancel
      Gibt zurück:
      A PlannerResultMessage indicating the outcome of the cancellation attempt
    • close

      public PlannerResultMessage close(Long id)
      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

      @Transactional(isolation=REPEATABLE_READ) public PlannerResultMessage retry(JobStep js)
      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

      @Transactional(isolation=REPEATABLE_READ) public Boolean checkFinish(JobStep js)
      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

      @Transactional(isolation=REPEATABLE_READ) public Boolean delete(JobStep js)
      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

      public Boolean deleteSatisfiedProductQueries(Long jsId)
      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

      @Transactional(isolation=REPEATABLE_READ) public Boolean deleteForced(JobStep js)
      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

      public PlannerResultMessage resume(JobStep js, Boolean force)
      Resume job step
      Parameter:
      js - Job step
      Gibt zurück:
      Result message
    • startJobStep

      @Transactional(isolation=REPEATABLE_READ) public Boolean startJobStep(JobStep js)
      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

      public void checkJobStepQueries(JobStep js, Boolean force)
      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 check
      force - 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

      public 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. If onlyRun is false, also checks unsatisfied queries on the processing facility defined in the Kubernetes configuration.
      Parameter:
      kc - The Kubernetes configuration to check
      pcId - The ID of the product class to check for
      onlyRun - Indicates whether to only check for job steps to run without checking unsatisfied queries
      onlyWaiting - Indicates whether to only check for job steps in waiting state
    • checkJobStepToRun

      public Boolean checkJobStepToRun(KubeConfig kc, long jsId)
      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 facility
      jsId - The ID of the job step to check for running
      Gibt zurück:
      true if the job step can be run, false otherwise
    • checkJobToRun

      public void checkJobToRun(KubeConfig kc, long jobId) throws InterruptedException
      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 - KubeConfig
      jobId - ID of the job to be checked
      Löst aus:
      InterruptedException - If the thread is interrupted during execution
    • checkOrderToRun

      public void checkOrderToRun(KubeConfig kc, long orderId)
      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 - KubeConfig
      orderId - The ID of the ProcessingOrder to check
    • checkCreatedProducts

      @Transactional(isolation=REPEATABLE_READ) public void checkCreatedProducts(JobStep js)
      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 tree
      list - 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 checked
      pf - 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