use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class InProcessTaskExecutorTest method scriptArguments.
@Test
public void scriptArguments() throws Throwable {
TestTaskOutput taskOutput = new TestTaskOutput();
TaskLauncherInitializer initializer = new TaskLauncherInitializer();
String printEnvVariables = "print(args[0])";
initializer.setPreScript(new SimpleScript(printEnvVariables, "groovy", new Serializable[] { "Hello" }));
initializer.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(1000, "job"), "task", 42L));
new InProcessTaskExecutor().execute(new TaskContext(new ScriptExecutableContainer(new TaskScript(new SimpleScript("", "groovy"))), initializer, null, new NodeDataSpacesURIs("", "", "", "", "", ""), "", ""), taskOutput.outputStream, taskOutput.error);
assertEquals("Hello", taskOutput.output());
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class JobData method toJobInfo.
JobInfo toJobInfo() {
JobId jobIdInstance = new JobIdImpl(getId(), getJobName());
JobInfoImpl jobInfo = createJobInfo(jobIdInstance);
return jobInfo;
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class JobData method toInternalJob.
InternalJob toInternalJob() {
JobId jobIdInstance = new JobIdImpl(getId(), getJobName());
JobInfoImpl jobInfo = createJobInfo(jobIdInstance);
InternalJob internalJob = new InternalTaskFlowJob();
internalJob.setCredentials(getCredentials());
internalJob.setJobInfo(jobInfo);
internalJob.setGenericInformation(getGenericInformation());
internalJob.setVariables(variablesToJobVariables());
internalJob.setProjectName(getProjectName());
internalJob.setOwner(getOwner());
internalJob.setDescription(getDescription());
internalJob.setInputSpace(getInputSpace());
internalJob.setOutputSpace(getOutputSpace());
internalJob.setGlobalSpace(getGlobalSpace());
internalJob.setUserSpace(getGlobalSpace());
internalJob.setMaxNumberOfExecution(getMaxNumberOfExecution());
internalJob.setOnTaskError(OnTaskError.getInstance(this.onTaskErrorString));
internalJob.setScheduledTimeForRemoval(getScheduledTimeForRemoval());
return internalJob;
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class JobData method toJobUsage.
JobUsage toJobUsage() {
JobIdImpl jobId = new JobIdImpl(getId(), getJobName());
JobUsage jobUsage = new JobUsage(getOwner(), getProjectName(), jobId.value(), getJobName(), getFinishedTime() - getStartTime());
for (TaskData taskData : getTasks()) {
TaskUsage taskUsage = taskData.toTaskUsage(jobId);
jobUsage.add(taskUsage);
}
return jobUsage;
}
use of org.ow2.proactive.scheduler.job.JobIdImpl in project scheduling by ow2-proactive.
the class TaskData method createTaskInfo.
TaskInfoImpl createTaskInfo(JobIdImpl jobId) {
TaskId taskId = TaskIdImpl.createTaskId(jobId, getTaskName(), getId().getTaskId(), getTag());
TaskInfoImpl taskInfo = new TaskInfoImpl();
taskInfo.setTaskId(taskId);
taskInfo.setStatus(getTaskStatus());
taskInfo.setStartTime(getStartTime());
taskInfo.setProgress(0);
taskInfo.setInErrorTime(getInErrorTime());
taskInfo.setNumberOfExecutionOnFailureLeft(getNumberOfExecutionOnFailureLeft());
taskInfo.setNumberOfExecutionLeft(getNumberOfExecutionLeft());
taskInfo.setJobInfo(getJobData().toJobInfo());
taskInfo.setJobId(jobId);
taskInfo.setFinishedTime(getFinishedTime());
taskInfo.setScheduledTime(getScheduledTime());
taskInfo.setExecutionHostName(getExecutionHostName());
taskInfo.setExecutionDuration(getExecutionDuration());
return taskInfo;
}
Aggregations