Package org.apache.airavata.model.workspace.experiment

Examples of org.apache.airavata.model.workspace.experiment.JobState


        ObjectMapper objectMapper = new ObjectMapper();
        try {
            ComputingActivity computingActivity = objectMapper.readValue(message.getBytes(), ComputingActivity.class);
            logger.info(computingActivity.getIDFromEndpoint());
            List<String> stateList = computingActivity.getState();
            JobState jobState = null;
            for (String aState : stateList) {
                jobState = getStatusFromString(aState);
            }
            // we get the last value of the state array
            return jobState;
View Full Code Here


                    && (factory.getActivityStatus(activityEpr) != ActivityStateEnumeration.CANCELLED)) {

                ActivityStatusType activityStatus = null;
                try {
                    activityStatus = getStatus(factory, activityEpr);
                    JobState jobStatus = getApplicationJobStatus(activityStatus);
                    String jobStatusMessage = "Status of job " + jobId + "is " + jobStatus;
                    jobExecutionContext.getNotifier().publish(new StatusChangeEvent(jobStatusMessage));
                    details.setJobID(jobId);
                    GFacUtils.updateJobStatus(jobExecutionContext, details, jobStatus);
                } catch (UnknownActivityIdentifierFault e) {
                    throw new GFacProviderException(e.getMessage(), e.getCause());
                }catch (GFacException e) {
                    throw new GFacProviderException(e.getMessage(), e.getCause());
                }

                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                }
                continue;
            }

            ActivityStatusType activityStatus = null;
            try {
                activityStatus = getStatus(factory, activityEpr);
            } catch (UnknownActivityIdentifierFault e) {
                throw new GFacProviderException(e.getMessage(), e.getCause());
            }

            log.info(formatStatusMessage(activityEpr.getAddress().getStringValue(), activityStatus.getState()
                    .toString()));

            if ((activityStatus.getState() == ActivityStateEnumeration.FAILED)) {
                String error = activityStatus.getFault().getFaultcode().getLocalPart() + "\n"
                        + activityStatus.getFault().getFaultstring() + "\n EXITCODE: " + activityStatus.getExitCode();
                log.info(error);
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                }
                dt.downloadStdOuts();
            } else if (activityStatus.getState() == ActivityStateEnumeration.CANCELLED) {
                String experimentID = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC);
                JobState jobStatus = JobState.CANCELED;
                String jobStatusMessage = "Status of job " + jobId + "is " + jobStatus;
                jobExecutionContext.getNotifier().publish(new StatusChangeEvent(jobStatusMessage));
                details.setJobID(jobId);
                try {
          GFacUtils.saveJobStatus(jobExecutionContext,details, jobStatus);
View Full Code Here

    @Subscribe
    public void updateRegistry(JobStatusChangeRequest jobStatus) {
        /* Here we need to parse the jobStatus message and update
                the registry accordingly, for now we are just printing to standard Out
                 */
        JobState state = jobStatus.getState();
        if (state != null) {
            try {
                String taskID = jobStatus.getIdentity().getTaskId();
                String jobID = jobStatus.getIdentity().getJobId();
                updateJobStatus(taskID, jobID, state);
            } catch (Exception e) {
                logger.error("Error persisting data" + e.getLocalizedMessage(), e);
            }
            logger.info("Job ID:" + jobStatus.getIdentity().getJobId() + " is "+state.toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.workspace.experiment.JobState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.