use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class InternalTask method getDefaultTaskLauncherInitializer.
/**
* Prepare and return the default task launcher initializer (ie the one that works for every launcher)<br>
* Concrete launcher may have to add values to the created initializer to bring more information to the launcher.
*
* @return the default created task launcher initializer
*/
protected TaskLauncherInitializer getDefaultTaskLauncherInitializer() {
TaskLauncherInitializer tli = new TaskLauncherInitializer();
tli.setTaskId(getId());
tli.setJobOwner(internalJob.getJobInfo().getJobOwner());
tli.setSchedulerRestUrl(PASchedulerProperties.SCHEDULER_REST_URL.getValueAsStringOrNull());
tli.setCatalogRestUrl(PASchedulerProperties.CATALOG_REST_URL.getValueAsStringOrNull());
tli.setPreScript(getPreScript());
tli.setPostScript(getPostScript());
tli.setControlFlowScript(getFlowScript());
tli.setTaskInputFiles(getInputFilesList());
tli.setTaskOutputFiles(getOutputFilesList());
tli.setNamingService(internalJob.getTaskDataSpaceApplications().get(getId().longValue()).getNamingServiceStub());
tli.setIterationIndex(getIterationIndex());
tli.setReplicationIndex(getReplicationIndex());
Map<String, String> gInfo = getRuntimeGenericInformation();
tli.setGenericInformation(gInfo);
ForkEnvironment environment = getForkEnvironment();
if (environment != null) {
Script environmentScript = environment.getEnvScript();
if ((environmentScript != null) && !isScriptAuthorized(getId(), environmentScript)) {
tli.setAuthorizedForkEnvironmentScript(false);
}
}
tli.setForkEnvironment(getForkEnvironment());
if (isWallTimeSet()) {
tli.setWalltime(wallTime);
}
tli.setPreciousLogs(isPreciousLogs());
tli.setJobVariables(internalJob.getVariables());
tli.setTaskVariables(getVariables());
tli.setPingPeriod(PASchedulerProperties.SCHEDULER_NODE_PING_FREQUENCY.getValueAsInt());
tli.setPingAttempts(PASchedulerProperties.SCHEDULER_NODE_PING_ATTEMPTS.getValueAsInt());
return tli;
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class ServerJobAndTaskLogs method getJobLog.
public static String getJobLog(JobId jobId, Set<TaskId> tasks) {
String jobLog = readLog(JobLogger.getJobLogRelativePath(jobId));
if (jobLog == null) {
return "Cannot retrieve logs for job " + jobId;
}
StringBuilder result = new StringBuilder();
result.append("================= Job ").append(jobId).append(" logs =================\n");
result.append(jobLog);
for (TaskId taskId : tasks) {
result.append("\n================ Task ").append(taskId).append(" logs =================\n");
result.append(getTaskLog(taskId));
}
return result.toString();
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class SubmitJob method taskStateUpdatedEvent.
public void taskStateUpdatedEvent(NotificationData<TaskInfo> notif) {
try {
System.out.println("Task '" + notif.getData().getTaskId() + "' result received !!");
TaskResult result = user.getTaskResult(notif.getData().getJobId(), notif.getData().getTaskId().getReadableName());
terminated++;
System.out.println("(" + terminated + ")Result value = " + result.value());
} catch (Throwable t) {
t.printStackTrace();
}
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class TestGetUsers method createJob.
private TaskFlowJob createJob() throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(this.getClass().getSimpleName());
JavaTask task = new JavaTask();
task.setExecutableClassName(EmptyExecutable.class.getName());
job.addTask(task);
return job;
}
use of org.ow2.proactive.scheduler.common.task.Task in project scheduling by ow2-proactive.
the class TestJobInstantGetTaskResult method testJobInstantGetTaskResult.
@Test
public void testJobInstantGetTaskResult() throws Throwable {
// create Scheduler client as an active object
SubmitJob client = (SubmitJob) PAActiveObject.newActive(SubmitJob.class.getName(), new Object[] {});
// begin to use the client : must be a futur result in order to start the scheduler at next step
client.begin();
// create job
TaskFlowJob job = new TaskFlowJob();
for (int i = 0; i < 50; i++) {
JavaTask t = new JavaTask();
t.setExecutableClassName(ResultAsArray.class.getName());
t.setName("task" + i);
job.addTask(t);
}
JobId id = schedulerHelper.submitJob(job);
client.setJobId(id);
schedulerHelper.waitForEventJobRemoved(id);
PAActiveObject.terminateActiveObject(client, true);
}
Aggregations