Package org.cdlib.mrt.zk
Class Batch
java.lang.Object
org.cdlib.mrt.zk.QueueItem
org.cdlib.mrt.zk.Batch
Class to manage a Merritt Ingest Batch in the Batch Queue.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.cdlib.mrt.zk.QueueItem
QueueItem.BatchJobStates, QueueItem.ZkPaths, QueueItem.ZkPrefixes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchacquireBatchForReporting(org.apache.zookeeper.ZooKeeper client) static BatchacquirePendingBatch(org.apache.zookeeper.ZooKeeper client) static BatchacquireUpdateBatchForReporting(org.apache.zookeeper.ZooKeeper client) static StringbatchUuidPath(String uuid) static BatchcreateBatch(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject submission) voiddelete(org.apache.zookeeper.ZooKeeper client) deleteCompletedBatches(org.apache.zookeeper.ZooKeeper client) deleteDeletedJobs(org.apache.zookeeper.ZooKeeper client) dir()static BatchfindByUuid(org.apache.zookeeper.ZooKeeper client, String uuid) getCompletedJobs(org.apache.zookeeper.ZooKeeper client) getDeletedJobs(org.apache.zookeeper.ZooKeeper client) getFailedJobs(org.apache.zookeeper.ZooKeeper client) getJobs(org.apache.zookeeper.ZooKeeper client, QueueItem.BatchJobStates state) getProcessingJobs(org.apache.zookeeper.ZooKeeper client) booleanIndicate that a batch contains a failed job in the Job Queue.static IngestStatevoidloadHasFailure(org.apache.zookeeper.ZooKeeper client) voidloadProperties(org.apache.zookeeper.ZooKeeper client, boolean setStatus) static voidprefix()static Stringstates()Methods inherited from class org.cdlib.mrt.zk.QueueItem
createData, createOrSetData, data, id, intProperty, jsonDataProperty, jsonIntProperty, jsonLongProperty, jsonProperty, jsonStringProperty, load, load, loadStatus, lock, longProperty, makePath, optJsonProperty, optStringProperty, path, setData, setStatus, setStatus, setStatusTrigger, status, statusObject, stringProperty, unlock
-
Constructor Details
-
Batch
- Parameters:
id- Unique id assigned to a batch. This id is generated by creating a sequential batch folder.
-
Batch
- Parameters:
id- Unique id assigned to a batch. This id is generated by creating a sequential batch folder.data- JSON representation of an ingest initiated by a Merritt depostor.
-
-
Method Details
-
hasFailure
public boolean hasFailure()Indicate that a batch contains a failed job in the Job Queue.- Returns:
- true if a failed job exists for the batch
-
dir
-
prefix
-
prefixPath
-
initStatus
-
loadHasFailure
public void loadHasFailure(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
resolveStatus
- Specified by:
resolveStatusin classQueueItem
-
batchUuid
-
loadProperties
public void loadProperties(org.apache.zookeeper.ZooKeeper client, boolean setStatus) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid - Overrides:
loadPropertiesin classQueueItem- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittZKNodeInvalid
-
states
-
batchUuidPath
-
createBatch
public static Batch createBatch(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject submission) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid, MerrittStateError - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittZKNodeInvalidMerrittStateError
-
delete
public void delete(org.apache.zookeeper.ZooKeeper client) throws MerrittStateError, MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException - Specified by:
deletein classQueueItem- Throws:
MerrittStateErrorMerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
acquirePendingBatch
public static Batch acquirePendingBatch(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
acquireBatchForReporting
public static Batch acquireBatchForReporting(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
acquireUpdateBatchForReporting
public static Batch acquireUpdateBatchForReporting(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
deleteCompletedBatches
public static List<String> deleteCompletedBatches(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
deleteDeletedJobs
public static List<String> deleteDeletedJobs(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
getProcessingJobs
public List<Job> getProcessingJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getCompletedJobs
public List<Job> getCompletedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getFailedJobs
public List<Job> getFailedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getDeletedJobs
public List<Job> getDeletedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getJobs
public List<Job> getJobs(org.apache.zookeeper.ZooKeeper client, QueueItem.BatchJobStates state) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
findByUuid
public static Batch findByUuid(org.apache.zookeeper.ZooKeeper client, String uuid) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid - Throws:
org.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittZKNodeInvalid
-
main
-