Class DurableJobs

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.DurableJobs

public final class DurableJobs extends Object
The durable jobs facade: launch any eligible process as a job, control it, and read its status. Every client (UI, API, assistant, scheduler) goes through here, so permissions, caps and the assistant confirmation gate are enforced in one place, by the server.
  • Method Details

    • settings

      public static DurableJobsMetaData settings() throws QException
      The instance settings; throws when durable jobs are off.
      Throws:
      QException
    • isEnabled

      public static boolean isEnabled()
      Whether durable jobs are on for the current instance.
    • isEligible

      public static boolean isEligible(QProcessMetaData process)
      Whether a process may run as a durable job: its own durable meta data decides first, then the instance's list of eligible names, then the default for its kind (streamed ETL whose extract is ExtractViaQueryStep or BulkInsertExtractStep - which covers the core bulk processes).
    • getStreamedEtlExtractClassName

      public static String getStreamedEtlExtractClassName(QProcessMetaData process)
      For a streamed ETL process whose extract step is partitionable, the extract class name; else null.
    • launch

      public static Integer launch(LaunchRequest request) throws QException
      Launch a process as a durable job, as the current session's user. Returns the job id. A launch from the assistant channel waits for confirmation.
      Throws:
      QException
    • control

      public static String control(Integer jobId, JobAction action) throws QException
      Take a control action on a job, as the current session. Owners may control their own jobs; jobs_admin may control any. From the assistant channel only pause and cancel are allowed. Returns a one-line result for summaries.
      Throws:
      QException
    • retryFailedRows

      public static Integer retryFailedRows(Integer jobId, String correctedProfileJson, Integer correctedSavedProfileId) throws QException
      Retry a job's failed rows as a child job, optionally with a corrected bulk-load profile (JSON, or a saved profile id). Returns the new job id.
      Throws:
      QException
    • downloadFailedRows

      public static Map<String,Serializable> downloadFailedRows(Integer jobId) throws QException
      Write a job's failed rows as CSV for download (standard process download values: downloadFileName, storageTableName, storageReference).
      Throws:
      QException
    • status

      public static QRecord status(Integer jobId) throws QException
      Status of a job the current session can see (owner or jobs_admin).
      Throws:
      QException
    • evaluate

      public static void evaluate(Integer jobId) throws QException
      Re-evaluate a job's status from its chunks (finish, pause or cancel it when its chunks allow). Safe to call any time, from any pod.
      Throws:
      QException
    • runAgain

      public static Integer runAgain(Integer jobId) throws QException
      Run again and return the child id to clients.
      Throws:
      QException