use of org.javaswift.joss.model.Account in project stocator by SparkTC.
the class SwiftAPIClient method isJobSuccessful.
/**
* Checks if container/object contains
* container/object/_SUCCESS
* If so, this object was created by successful Hadoop job
*
* @param objectName
* @return boolean if job is successful
*/
private boolean isJobSuccessful(String objectName) {
LOG.trace("Checking if job completed successfull for {}", objectName);
if (cachedSparkJobsStatus.containsKey(objectName)) {
return cachedSparkJobsStatus.get(objectName).booleanValue();
}
String obj = objectName;
Account account = mJossAccount.getAccount();
LOG.trace("HEAD {}", obj + "/" + HADOOP_SUCCESS);
StoredObject so = account.getContainer(container).getObject(obj + "/" + HADOOP_SUCCESS);
Boolean isJobOK = Boolean.FALSE;
if (so.exists()) {
LOG.debug("{} exists", obj + "/" + HADOOP_SUCCESS);
isJobOK = Boolean.TRUE;
}
cachedSparkJobsStatus.put(objectName, isJobOK);
return isJobOK.booleanValue();
}
Aggregations