Search in sources :

Example 1 with Account

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();
}
Also used : Account(org.javaswift.joss.model.Account) JossAccount(com.ibm.stocator.fs.swift.auth.JossAccount) StoredObject(org.javaswift.joss.model.StoredObject)

Aggregations

JossAccount (com.ibm.stocator.fs.swift.auth.JossAccount)1 Account (org.javaswift.joss.model.Account)1 StoredObject (org.javaswift.joss.model.StoredObject)1