Object AsyncPlatform

  • All Implemented Interfaces:

    
    public class AsyncPlatform
    
                        

    Asynchronous Compute Platform

    Access point for working with the async compute platform library.

    Provides methods for submitting jobs, retrieving job details, and fetching job results.

    Since:

    1.0.0

    Author:

    Elizabeth Paige Harper https://github.com/foxcapades

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • init

         final static Unit init(AsyncPlatformConfig config)

        Initializes the async compute platform library.

        Initialization steps:

        • configuration

        • database migration

        • dead job cleanup

        • queue repopulation

        Parameters:
        config - Platform configuration.
      • submitJob

         final static Unit submitJob(String queue, Function1<JobSubmission.Builder, Unit> fn)

        Submits a new job to the async compute platform.

        Parameters:
        queue - ID/name of the target queue this job should be submitted to.
        fn - Action used to configure the job to submit.
      • submitJob

         final static Unit submitJob(String queue, JobSubmission job)

        Submits a new job to the async compute platform.

        Parameters:
        queue - ID/name of the target queue this job should be submitted to.
        job - Configuration for the job to submit.
      • getJob

         final static AsyncJob getJob(HashID jobID)

        Looks up and returns the job with the given jobID if such a job exists.

        If no such job was found, this method returns null.

        Parameters:
        jobID - Hash ID of the job to look up.
        Returns:

        The target job, if it exists, otherwise null.

      • getJobFiles

         final static List<JobFileReference> getJobFiles(HashID jobID)

        Fetches the available files for the target job.

        Parameters:
        jobID - Hash ID of the job whose results should be retrieved.
        Returns:

        List of files in the job workspace.

      • getJobFile

         final static JobFileReference getJobFile(HashID jobID, String fileName)

        Fetches the target file for the target job.

        If the target file does not exist, this method returns null.

        Parameters:
        jobID - Hash ID of the job whose file should be retrieved.
        fileName - Name of the file to retrieve.
        Returns:

        A reference to the target file, if it exists, otherwise null.

        Since:

        1.5.0

      • deleteJob

        @JvmOverloads() final static Unit deleteJob(HashID jobID, Boolean throwOnNotExists)

        Deletes the target job only if it exists, is owned by the current service or process, and is in a completed status.

        If the target job is not owned by the current service instance, this method throws an UnownedJobException.

        Callers should first use getJob to test the completion and ownership statuses of the job before attempting to use this method.

        Parameters:
        jobID - Hash ID of the job that should be deleted.
        throwOnNotExists - Whether an exception should be thrown if the target job does not exist in S3.
        Since:

        1.2.0

      • deleteJob

        @JvmOverloads() final static Unit deleteJob(HashID jobID)

        Deletes the target job only if it exists, is owned by the current service or process, and is in a completed status.

        If the target job is not owned by the current service instance, this method throws an UnownedJobException.

        Callers should first use getJob to test the completion and ownership statuses of the job before attempting to use this method.

        Parameters:
        jobID - Hash ID of the job that should be deleted.
        Since:

        1.2.0

      • listJobReferences

         final static List<JobReference> listJobReferences()

        Lists references to jobs that may or may not be owned by this service instance.

        Returns:

        List of job references.

        Since:

        1.4.0

      • expireJob

         final static Unit expireJob(HashID jobID)

        Marks the target job as expired.

        If the target job is not owned by the current Async Platform instance, an UnownedJobException will be thrown.

        Parameters:
        jobID - ID of the job to expire.
        Since:

        1.5.0

      • getOwnedBrokenJobs

         final static List<AsyncJob> getOwnedBrokenJobs()

        Fetches a list of jobs owned by the current campus that are in the failed status.

        Returns:

        The retrieved list of broken jobs.

        Since:

        1.6.0