Search in sources :

Example 1 with TaskDataSpaceApplication

use of org.ow2.proactive.scheduler.job.TaskDataSpaceApplication in project scheduling by ow2-proactive.

the class SchedulerDataspace method init.

public void init(JobId jobId, TaskId taskId, String user) throws Exception {
    dataSpaceServiceStarter = DataSpaceServiceStarter.getDataSpaceServiceStarter();
    dataSpaceServiceStarter.startNamingService();
    taskDataSpaceApplication = new TaskDataSpaceApplication(taskId.toString(), dataSpaceServiceStarter.getNamingService());
    taskDataSpaceApplication.startDataSpaceApplication(null, null, null, null, user, jobId);
}
Also used : TaskDataSpaceApplication(org.ow2.proactive.scheduler.job.TaskDataSpaceApplication)

Example 2 with TaskDataSpaceApplication

use of org.ow2.proactive.scheduler.job.TaskDataSpaceApplication in project scheduling by ow2-proactive.

the class TestDataSpaceConfiguration method runStarter.

public Boolean runStarter() throws Exception {
    File spFile = new File(IOSPACE);
    File spFileWithUserDir = new File(IOSPACE, username);
    spFile.mkdirs();
    spFileWithUserDir.mkdirs();
    spFileWithUserDir.deleteOnExit();
    spFile.deleteOnExit();
    filesServerIn = new FileSystemServerDeployer("space", IOSPACE, true, true);
    String[] spaceurls = filesServerIn.getVFSRootURLs();
    String[] userdirUrls = DataSpaceServiceStarter.urlsWithUserDir(spaceurls, username);
    ArrayList<String> expected = new ArrayList<>();
    expected.addAll(Arrays.asList(spaceurls));
    ArrayList<String> expectedWithUserDir = new ArrayList<>();
    expectedWithUserDir.addAll(Arrays.asList(userdirUrls));
    PASchedulerProperties.DATASPACE_DEFAULTINPUT_URL.updateProperty(DataSpaceServiceStarter.urlsToDSConfigProperty(spaceurls));
    PASchedulerProperties.DATASPACE_DEFAULTINPUT_LOCALPATH.updateProperty(IOSPACE);
    PASchedulerProperties.DATASPACE_DEFAULTINPUT_HOSTNAME.updateProperty(HOSTNAME);
    PASchedulerProperties.DATASPACE_DEFAULTOUTPUT_URL.updateProperty(DataSpaceServiceStarter.urlsToDSConfigProperty(spaceurls));
    PASchedulerProperties.DATASPACE_DEFAULTOUTPUT_LOCALPATH.updateProperty(IOSPACE);
    PASchedulerProperties.DATASPACE_DEFAULTOUTPUT_HOSTNAME.updateProperty(HOSTNAME);
    PASchedulerProperties.DATASPACE_DEFAULTGLOBAL_URL.updateProperty(DataSpaceServiceStarter.urlsToDSConfigProperty(spaceurls));
    PASchedulerProperties.DATASPACE_DEFAULTGLOBAL_LOCALPATH.updateProperty(IOSPACE);
    PASchedulerProperties.DATASPACE_DEFAULTGLOBAL_HOSTNAME.updateProperty(HOSTNAME);
    PASchedulerProperties.DATASPACE_DEFAULTUSER_URL.updateProperty(DataSpaceServiceStarter.urlsToDSConfigProperty(spaceurls));
    PASchedulerProperties.DATASPACE_DEFAULTUSER_LOCALPATH.updateProperty(IOSPACE);
    PASchedulerProperties.DATASPACE_DEFAULTUSER_HOSTNAME.updateProperty(HOSTNAME);
    DataSpaceServiceStarter dsServiceStarter = DataSpaceServiceStarter.getDataSpaceServiceStarter();
    dsServiceStarter.startNamingService();
    Set<SpaceInstanceInfo> predefinedSpaces = new HashSet<>();
    NamingService namingService = dsServiceStarter.getNamingService();
    TaskDataSpaceApplication jdsa = new TaskDataSpaceApplication(appid, dsServiceStarter.getNamingService());
    jdsa.startDataSpaceApplication(null, null, null, null, username, null);
    DataSpacesNodes.configureApplication(PAActiveObject.getNode(), appid, dsServiceStarter.getNamingServiceURL());
    DataSpacesFileObject INPUT = PADataSpaces.resolveDefaultInput();
    DataSpacesFileObject OUTPUT = PADataSpaces.resolveDefaultOutput();
    DataSpacesFileObject GLOBAL = PADataSpaces.resolveOutput(SchedulerConstants.GLOBALSPACE_NAME);
    DataSpacesFileObject USER = PADataSpaces.resolveOutput(SchedulerConstants.USERSPACE_NAME);
    Assert.assertEquals(expectedWithUserDir, INPUT.getAllRealURIs());
    Assert.assertEquals(expectedWithUserDir, OUTPUT.getAllRealURIs());
    Assert.assertEquals(expected, GLOBAL.getAllRealURIs());
    Assert.assertEquals(expectedWithUserDir, USER.getAllRealURIs());
    jdsa.terminateDataSpaceApplication();
    return true;
}
Also used : FileSystemServerDeployer(org.objectweb.proactive.extensions.vfsprovider.FileSystemServerDeployer) DataSpaceServiceStarter(org.ow2.proactive.scheduler.core.DataSpaceServiceStarter) SpaceInstanceInfo(org.objectweb.proactive.extensions.dataspaces.core.SpaceInstanceInfo) DataSpacesFileObject(org.objectweb.proactive.extensions.dataspaces.api.DataSpacesFileObject) ArrayList(java.util.ArrayList) TaskDataSpaceApplication(org.ow2.proactive.scheduler.job.TaskDataSpaceApplication) NamingService(org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService) File(java.io.File) HashSet(java.util.HashSet)

Example 3 with TaskDataSpaceApplication

use of org.ow2.proactive.scheduler.job.TaskDataSpaceApplication in project scheduling by ow2-proactive.

the class InternalJob method startDataSpaceApplication.

/**
 * Start dataspace configuration and application
 */
public void startDataSpaceApplication(NamingService namingService, List<InternalTask> tasks) {
    if (taskDataSpaceApplications == null) {
        taskDataSpaceApplications = new HashMap<>();
    }
    for (InternalTask internalTask : tasks) {
        long taskId = internalTask.getId().longValue();
        // if a task restart due to a failure for instance
        if (!taskDataSpaceApplications.containsKey(taskId)) {
            String appId = internalTask.getId().toString();
            TaskDataSpaceApplication taskDataSpaceApplication = new TaskDataSpaceApplication(appId, namingService);
            taskDataSpaceApplications.put(taskId, taskDataSpaceApplication);
            taskDataSpaceApplication.startDataSpaceApplication(getInputSpace(), getOutputSpace(), getGlobalSpace(), getUserSpace(), getOwner(), getId());
        }
    }
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask)

Aggregations

TaskDataSpaceApplication (org.ow2.proactive.scheduler.job.TaskDataSpaceApplication)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 DataSpacesFileObject (org.objectweb.proactive.extensions.dataspaces.api.DataSpacesFileObject)1 SpaceInstanceInfo (org.objectweb.proactive.extensions.dataspaces.core.SpaceInstanceInfo)1 NamingService (org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService)1 FileSystemServerDeployer (org.objectweb.proactive.extensions.vfsprovider.FileSystemServerDeployer)1 DataSpaceServiceStarter (org.ow2.proactive.scheduler.core.DataSpaceServiceStarter)1 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)1