Search in sources :

Example 76 with TaskScript

use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.

the class TestDataspaceConcurrentKilling method createJobWithFileTransfers.

public Job createJobWithFileTransfers() throws UserException, InvalidScriptException {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(JOB_NAME);
    job.setOnTaskError(OnTaskError.CONTINUE_JOB_EXECUTION);
    for (int i = 0; i < NB_TASKS; i++) {
        ScriptTask st = new ScriptTask();
        st.setName(TASK_NAME + i);
        st.setScript(new TaskScript(new SimpleScript("new File(localspace, \"" + FILE_NAME + i + "\").createNewFile(); java.lang.Thread.sleep(1000)", "groovy")));
        st.addOutputFiles(FILE_NAME + i, OutputAccessMode.TransferToUserSpace);
        job.addTask(st);
    }
    return job;
}
Also used : ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript)

Example 77 with TaskScript

use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.

the class TestKillTaskWhileExecutingScripts method killEndlessScriptTask.

public void killEndlessScriptTask() throws Throwable {
    log("Test : killing an Endless Script Task...");
    String tname = "killEndlessScriptTask";
    // pre script interruption
    TaskFlowJob job = new TaskFlowJob();
    job.setName(this.getClass().getSimpleName() + "_" + tname);
    ScriptTask task1 = new ScriptTask();
    task1.setName(tname);
    task1.setScript(new TaskScript(endlessScript));
    job.addTask(task1);
    submitAndCheckJob(job, tname);
}
Also used : ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob)

Example 78 with TaskScript

use of org.ow2.proactive.scripting.TaskScript in project scheduling by ow2-proactive.

the class RunningTaskRecoveryWithDownNodeTest method submitJob.

private JobId submitJob() throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName("JOB-" + RunningTaskRecoveryWithDownNodeTest.class.getSimpleName());
    for (int i = 0; i < NUMBER_OF_TASKS; i++) {
        ScriptTask st1 = new ScriptTask();
        st1.setName(TASK_BASE_NAME + i);
        st1.setScript(new TaskScript(new SimpleScript("Thread.sleep(60000)", "groovy")));
        job.addTask(st1);
    }
    JobId jobid = schedulerHelper.submitJob(job);
    schedulerHelper.waitForEventJobRunning(jobid);
    return jobid;
}
Also used : ScriptTask(org.ow2.proactive.scheduler.common.task.ScriptTask) TaskScript(org.ow2.proactive.scripting.TaskScript) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) SimpleScript(org.ow2.proactive.scripting.SimpleScript) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Aggregations

TaskScript (org.ow2.proactive.scripting.TaskScript)78 SimpleScript (org.ow2.proactive.scripting.SimpleScript)76 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)64 Test (org.junit.Test)59 NodeDataSpacesURIs (org.ow2.proactive.scheduler.task.context.NodeDataSpacesURIs)31 TaskContext (org.ow2.proactive.scheduler.task.context.TaskContext)31 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)19 TaskLauncherInitializer (org.ow2.proactive.scheduler.task.TaskLauncherInitializer)19 InProcessTaskExecutor (org.ow2.proactive.scheduler.task.executors.InProcessTaskExecutor)19 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)12 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)11 Serializable (java.io.Serializable)10 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)10 File (java.io.File)9 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)9 TestTaskOutput (org.ow2.proactive.scheduler.task.TestTaskOutput)9 ForkedTaskExecutor (org.ow2.proactive.scheduler.task.executors.ForkedTaskExecutor)9 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)8 HashMap (java.util.HashMap)6 Semaphore (java.util.concurrent.Semaphore)5