agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/queue/actions/StagingAction.java
/**
     * Checks whether the given job input exists in the job work directory already and, if so, whether the size, type,
     * and checksums match up. Since checksums are not supported by all {@link RemoteDataClient} implementations, we
     * fall back to a standard size comparison when not available.
     *
     * @param singleRawInputValue the raw job input value
     * @param destPath the path on the execution system where the input should be copied
     * @param jobExecutionSystemRemoteDataClient a preauthenticated client to the execution system
     * @param remoteJobInputPath the path to the job input on the source system
     * @param jobInputRemoteDataClient a preauthenticated clien to the job input
     * @return true if the job input file item exists on the execution system and matches boht type and size (if a file)
     * @throws JobException if unable to update job status to reflect the file will be skipped
     */
Checks whether the given job input exists in the job work directory already and, if so, whether the size, type,
and checksums match up. Since checksums are not supported by all  RemoteDataClient implementations, we
fall back to a standard size comparison when not available.


Checks whether the given job input exists in the job work directory already and if so whether the size type and checksums match up . Since checksums are not supported by all RemoteDataClient implementations we fall back to a standard size comparison when not available .
protected boolean isJobInputAlreadyTransferred(String singleRawInputValue, String destPath, RemoteDataClient jobExecutionSystemRemoteDataClient, String remoteJobInputPath, RemoteDataClient jobInputRemoteDataClient)
    throws JobException {
        boolean skipTransfer = false;
        String message = null;
        try {
            RemoteFileInfo destFileInfo = jobExecutionSystemRemoteDataClient.getFileInfo(destPath);
            if (destFileInfo.isFile()) {
                RemoteFileInfo srcFileInfo = jobExecutionSystemRemoteDataClient.getFileInfo(remoteJobInputPath);
                if (srcFileInfo.getSize() == destFileInfo.getSize()) {
                    try {
                        String sourceChecksum = jobInputRemoteDataClient.checksum(remoteJobInputPath);
                        String destChecksum = jobExecutionSystemRemoteDataClient.checksum(destPath);
                        if (StringUtils.equals(sourceChecksum, destChecksum)) {
                            message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job "
                                    + getJob().getUuid() + ". The checksums were identical. This input will not be recopied.";
                            skipTransfer = true;
                        } else {
                            message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job "
                                    + getJob().getUuid() + ". The checksums did not match, so the input file will be transfered to the "
                                    + "target system and overwrite the existing file.";
                        }
                    }
                    catch (NotImplementedException e) {
                        message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job "
                                + getJob().getUuid() + ". Unable to calculate checksums. This input will not be recopied.";
                        skipTransfer = true;
                    } catch (Throwable e) {
                        message = "Unable to locate file " + singleRawInputValue + " in the work folder of job "
                                + getJob().getUuid() + ". This input will not be recopied.";
                    }
                }
            }
        } catch (IOException | RemoteDataException ignored) {
            message = singleRawInputValue + " is not present in the work folder of job "
                    + getJob().getUuid() + ". This input will be copied.";
        }
        log.debug(message);
        if (skipTransfer) {
            getJob().setStatus(JobStatusType.STAGING_INPUTS, message);
        }
        return skipTransfer;
    }
protected boolean isJobInputAlreadyTransferred ( String singleRawInputValue , String destPath , RemoteDataClient jobExecutionSystemRemoteDataClient , String remoteJobInputPath , RemoteDataClient jobInputRemoteDataClient ) throws JobException { boolean skipTransfer = false ; String message = null ; try { RemoteFileInfo destFileInfo = jobExecutionSystemRemoteDataClient . getFileInfo ( destPath ) ; if ( destFileInfo . isFile ( ) ) { RemoteFileInfo srcFileInfo = jobExecutionSystemRemoteDataClient . getFileInfo ( remoteJobInputPath ) ; if ( srcFileInfo . getSize ( ) == destFileInfo . getSize ( ) ) { try { String sourceChecksum = jobInputRemoteDataClient . checksum ( remoteJobInputPath ) ; String destChecksum = jobExecutionSystemRemoteDataClient . checksum ( destPath ) ; if ( StringUtils . equals ( sourceChecksum , destChecksum ) ) { message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job " + getJob ( ) . getUuid ( ) + ". The checksums were identical. This input will not be recopied." ; skipTransfer = true ; } else { message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job " + getJob ( ) . getUuid ( ) + ". The checksums did not match, so the input file will be transfered to the " + "target system and overwrite the existing file." ; } } catch ( NotImplementedException e ) { message = "Input file " + singleRawInputValue + " of idential size was found in the work folder of job " + getJob ( ) . getUuid ( ) + ". Unable to calculate checksums. This input will not be recopied." ; skipTransfer = true ; } catch ( Throwable e ) { message = "Unable to locate file " + singleRawInputValue + " in the work folder of job " + getJob ( ) . getUuid ( ) + ". This input will not be recopied." ; } } } } catch ( IOException | RemoteDataException ignored ) { message = singleRawInputValue + " is not present in the work folder of job " + getJob ( ) . getUuid ( ) + ". This input will be copied." ; } log . debug ( message ) ; if ( skipTransfer ) { getJob ( ) . setStatus ( JobStatusType . STAGING_INPUTS , message ) ; } return skipTransfer ; }
Checks whether the given job input exists in the job work directory already and, if so, whether the size, type,
 and checksums match up.
Checks whether the given job input exists in the job work directory already and if so whether the size type and checksums match up .
// we use a stat here to avoid having to do both an existence check and length query // directories will be sorted out on their own. here we check for files already being copied // in with a length check. If that passes, we can compute the checksum, though, those are not // implemented for every remote data client at this time. // get source file info. We checked for existence when we first resolved the path for this input // verify the checksums are the same before skipping? // checksum comparison not available. we'll go ahead and trust the size // couldn't calculate the checksum due to server side error // we'll err on the side of caution and recopy // destination path does not exist or is unreadable. The transfer will proceed.