Package org.cdlib.mrt.zk
Class Job
- java.lang.Object
-
- org.cdlib.mrt.zk.QueueItem
-
- org.cdlib.mrt.zk.Job
-
public class Job extends QueueItem
Class to manage a Merritt Ingest Job in the Job Queue.- See Also:
- State Transition Design
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cdlib.mrt.zk.QueueItem
QueueItem.BatchJobStates, QueueItem.ZkPaths, QueueItem.ZkPrefixes
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Job
acquireJob(org.apache.zookeeper.ZooKeeper client, IngestState state)
String
batchStatePath()
String
batchStateSubpath()
String
bid()
static Job
createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration)
static Job
createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers)
static Job
createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers, org.json.JSONObject metadata)
static Job
createJob(org.apache.zookeeper.ZooKeeper client, String bid, org.json.JSONObject configuration)
static org.json.JSONObject
createJobConfiguration(String profile, String submitter, String payloadUrl, String payloadType, String responseType)
static org.json.JSONObject
createJobIdentifiers(String primary, String local)
static org.json.JSONObject
createJobMetadata(String who, String what, String when, String where)
void
delete(org.apache.zookeeper.ZooKeeper client)
String
dir()
String
ercWhat()
String
ercWhen()
String
ercWhere()
String
ercWho()
static void
initNodes(org.apache.zookeeper.ZooKeeper client)
static IngestState
initStatus()
String
inventoryManifestUrl()
String
inventoryMode()
String
jid()
String
jobStatePath()
static List<Job>
listJobs(org.apache.zookeeper.ZooKeeper client, IngestState state)
void
loadProperties(org.apache.zookeeper.ZooKeeper client)
void
loadStatus(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject js)
String
localId()
String
payloadType()
String
payloadUrl()
String
prefix()
static String
prefixPath()
String
primaryId()
int
priority()
String
profileName()
IngestState
resolveStatus(String s)
String
responseType()
int
retryCount()
void
setBatchStatePath(org.apache.zookeeper.ZooKeeper client)
void
setIdentifiers(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject identifiers)
void
setInventory(org.apache.zookeeper.ZooKeeper client, String manifest_url, String mode)
void
setJobStatePath(org.apache.zookeeper.ZooKeeper client)
void
setMetadata(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject metadata)
void
setSpaceNeeded(org.apache.zookeeper.ZooKeeper client, long spaceNeeded)
void
setStatusTrigger(org.apache.zookeeper.ZooKeeper client)
void
setStatusWithPriority(org.apache.zookeeper.ZooKeeper client, IngestState status, int priority)
void
setStatusWithRetry(org.apache.zookeeper.ZooKeeper client, IngestState status)
long
spaceNeeded()
IngestState[]
states()
org.json.JSONObject
statusObject(IngestState status)
String
submitter()
-
Methods inherited from class org.cdlib.mrt.zk.QueueItem
createData, createOrSetData, data, id, intProperty, jsonDataProperty, jsonIntProperty, jsonLongProperty, jsonProperty, jsonStringProperty, load, lock, longProperty, makePath, optJsonProperty, optStringProperty, path, setData, setStatus, setStatus, status, stringProperty, unlock
-
-
-
-
Method Detail
-
bid
public String bid()
-
jobStatePath
public String jobStatePath()
-
batchStatePath
public String batchStatePath()
-
retryCount
public int retryCount()
-
priority
public int priority()
-
spaceNeeded
public long spaceNeeded()
-
prefixPath
public static String prefixPath()
-
initStatus
public static IngestState initStatus()
-
resolveStatus
public IngestState resolveStatus(String s)
- Specified by:
resolveStatus
in classQueueItem
-
loadProperties
public void loadProperties(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Overrides:
loadProperties
in classQueueItem
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
states
public IngestState[] states()
-
createJobMetadata
public static org.json.JSONObject createJobMetadata(String who, String what, String when, String where)
-
ercWho
public String ercWho()
-
ercWhat
public String ercWhat()
-
ercWhen
public String ercWhen()
-
ercWhere
public String ercWhere()
-
createJobIdentifiers
public static org.json.JSONObject createJobIdentifiers(String primary, String local)
-
primaryId
public String primaryId()
-
localId
public String localId()
-
createJobConfiguration
public static org.json.JSONObject createJobConfiguration(String profile, String submitter, String payloadUrl, String payloadType, String responseType)
-
profileName
public String profileName()
-
submitter
public String submitter()
-
payloadUrl
public String payloadUrl()
-
payloadType
public String payloadType()
-
responseType
public String responseType()
-
jid
public String jid()
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, org.json.JSONObject configuration) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers, org.json.JSONObject metadata) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
statusObject
public org.json.JSONObject statusObject(IngestState status)
- Overrides:
statusObject
in classQueueItem
-
loadStatus
public void loadStatus(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject js) throws MerrittZKNodeInvalid
- Overrides:
loadStatus
in classQueueItem
- Throws:
MerrittZKNodeInvalid
-
setSpaceNeeded
public void setSpaceNeeded(org.apache.zookeeper.ZooKeeper client, long spaceNeeded) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
setIdentifiers
public void setIdentifiers(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject identifiers) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
setMetadata
public void setMetadata(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject metadata) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
setInventory
public void setInventory(org.apache.zookeeper.ZooKeeper client, String manifest_url, String mode) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
inventoryManifestUrl
public String inventoryManifestUrl()
-
inventoryMode
public String inventoryMode()
-
setStatusWithRetry
public void setStatusWithRetry(org.apache.zookeeper.ZooKeeper client, IngestState status) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
setStatusWithPriority
public void setStatusWithPriority(org.apache.zookeeper.ZooKeeper client, IngestState status, int priority) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
MerrittStateError
-
setStatusTrigger
public void setStatusTrigger(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Overrides:
setStatusTrigger
in classQueueItem
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
batchStateSubpath
public String batchStateSubpath()
-
setBatchStatePath
public void setBatchStatePath(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
setJobStatePath
public void setJobStatePath(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, InterruptedException, org.apache.zookeeper.KeeperException
- Throws:
MerrittZKNodeInvalid
InterruptedException
org.apache.zookeeper.KeeperException
-
delete
public void delete(org.apache.zookeeper.ZooKeeper client) throws MerrittStateError, MerrittZKNodeInvalid, InterruptedException, org.apache.zookeeper.KeeperException
- Specified by:
delete
in classQueueItem
- Throws:
MerrittStateError
MerrittZKNodeInvalid
InterruptedException
org.apache.zookeeper.KeeperException
-
acquireJob
public static Job acquireJob(org.apache.zookeeper.ZooKeeper client, IngestState state) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalid
org.apache.zookeeper.KeeperException
InterruptedException
-
initNodes
public static void initNodes(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
listJobs
public static List<Job> listJobs(org.apache.zookeeper.ZooKeeper client, IngestState state) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid
- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
MerrittZKNodeInvalid
-
-