use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class WorkflowInterpreter method taskStatusChanged.
@Subscribe
public void taskStatusChanged(TaskStatusChangeEvent taskStatus) {
String taskId = taskStatus.getTaskIdentity().getTaskId();
if (isTaskAwaiting(taskId)) {
WorkflowNodeState state = WorkflowNodeState.UNKNOWN;
Node node = getAwaitingNodeForTask(taskId);
switch(taskStatus.getState()) {
case CANCELED:
;
break;
case COMPLETED:
// but we'll wait for outputdata
break;
case CONFIGURING_WORKSPACE:
break;
case FAILED:
state = WorkflowNodeState.FAILED;
node.setState(NodeExecutionState.FAILED);
break;
case EXECUTING:
case WAITING:
case PRE_PROCESSING:
case POST_PROCESSING:
case OUTPUT_DATA_STAGING:
case INPUT_DATA_STAGING:
state = WorkflowNodeState.EXECUTING;
node.setState(NodeExecutionState.EXECUTING);
break;
case STARTED:
break;
case CANCELING:
state = WorkflowNodeState.CANCELING;
break;
default:
break;
}
try {
if (state != WorkflowNodeState.UNKNOWN) {
updateWorkflowNodeStatus(nodeInstanceList.get(node), state);
}
} catch (RegistryException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class WorkflowEngineImpl method launchExperiment.
@Override
public void launchExperiment(String experimentId, String token) throws WorkflowEngineException {
try {
ExperimentCatalog experimentCatalog = RegistryFactory.getDefaultExpCatalog();
Experiment experiment = (Experiment) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
WorkflowCatalog workflowCatalog = WorkflowCatalogFactory.getWorkflowCatalog();
WorkflowInterpreterConfiguration config = new WorkflowInterpreterConfiguration(new Workflow(workflowCatalog.getWorkflow(experiment.getApplicationId()).getGraph()));
final WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(experiment, token, config, getOrchestratorClient(), rabbitMQPublisher);
new Thread() {
public void run() {
try {
workflowInterpreter.scheduleDynamically();
} catch (WorkflowException e) {
logger.error(e.getMessage(), e);
} catch (RegistryException e) {
logger.error(e.getMessage(), e);
} catch (AiravataException e) {
logger.error(e.getMessage(), e);
}
}
}.start();
} catch (Exception e) {
logger.error("Error while retrieving the experiment", e);
WorkflowEngineException exception = new WorkflowEngineException("Error while launching the workflow experiment. More info : " + e.getMessage());
throw exception;
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class QueueStatusResourceTest method test.
@Test
public void test() {
QueueStatusResource queueStatusResource1 = new QueueStatusResource();
queueStatusResource1.setHostName("bigred2.uits.iu.edu");
queueStatusResource1.setQueueName("cpu");
queueStatusResource1.setTime((long) 1 + System.currentTimeMillis());
queueStatusResource1.setQueueUp(true);
queueStatusResource1.setRunningJobs(3);
queueStatusResource1.setQueuedJobs(4);
try {
queueStatusResource1.save();
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
QueueStatusResource queueStatusResource2 = new QueueStatusResource();
queueStatusResource2.setHostName("bigred2.uits.iu.edu");
queueStatusResource2.setQueueName("cpu");
queueStatusResource2.setTime((long) 2 + System.currentTimeMillis());
queueStatusResource2.setQueueUp(true);
queueStatusResource2.setRunningJobs(33);
queueStatusResource2.setQueuedJobs(44);
try {
queueStatusResource2.save();
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
try {
List<ExperimentCatResource> experimentCatResources = queueStatusResource1.get(ResourceType.QUEUE_STATUS);
Assert.assertTrue(experimentCatResources.size() == 1);
QueueStatusResource queueStatusResource = (QueueStatusResource) experimentCatResources.get(0);
Assert.assertEquals(queueStatusResource2.getTime(), queueStatusResource.getTime());
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method getJob.
public Object getJob(CompositeIdentifier cis, String fieldName) throws RegistryException {
String taskId = (String) cis.getTopLevelIdentifier();
String jobId = (String) cis.getSecondLevelIdentifier();
try {
TaskResource taskResource = new TaskResource();
taskResource.setTaskId(taskId);
JobResource resource = taskResource.getJob(jobId);
if (fieldName == null) {
return ThriftDataModelConversion.getJobModel(resource);
} else if (fieldName.equals(Constants.FieldConstants.JobConstants.JOB_STATUS)) {
return ThriftDataModelConversion.getJobStatus(resource.getJobStatus());
} else {
logger.error("Unsupported field name for job basic data..");
}
} catch (Exception e) {
logger.error("Error while getting job data..", e);
throw new RegistryException(e);
}
return null;
}
use of org.apache.airavata.registry.cpi.RegistryException in project airavata by apache.
the class ExperimentRegistry method addExpInputs.
public String addExpInputs(List<InputDataObjectType> exInputs, String experimentId) throws RegistryException {
try {
for (InputDataObjectType input : exInputs) {
ExperimentInputResource resource = new ExperimentInputResource();
resource.setExperimentId(experimentId);
resource.setInputName(input.getName());
resource.setInputValue(input.getValue());
if (input.getType() != null) {
resource.setDataType(input.getType().toString());
}
resource.setMetadata(input.getMetaData());
resource.setApplicationArgument(input.getApplicationArgument());
resource.setInputOrder(input.getInputOrder());
resource.setIsRequired(input.isIsRequired());
resource.setRequiredToAddedToCmd(input.isRequiredToAddedToCommandLine());
resource.setStorageResourceId(input.getStorageResourceId());
resource.setIsReadOnly(input.isIsReadOnly());
resource.save();
}
} catch (Exception e) {
logger.error("Unable to save experiment inputs", e);
throw new RegistryException(e);
}
return experimentId;
}
Aggregations