agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/monitors/CondorJobMonitor.java
/**
     * Fetches the condor job log file from the remote host. For CondorHT systems, this is a more reliable approach
     * than trying to query status values, which may be less descriptive and updated less frequently.
     *
     * @param queryCommand the command to run on the {@link ExecutionSystem}. This is ignored in favor of fetching the job log file
     * @return contents of the condor job's log file
     * @throws RemoteJobMonitoringException if unable to fetch the condor log file content for any reason.
     */
Fetches the condor job log file from the remote host. For CondorHT systems, this is a more reliable approach
than trying to query status values, which may be less descriptive and updated less frequently.

@param queryCommand the command to run on the  ExecutionSystem. This is ignored in favor of fetching the job log file
@return contents of the condor job's log file
@throws RemoteJobMonitoringException if unable to fetch the condor log file content for any reason.
Fetches the condor job log file from the remote host . For CondorHT systems this is a more reliable approach than trying to query status values which may be less descriptive and updated less frequently . @param queryCommand the command to run on the ExecutionSystem . This is ignored in favor of fetching the job log file @return contents of the condor job ' s log file @throws RemoteJobMonitoringException if unable to fetch the condor log file content for any reason .
protected String queryRemoteJobStatus(String queryCommand) throws RemoteJobMonitoringException {
        String remoteLogFilePath = job.getWorkPath() + "/runtime.log";
        RemoteDataClient remoteDataClient = null;
        try {
            remoteDataClient = getAuthenticatedRemoteDataClient();
        } catch (Throwable e) {
            throw new RemoteJobMonitoringException("Unable to check status of job " + job.getUuid() +
                    ". Failed to establish connection to exectuion system "
                    + job.getSystem(), e);
        }
        log.debug("Fetching condor runtime log file for job " + this.job.getUuid()
                + " at agave://" + job.getSystem() + "/" + remoteLogFilePath);
        Path localRuntimeLogFilePath = null;
        try {
            localRuntimeLogFilePath = Files.createTempFile(job.getUuid(), null);
            remoteDataClient.get(remoteLogFilePath, localRuntimeLogFilePath.toAbsolutePath().toString());
            return new String(Files.readAllBytes(localRuntimeLogFilePath));
        } catch (RemoteDataException | IOException e) {
            throw new RemoteJobMonitoringException("Unable to check status of job " + job.getUuid() +
                    ". Failed to retrieve remote runtime log file from job work directory", e);
        } finally {
            try {
                if (localRuntimeLogFilePath != null) Files.delete(localRuntimeLogFilePath);
            } catch (Exception ignored) {}
            try { if (remoteDataClient != null) remoteDataClient.disconnect(); } catch (Exception ignored) {}
        }
    }
protected String queryRemoteJobStatus ( String queryCommand ) throws RemoteJobMonitoringException { String remoteLogFilePath = job . getWorkPath ( ) + "/runtime.log" ; RemoteDataClient remoteDataClient = null ; try { remoteDataClient = getAuthenticatedRemoteDataClient ( ) ; } catch ( Throwable e ) { throw new RemoteJobMonitoringException ( "Unable to check status of job " + job . getUuid ( ) + ". Failed to establish connection to exectuion system " + job . getSystem ( ) , e ) ; } log . debug ( "Fetching condor runtime log file for job " + this . job . getUuid ( ) + " at agave://" + job . getSystem ( ) + "/" + remoteLogFilePath ) ; Path localRuntimeLogFilePath = null ; try { localRuntimeLogFilePath = Files . createTempFile ( job . getUuid ( ) , null ) ; remoteDataClient . get ( remoteLogFilePath , localRuntimeLogFilePath . toAbsolutePath ( ) . toString ( ) ) ; return new String ( Files . readAllBytes ( localRuntimeLogFilePath ) ) ; } catch ( RemoteDataException | IOException e ) { throw new RemoteJobMonitoringException ( "Unable to check status of job " + job . getUuid ( ) + ". Failed to retrieve remote runtime log file from job work directory" , e ) ; } finally { try { if ( localRuntimeLogFilePath != null ) Files . delete ( localRuntimeLogFilePath ) ; } catch ( Exception ignored ) { } try { if ( remoteDataClient != null ) remoteDataClient . disconnect ( ) ; } catch ( Exception ignored ) { } } }
Fetches the condor job log file from the remote host.
Fetches the condor job log file from the remote host .
// Create temp file to hold the fetched runtime log // download the content to the file // clean up the remote data client, closing the connection