Object AsyncPlatform
-
- All Implemented Interfaces:
public class AsyncPlatformAsynchronous 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
Elizabeth Paige Harper https://github.com/foxcapades
-
-
Field Summary
Fields Modifier and Type Field Description public final static AsyncPlatformINSTANCE
-
Method Summary
Modifier and Type Method Description final static Unitinit(AsyncPlatformConfig config)Initializes the async compute platform library. final Unitinit(Function1<AsyncPlatformConfig.Builder, Unit> fn)final static UnitsubmitJob(String queue, Function1<JobSubmission.Builder, Unit> fn)Submits a new job to the async compute platform. final static UnitsubmitJob(String queue, JobSubmission job)Submits a new job to the async compute platform. final static AsyncJobgetJob(HashID jobID)Looks up and returns the job with the given jobID if such a job exists. final static List<JobFileReference>getJobFiles(HashID jobID)Fetches the available files for the target job. final static JobFileReferencegetJobFile(HashID jobID, String fileName)Fetches the target file for the target job. final static UnitdeleteJob(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. final static UnitdeleteJob(HashID jobID)Deletes the target job only if it exists, is owned by the current service or process, and is in a completed status. final static List<JobReference>listJobReferences()Lists references to jobs that may or may not be owned by this service instance. final static UnitexpireJob(HashID jobID)Marks the target job as expired. final static List<AsyncJob>getOwnedBrokenJobs()Fetches a list of jobs owned by the current campus that are in the failedstatus.-
-
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.
-
init
final Unit init(Function1<AsyncPlatformConfig.Builder, Unit> fn)
-
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
failedstatus.- Returns:
The retrieved list of broken jobs.
- Since:
1.6.0
-
-
-
-