use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class TestMultipleHostsRequest method testMultipleHostsRequest.
@Test
public void testMultipleHostsRequest() throws Throwable {
String task1Name = "task1";
switch(OperatingSystem.getOperatingSystem()) {
case windows:
// set system Property for executable path
System.setProperty(executablePathPropertyName, new File(executablePathWindows.toURI()).getAbsolutePath());
break;
case unix:
SchedulerTHelper.setExecutable(new File(executablePath.toURI()).getAbsolutePath());
// set system Property for executable path
System.setProperty(executablePathPropertyName, new File(executablePath.toURI()).getAbsolutePath());
break;
default:
throw new IllegalStateException("Unsupported operating system");
}
// test submission and event reception
TaskFlowJob job = (TaskFlowJob) StaxJobFactory.getFactory().createJob(new File(jobDescriptor.toURI()).getAbsolutePath());
JobId id = schedulerHelper.submitJob(job);
schedulerHelper.addExtraNodes(3);
log("Job submitted, id " + id.toString());
log("Waiting for jobSubmitted Event");
JobState receivedState = schedulerHelper.waitForEventJobSubmitted(id);
assertEquals(receivedState.getId(), id);
log("Waiting for job running");
JobInfo jInfo = schedulerHelper.waitForEventJobRunning(id);
assertEquals(jInfo.getJobId(), id);
assertEquals(JobStatus.RUNNING, jInfo.getStatus());
schedulerHelper.waitForEventTaskRunning(id, task1Name);
TaskInfo tInfo = schedulerHelper.waitForEventTaskFinished(id, task1Name);
log(schedulerHelper.getSchedulerInterface().getTaskResult(id, "task1").getOutput().getAllLogs(false));
assertEquals(TaskStatus.FINISHED, tInfo.getStatus());
schedulerHelper.waitForEventJobFinished(id);
JobResult res = schedulerHelper.getJobResult(id);
// check that there is one exception in results
assertTrue(res.getExceptionResults().isEmpty());
// remove job
schedulerHelper.removeJob(id);
schedulerHelper.waitForEventJobRemoved(id);
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class SchedulerFrontend method getTaskIds.
@Override
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException {
RestPageParameters params = new RestPageParameters(frontendState, "getTaskIds", from, to, mytasks, running, pending, finished, offset, limit, taskTag, SortSpecifierContainer.EMPTY_CONTAINER);
Page<TaskInfo> pTaskInfo;
pTaskInfo = dbManager.getTasks(params.getFrom(), params.getTo(), params.getTag(), params.getOffset(), params.getLimit(), params.getUserName(), params.isPending(), params.isRunning(), params.isFinished());
List<TaskId> lTaskId = new ArrayList<TaskId>(pTaskInfo.getList().size());
for (TaskInfo taskInfo : pTaskInfo.getList()) {
lTaskId.add(taskInfo.getTaskId());
}
return new Page<TaskId>(lTaskId, pTaskInfo.getSize());
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class ClientJobState method update.
@Override
public void update(JobInfo info) {
if (!getId().equals(info.getJobId())) {
throw new IllegalArgumentException("This job info is not applicable for this job. (expected id is '" + getId() + "' but was '" + info.getJobId() + "'");
}
// update job info
this.jobInfo = new JobInfoImpl((JobInfoImpl) info);
// update skipped tasks
if (this.jobInfo.getTasksSkipped() != null) {
for (TaskId id : tasks.keySet()) {
if (this.jobInfo.getTasksSkipped().contains(id)) {
TaskInfoImpl taskInfo = (TaskInfoImpl) tasks.get(id).getTaskInfo();
taskInfo.setStatus(TaskStatus.SKIPPED);
}
}
}
// additions and modifications can be caused by control flow actions
if (this.jobInfo.getModifiedTasks() != null) {
addTasks(this.jobInfo.getModifiedTasks());
}
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class RestSmartProxyTest method testInErrorEventsReception.
@Test(timeout = TEN_MINUTES)
public void testInErrorEventsReception() throws Exception {
System.out.println("Begin testInErrorEventsReception ");
TaskFlowJob job = createInErrorJob();
final Semaphore semaphore = new Semaphore(0);
printJobXmlRepresentation(job);
final MutableBoolean taskHasBeenInError = new MutableBoolean(false);
final MutableBoolean taskMarkedAsFinished = new MutableBoolean(false);
SchedulerEventListenerExtended listener = new SchedulerEventListenerExtended() {
@Override
public void schedulerStateUpdatedEvent(SchedulerEvent eventType) {
System.out.println("RestSmartProxyTest.schedulerStateUpdatedEvent " + eventType);
}
@Override
public void jobSubmittedEvent(JobState job) {
System.out.println("RestSmartProxyTest.jobSubmittedEvent");
}
@Override
public void jobStateUpdatedEvent(NotificationData<JobInfo> notification) {
JobStatus status = notification.getData().getStatus();
System.out.println("RestSmartProxyTest.jobStateUpdatedEvent, eventType=" + notification.getEventType() + ", jobStatus=" + status);
if (status == JobStatus.IN_ERROR) {
semaphore.release();
}
}
@Override
public void taskStateUpdatedEvent(NotificationData<TaskInfo> notification) {
TaskStatus status = notification.getData().getStatus();
System.out.println("RestSmartProxyTest.taskStateUpdatedEvent, taskStatus=" + status);
if (status == TaskStatus.WAITING_ON_ERROR || status == TaskStatus.IN_ERROR) {
// IN_ERROR previously
taskHasBeenInError.setTrue();
}
if (status == TaskStatus.FINISHED && taskHasBeenInError.isTrue()) {
taskMarkedAsFinished.setTrue();
}
}
@Override
public void usersUpdatedEvent(NotificationData<UserIdentification> notification) {
System.out.println("RestSmartProxyTest.usersUpdatedEvent " + notification.getData());
}
@Override
public void pullDataFinished(String jobId, String taskName, String localFolderPath) {
System.out.println("RestSmartProxyTest.pullDataFinished");
}
@Override
public void pullDataFailed(String jobId, String taskName, String remoteFolder_URL, Throwable t) {
System.out.println("RestSmartProxyTest.pullDataFailed");
}
@Override
public void jobUpdatedFullDataEvent(JobState job) {
System.out.println("RestSmartProxyTest.jobUpdatedFullDataEvent");
}
};
restSmartProxy.addEventListener(listener);
JobId jobId = restSmartProxy.submit(job, inputLocalFolder.getAbsolutePath(), pushUrl, outputLocalFolder.getAbsolutePath(), pullUrl, false, false);
// the next line blocks until jobStateUpdatedEvent is called on the
// listener
// with job status set to IN_ERROR
semaphore.acquire();
String jobIdAsString = jobId.value();
System.out.println("Finish in-error task");
restSmartProxy.finishInErrorTask(jobIdAsString, inerrorTaskName);
waitForJobFinishState(jobIdAsString);
assertThat(taskHasBeenInError.booleanValue()).isTrue();
assertThat(taskMarkedAsFinished.booleanValue()).isTrue();
System.out.println("End testInErrorEventsReception");
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class DataUtility method taskInfo.
public static TaskInfo taskInfo(TaskInfoData d) {
TaskInfoImpl impl = new TaskInfoImpl();
JobIdData jobIdData = d.getJobId();
if (jobIdData != null) {
JobId jobId = jobId(jobIdData);
impl.setJobId(jobId);
TaskId taskId = taskId(jobId, d.getTaskId());
impl.setTaskId(taskId);
}
impl.setExecutionDuration(d.getExecutionDuration());
impl.setExecutionHostName(d.getExecutionHostName());
impl.setInErrorTime(d.getInErrorTime());
impl.setFinishedTime(d.getFinishedTime());
impl.setNumberOfExecutionLeft(d.getNumberOfExecutionLeft());
impl.setNumberOfExecutionOnFailureLeft(d.getNumberOfExecutionOnFailureLeft());
impl.setStartTime(d.getStartTime());
impl.setStatus(TaskStatus.valueOf(d.getTaskStatus().name()));
impl.setName(d.getTaskId().getReadableName());
impl.setProgress(d.getProgress());
return impl;
}
Aggregations