Search in sources :

Example 21 with GFacException

use of org.apache.airavata.gfac.core.GFacException in project airavata by apache.

the class DataTransferrer method publishFinalOutputs.

public void publishFinalOutputs() throws GFacException {
    try {
        if (!resultantOutputsLst.isEmpty()) {
            log.debug("Publishing the list of outputs to the registry instance..");
            ExperimentCatalog experimentCatalog = processContext.getExperimentCatalog();
            experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, resultantOutputsLst, processContext.getExperimentId());
        }
    } catch (RegistryException e) {
        throw new GFacException("Cannot publish outputs to the registry.");
    }
}
Also used : ExperimentCatalog(org.apache.airavata.registry.cpi.ExperimentCatalog) GFacException(org.apache.airavata.gfac.core.GFacException) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Example 22 with GFacException

use of org.apache.airavata.gfac.core.GFacException in project airavata by apache.

the class LocalRemoteCluster method getJobStatuses.

@Override
public void getJobStatuses(String userName, Map<String, JobStatus> jobStatusMap) throws GFacException {
    try {
        RawCommandInfo userBasedMonitorCommand = jobManagerConfiguration.getUserBasedMonitorCommand(userName);
        LocalCommandOutput localCommandOutput = new LocalCommandOutput();
        executeCommand(userBasedMonitorCommand, localCommandOutput);
        outputParser.parseJobStatuses(userName, jobStatusMap, localCommandOutput.getStandardOut());
    } catch (IOException e) {
        throw new GFacException("Error while getting job statuses", e);
    }
}
Also used : GFacException(org.apache.airavata.gfac.core.GFacException) IOException(java.io.IOException)

Example 23 with GFacException

use of org.apache.airavata.gfac.core.GFacException in project airavata by apache.

the class LocalRemoteCluster method submitBatchJob.

@Override
public JobSubmissionOutput submitBatchJob(String jobScriptFilePath, String workingDirectory) throws GFacException {
    try {
        JobSubmissionOutput jsoutput = new JobSubmissionOutput();
        // scp script file to working directory
        copyTo(jobScriptFilePath, workingDirectory + File.separator + new File(jobScriptFilePath).getName());
        RawCommandInfo submitCommand = jobManagerConfiguration.getSubmitCommand(workingDirectory, jobScriptFilePath);
        submitCommand.setRawCommand(submitCommand.getRawCommand());
        LocalCommandOutput localCommandOutput = new LocalCommandOutput();
        executeCommand(submitCommand, localCommandOutput);
        jsoutput.setJobId(outputParser.parseJobSubmission(localCommandOutput.getStandardOut()));
        jsoutput.setExitCode(localCommandOutput.getExitCode());
        jsoutput.setStdOut(localCommandOutput.getStandardOut());
        jsoutput.setStdErr(localCommandOutput.getStandardErrorString());
        return jsoutput;
    } catch (IOException e) {
        throw new GFacException("Error while submitting local batch job", e);
    }
}
Also used : GFacException(org.apache.airavata.gfac.core.GFacException) IOException(java.io.IOException) File(java.io.File)

Example 24 with GFacException

use of org.apache.airavata.gfac.core.GFacException in project airavata by apache.

the class LocalRemoteCluster method scpThirdParty.

@Override
public void scpThirdParty(String sourceFile, Session srcSession, String destinationFile, Session destSession, DIRECTION inOrOut, boolean ignoreEmptyFile) throws GFacException {
    int retryCount = 0;
    try {
        while (retryCount < MAX_RETRY_COUNT) {
            retryCount++;
            log.info("Transferring from:" + sourceFile + " To: " + destinationFile);
            try {
                if (inOrOut == DIRECTION.TO) {
                    SSHUtils.scpThirdParty(sourceFile, srcSession, destinationFile, destSession, ignoreEmptyFile);
                } else {
                    SSHUtils.scpThirdParty(sourceFile, srcSession, destinationFile, destSession, ignoreEmptyFile);
                }
                // exit while loop
                break;
            } catch (JSchException e) {
                if (retryCount == MAX_RETRY_COUNT) {
                    log.error("Retry count " + MAX_RETRY_COUNT + " exceeded for  transferring from:" + sourceFile + " To: " + destinationFile, e);
                    throw e;
                }
                log.error("Issue with jsch, Retry transferring from:" + sourceFile + " To: " + destinationFile, e);
            }
        }
    } catch (IOException | JSchException e) {
        throw new GFacException("Failed scp file:" + sourceFile + " to remote file " + destinationFile, e);
    }
}
Also used : JSchException(com.jcraft.jsch.JSchException) GFacException(org.apache.airavata.gfac.core.GFacException) IOException(java.io.IOException)

Example 25 with GFacException

use of org.apache.airavata.gfac.core.GFacException in project airavata by apache.

the class LocalRemoteCluster method getJobIdByJobName.

@Override
public String getJobIdByJobName(String jobName, String userName) throws GFacException {
    try {
        RawCommandInfo jobIdMonitorCommand = jobManagerConfiguration.getJobIdMonitorCommand(jobName, userName);
        LocalCommandOutput localCommandOutput = new LocalCommandOutput();
        executeCommand(jobIdMonitorCommand, localCommandOutput);
        return outputParser.parseJobId(jobName, localCommandOutput.getStandardOut());
    } catch (IOException e) {
        throw new GFacException("Error while getting jobId using JobName", e);
    }
}
Also used : GFacException(org.apache.airavata.gfac.core.GFacException) IOException(java.io.IOException)

Aggregations

GFacException (org.apache.airavata.gfac.core.GFacException)73 IOException (java.io.IOException)24 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)19 ProcessContext (org.apache.airavata.gfac.core.context.ProcessContext)16 JSchException (com.jcraft.jsch.JSchException)15 RegistryException (org.apache.airavata.registry.cpi.RegistryException)15 AiravataException (org.apache.airavata.common.exception.AiravataException)14 TaskStatus (org.apache.airavata.model.status.TaskStatus)13 URISyntaxException (java.net.URISyntaxException)12 ErrorModel (org.apache.airavata.model.commons.ErrorModel)11 CredentialStoreException (org.apache.airavata.credential.store.store.CredentialStoreException)10 TException (org.apache.thrift.TException)9 AppCatalogException (org.apache.airavata.registry.cpi.AppCatalogException)8 DefaultClientConfiguration (eu.unicore.util.httpclient.DefaultClientConfiguration)7 URI (java.net.URI)7 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)7 Session (com.jcraft.jsch.Session)6 InvalidKeyException (java.security.InvalidKeyException)6 RemoteCluster (org.apache.airavata.gfac.core.cluster.RemoteCluster)6 JobModel (org.apache.airavata.model.job.JobModel)6