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 Batch
acquireBatchForReporting
(org.apache.zookeeper.ZooKeeper client) static Batch
acquirePendingBatch
(org.apache.zookeeper.ZooKeeper client) static Batch
acquireUpdateBatchForReporting
(org.apache.zookeeper.ZooKeeper client) static String
batchUuidPath
(String uuid) static Batch
createBatch
(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject submission) void
delete
(org.apache.zookeeper.ZooKeeper client) deleteCompletedBatches
(org.apache.zookeeper.ZooKeeper client) deleteDeletedJobs
(org.apache.zookeeper.ZooKeeper client) dir()
static Batch
findByUuid
(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) boolean
Indicate that a batch contains a failed job in the Job Queue.static IngestState
void
loadHasFailure
(org.apache.zookeeper.ZooKeeper client) void
loadProperties
(org.apache.zookeeper.ZooKeeper client, boolean setStatus) static void
prefix()
static String
states()
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.KeeperException
InterruptedException
-
resolveStatus
- Specified by:
resolveStatus
in classQueueItem
-
batchUuid
-
loadProperties
public void loadProperties(org.apache.zookeeper.ZooKeeper client, boolean setStatus) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid - Overrides:
loadProperties
in classQueueItem
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
MerrittZKNodeInvalid
-
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.KeeperException
InterruptedException
MerrittZKNodeInvalid
MerrittStateError
-
delete
public void delete(org.apache.zookeeper.ZooKeeper client) throws MerrittStateError, MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException - Specified by:
delete
in classQueueItem
- Throws:
MerrittStateError
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
acquirePendingBatch
public static Batch acquirePendingBatch(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
acquireBatchForReporting
public static Batch acquireBatchForReporting(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
acquireUpdateBatchForReporting
public static Batch acquireUpdateBatchForReporting(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
deleteCompletedBatches
public static List<String> deleteCompletedBatches(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
deleteDeletedJobs
public static List<String> deleteDeletedJobs(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError - Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
getProcessingJobs
public List<Job> getProcessingJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getCompletedJobs
public List<Job> getCompletedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getFailedJobs
public List<Job> getFailedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getDeletedJobs
public List<Job> getDeletedJobs(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
getJobs
public List<Job> getJobs(org.apache.zookeeper.ZooKeeper client, QueueItem.BatchJobStates state) throws org.apache.zookeeper.KeeperException, InterruptedException - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
findByUuid
public static Batch findByUuid(org.apache.zookeeper.ZooKeeper client, String uuid) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid - Throws:
org.apache.zookeeper.KeeperException
InterruptedException
MerrittZKNodeInvalid
-
main
-