Search in sources :

Example 1 with TaskDescription

use of es.bsc.compss.types.TaskDescription in project compss by bsc-wdc.

the class ScoresTest method testImplementationScores.

@SuppressWarnings("unchecked")
@Test
public void testImplementationScores() throws BlockedActionException, UnassignedActionException {
    drs1.clear();
    // No resources and no dependencies
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(4));
    TaskDescription tp1 = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[0]);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 0, 0, 0, 0);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, 0, CORE4_0, 0);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
    Verifiers.validateBetterScore(score1_0, score1_1, true);
    // Resources with load
    FakeAllocatableAction action2 = new FakeAllocatableAction(fao, 2, 0, CoreManager.getCoreImplementations(0));
    action2.selectExecution(drs1, (FakeImplementation) action2.getImplementations()[0]);
    drs1.scheduleAction(action2);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, 0, CORE4_1, 0);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    FakeAllocatableAction action3 = new FakeAllocatableAction(fao, 3, 0, CoreManager.getCoreImplementations(2));
    action3.selectExecution(drs1, (FakeImplementation) action3.getImplementations()[0]);
    drs1.scheduleAction(action3);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 0, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 0, CORE2, CORE4_1, CORE2);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    // Data Dependencies
    FakeAllocatableAction action10 = new FakeAllocatableAction(fao, 10, 0, CoreManager.getCoreImplementations(0));
    action10.selectExecution(drs2, (FakeImplementation) action10.getImplementations()[0]);
    FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi10 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action10.getSchedulingInfo();
    dsi10.setExpectedEnd(10);
    action1.addDataPredecessor(action10);
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 10, 0, 0, 10);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 10, CORE0, CORE4_0, CORE0);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 10, CORE2, CORE4_1, CORE2);
    Verifiers.validateBetterScore(score1_0, score1_1, false);
    FakeAllocatableAction action11 = new FakeAllocatableAction(fao, 11, 0, CoreManager.getCoreImplementations(0));
    action11.selectExecution(drs2, (FakeImplementation) action11.getImplementations()[0]);
    FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation> dsi11 = (FullGraphSchedulingInformation<FakeProfile, FakeResourceDescription, FakeImplementation>) action11.getSchedulingInfo();
    dsi11.setExpectedEnd(10_000);
    action1.addDataPredecessor(action11);
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    Verifiers.verifyScore(score1, 0, 10_000, 0, 0, 10_000);
    score1_0 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[0], score1);
    Verifiers.verifyScore(score1_0, 0, 10_000, CORE0, CORE4_0, 10_000);
    score1_1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateImplementationScore(action1, tp1, action1.getImplementations()[1], score1);
    Verifiers.verifyScore(score1_1, 0, 10_000, CORE2, CORE4_1, 10_000);
    Verifiers.validateBetterScore(score1_0, score1_1, true);
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FullGraphScore(es.bsc.es.bsc.compss.scheduler.types.FullGraphScore) FullGraphSchedulingInformation(es.bsc.es.bsc.compss.scheduler.fullGraphScheduler.FullGraphSchedulingInformation) TaskDescription(es.bsc.compss.types.TaskDescription) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) Test(org.junit.Test)

Example 2 with TaskDescription

use of es.bsc.compss.types.TaskDescription in project compss by bsc-wdc.

the class ScoresTest method testResourceScores.

@SuppressWarnings("unchecked")
@Test
public void testResourceScores() throws BlockedActionException, UnassignedActionException, Exception {
    drs1.clear();
    FakeAllocatableAction action1 = new FakeAllocatableAction(fao, 1, 0, CoreManager.getCoreImplementations(0));
    DataInstanceId d1v1 = new DataInstanceId(1, 1);
    Comm.registerData(d1v1.getRenaming());
    DataInstanceId d2v2 = new DataInstanceId(2, 2);
    Comm.registerData(d2v2.getRenaming());
    DependencyParameter dpD1V1 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
    dpD1V1.setDataAccessId(new RAccessId(1, 1));
    DependencyParameter dpD2V2 = new DependencyParameter(DataType.FILE_T, Direction.IN, Stream.UNSPECIFIED, Constants.PREFIX_EMTPY);
    dpD2V2.setDataAccessId(new RAccessId(2, 2));
    TaskDescription params = new TaskDescription("task", false, Constants.SINGLE_NODE, false, false, false, false, new Parameter[] { dpD1V1, dpD2V2 });
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> actionScore = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) ds.generateActionScore(action1);
    FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation> score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 2 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.registerLocation(d1v1.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/a")));
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 1 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.registerLocation(d2v2.getRenaming(), DataLocation.createLocation(drs1.getResource(), new SimpleURI("/home/test/b")));
    score1 = (FullGraphScore<FakeProfile, FakeResourceDescription, FakeImplementation>) drs1.generateResourceScore(action1, params, actionScore);
    Verifiers.verifyScore(score1, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY, 0, 0, 0 * FullGraphResourceScheduler.DATA_TRANSFER_DELAY);
    Comm.removeData(d1v1.getRenaming());
    Comm.removeData(d2v2.getRenaming());
}
Also used : FakeProfile(es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile) DataInstanceId(es.bsc.compss.types.data.DataInstanceId) FakeImplementation(es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation) FullGraphScore(es.bsc.es.bsc.compss.scheduler.types.FullGraphScore) RAccessId(es.bsc.compss.types.data.DataAccessId.RAccessId) TaskDescription(es.bsc.compss.types.TaskDescription) FakeResourceDescription(es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription) FakeAllocatableAction(es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction) SimpleURI(es.bsc.compss.types.uri.SimpleURI) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) Test(org.junit.Test)

Example 3 with TaskDescription

use of es.bsc.compss.types.TaskDescription in project compss by bsc-wdc.

the class TaskAnalyser method processTask.

/**
 * Process the dependencies of a new task @currentTask
 *
 * @param currentTask
 */
public void processTask(Task currentTask) {
    TaskDescription params = currentTask.getTaskDescription();
    LOGGER.info("New " + (params.getType() == TaskType.METHOD ? "method" : "service") + " task(" + params.getName() + "), ID = " + currentTask.getId());
    if (drawGraph) {
        addNewTask(currentTask);
    }
    // Update task count
    Integer methodId = params.getId();
    Integer actualCount = currentTaskCount.get(methodId);
    if (actualCount == null) {
        actualCount = 0;
    }
    currentTaskCount.put(methodId, actualCount + 1);
    // Update app id task count
    Long appId = currentTask.getAppId();
    Integer taskCount = appIdToTaskCount.get(appId);
    if (taskCount == null) {
        taskCount = 0;
    }
    taskCount++;
    appIdToTaskCount.put(appId, taskCount);
    Integer totalTaskCount = appIdToTotalTaskCount.get(appId);
    if (totalTaskCount == null) {
        totalTaskCount = 0;
    }
    totalTaskCount++;
    appIdToTotalTaskCount.put(appId, totalTaskCount);
    // Check scheduling enforcing data
    int constrainingParam = -1;
    if (params.getType() == TaskType.SERVICE && params.hasTargetObject()) {
        if (params.hasReturnValue()) {
            constrainingParam = params.getParameters().length - 2;
        } else {
            constrainingParam = params.getParameters().length - 1;
        }
    }
    Parameter[] parameters = params.getParameters();
    for (int paramIdx = 0; paramIdx < parameters.length; paramIdx++) {
        Parameter p = parameters[paramIdx];
        if (DEBUG) {
            LOGGER.debug("* Parameter : " + p);
        }
        // Conversion: direction -> access mode
        AccessMode am = AccessMode.R;
        switch(p.getDirection()) {
            case IN:
                am = AccessMode.R;
                break;
            case OUT:
                am = AccessMode.W;
                break;
            case INOUT:
                am = AccessMode.RW;
                break;
        }
        // Inform the Data Manager about the new accesses
        DataAccessId daId;
        switch(p.getType()) {
            case FILE_T:
                FileParameter fp = (FileParameter) p;
                daId = DIP.registerFileAccess(am, fp.getLocation());
                break;
            case PSCO_T:
                ObjectParameter pscop = (ObjectParameter) p;
                // Check if its PSCO class and persisted to infer its type
                pscop.setType(DataType.PSCO_T);
                daId = DIP.registerObjectAccess(am, pscop.getValue(), pscop.getCode());
                break;
            case EXTERNAL_OBJECT_T:
                ExternalObjectParameter externalPSCOparam = (ExternalObjectParameter) p;
                // Check if its PSCO class and persisted to infer its type
                externalPSCOparam.setType(DataType.EXTERNAL_OBJECT_T);
                daId = DIP.registerExternalObjectAccess(am, externalPSCOparam.getId(), externalPSCOparam.getCode());
                break;
            case OBJECT_T:
                ObjectParameter op = (ObjectParameter) p;
                // Check if its PSCO class and persisted to infer its type
                if (op.getValue() instanceof StubItf && ((StubItf) op.getValue()).getID() != null) {
                    op.setType(DataType.PSCO_T);
                }
                daId = DIP.registerObjectAccess(am, op.getValue(), op.getCode());
                break;
            default:
                /*
                     * Basic types (including String). The only possible access mode is R (already checked by the API)
                     */
                continue;
        }
        // Add dependencies to the graph and register output values for future dependencies
        DependencyParameter dp = (DependencyParameter) p;
        dp.setDataAccessId(daId);
        switch(am) {
            case R:
                checkDependencyForRead(currentTask, dp);
                if (paramIdx == constrainingParam) {
                    DataAccessId.RAccessId raId = (DataAccessId.RAccessId) dp.getDataAccessId();
                    DataInstanceId dependingDataId = raId.getReadDataInstance();
                    if (dependingDataId != null) {
                        if (dependingDataId.getVersionId() > 1) {
                            currentTask.setEnforcingTask(writers.get(dependingDataId.getDataId()));
                        }
                    }
                }
                break;
            case RW:
                checkDependencyForRead(currentTask, dp);
                if (paramIdx == constrainingParam) {
                    DataAccessId.RWAccessId raId = (DataAccessId.RWAccessId) dp.getDataAccessId();
                    DataInstanceId dependingDataId = raId.getReadDataInstance();
                    if (dependingDataId != null) {
                        if (dependingDataId.getVersionId() > 1) {
                            currentTask.setEnforcingTask(writers.get(dependingDataId.getDataId()));
                        }
                    }
                }
                registerOutputValues(currentTask, dp);
                break;
            case W:
                registerOutputValues(currentTask, dp);
                break;
        }
    }
}
Also used : DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) RWAccessId(es.bsc.compss.types.data.DataAccessId.RWAccessId) DataInstanceId(es.bsc.compss.types.data.DataInstanceId) TaskDescription(es.bsc.compss.types.TaskDescription) ExternalObjectParameter(es.bsc.compss.types.parameter.ExternalObjectParameter) RWAccessId(es.bsc.compss.types.data.DataAccessId.RWAccessId) ExternalObjectParameter(es.bsc.compss.types.parameter.ExternalObjectParameter) ObjectParameter(es.bsc.compss.types.parameter.ObjectParameter) StubItf(storage.StubItf) ExternalObjectParameter(es.bsc.compss.types.parameter.ExternalObjectParameter) ObjectParameter(es.bsc.compss.types.parameter.ObjectParameter) FileParameter(es.bsc.compss.types.parameter.FileParameter) Parameter(es.bsc.compss.types.parameter.Parameter) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) FileParameter(es.bsc.compss.types.parameter.FileParameter) DataAccessId(es.bsc.compss.types.data.DataAccessId)

Example 4 with TaskDescription

use of es.bsc.compss.types.TaskDescription in project compss by bsc-wdc.

the class GATJob method prepareJob.

private JobDescription prepareJob() throws Exception {
    // Get the information related to the job
    logger.debug("Preparing GAT Job " + this.jobId);
    TaskDescription taskParams = this.taskParams;
    String targetPath = getResourceNode().getInstallDir();
    String targetHost = getResourceNode().getHost();
    String targetUser = getResourceNode().getUser();
    if (userNeeded && !targetUser.isEmpty()) {
        targetUser += "@";
    } else {
        targetUser = "";
    }
    SoftwareDescription sd = new SoftwareDescription();
    sd.setExecutable(targetPath + WORKER_SCRIPT_PATH + WORKER_SCRIPT_NAME);
    ArrayList<String> lArgs = new ArrayList<String>();
    // Common arguments: language working_dir lib_path num_obsolete [obs1... obsN] tracing [event_type task_id
    // slot_id]
    lArgs.add(LANG);
    lArgs.add(getResourceNode().getWorkingDir());
    lArgs.add(getResourceNode().getLibPath());
    LogicalData[] obsoleteFiles = getResource().pollObsoletes();
    if (obsoleteFiles != null) {
        lArgs.add("" + obsoleteFiles.length);
        for (LogicalData ld : obsoleteFiles) {
            String renaming = ld.getName();
            lArgs.add(renaming);
        }
    } else {
        lArgs.add("0");
    }
    // Check sandbox working dir
    boolean isSpecific = false;
    String sandboxDir = null;
    AbstractMethodImplementation absImpl = (AbstractMethodImplementation) this.impl;
    switch(absImpl.getMethodType()) {
        case BINARY:
            BinaryImplementation binaryImpl = (BinaryImplementation) absImpl;
            sandboxDir = binaryImpl.getWorkingDir();
            isSpecific = true;
            break;
        case MPI:
            MPIImplementation mpiImpl = (MPIImplementation) absImpl;
            sandboxDir = mpiImpl.getWorkingDir();
            isSpecific = true;
            break;
        case DECAF:
            DecafImplementation decafImpl = (DecafImplementation) absImpl;
            sandboxDir = decafImpl.getWorkingDir();
            isSpecific = true;
            break;
        case OMPSS:
            OmpSsImplementation ompssImpl = (OmpSsImplementation) absImpl;
            sandboxDir = ompssImpl.getWorkingDir();
            isSpecific = true;
            break;
        case OPENCL:
            OpenCLImplementation openclImpl = (OpenCLImplementation) absImpl;
            sandboxDir = openclImpl.getWorkingDir();
            isSpecific = true;
            break;
        case METHOD:
            sandboxDir = null;
            break;
    }
    if (sandboxDir == null || sandboxDir.isEmpty() || sandboxDir.equals(Constants.UNASSIGNED)) {
        sandboxDir = getResourceNode().getWorkingDir() + File.separator + "sandBox" + File.separator + "job_" + this.jobId;
        isSpecific = false;
    }
    // Processing parameters to get symlinks pairs to create (symlinks) and how to pass parameters in the GAT
    // Job(paramArgs)
    ArrayList<String> symlinks = new ArrayList<>();
    ArrayList<String> paramArgs = new ArrayList<>();
    processParameters(sandboxDir, symlinks, paramArgs);
    // Adding info to create symlinks between renamed files and original names
    lArgs.add(Boolean.toString(isSpecific));
    lArgs.add(sandboxDir);
    if (symlinks.size() > 0) {
        lArgs.add(String.valueOf(symlinks.size()));
        lArgs.addAll(symlinks);
    } else {
        lArgs.add("0");
    }
    lArgs.add(Boolean.toString(Tracer.isActivated()));
    lArgs.add(getHostName());
    if (debug) {
        logger.debug("hostName " + getHostName());
    }
    if (Tracer.isActivated()) {
        // event type
        lArgs.add(String.valueOf(Tracer.getTaskEventsType()));
        // task id
        lArgs.add(String.valueOf(this.taskParams.getId() + 1));
        int slot = Tracer.getNextSlot(targetHost);
        // slot id
        lArgs.add(String.valueOf(slot));
        sd.addAttribute("slot", slot);
    }
    // Language-dependent arguments: taskSandbox_dir app_dir classpath pythonpath debug storage_conf
    // method_impl_type method_impl_params
    // numSlaves [slave1,..,slaveN] numCus
    // has_target num_params par_type_1 par_1 ... par_type_n par_n
    lArgs.add(sandboxDir);
    lArgs.add(getResourceNode().getAppDir());
    lArgs.add(getClasspath());
    lArgs.add(getPythonpath());
    lArgs.add(String.valueOf(debug));
    lArgs.add(STORAGE_CONF);
    lArgs.add(String.valueOf(absImpl.getMethodType()));
    switch(absImpl.getMethodType()) {
        case METHOD:
            MethodImplementation methodImpl = (MethodImplementation) absImpl;
            lArgs.add(methodImpl.getDeclaringClass());
            String methodName = methodImpl.getAlternativeMethodName();
            if (methodName == null || methodName.isEmpty()) {
                methodName = taskParams.getName();
            }
            lArgs.add(methodName);
            break;
        case MPI:
            MPIImplementation mpiImpl = (MPIImplementation) absImpl;
            lArgs.add(mpiImpl.getMpiRunner());
            lArgs.add(mpiImpl.getBinary());
            break;
        case DECAF:
            DecafImplementation decafImpl = (DecafImplementation) absImpl;
            lArgs.add(targetPath + DecafImplementation.SCRIPT_PATH);
            String dfScript = decafImpl.getDfScript();
            if (!dfScript.startsWith(File.separator)) {
                String appPath = getResourceNode().getAppDir();
                dfScript = appPath + File.separator + dfScript;
            }
            lArgs.add(dfScript);
            String dfExecutor = decafImpl.getDfExecutor();
            if (dfExecutor == null || dfExecutor.isEmpty() || dfExecutor.equals(Constants.UNASSIGNED)) {
                dfExecutor = "executor.sh";
            }
            if (!dfExecutor.startsWith(File.separator) && !dfExecutor.startsWith("./")) {
                dfExecutor = "./" + dfExecutor;
            }
            lArgs.add(dfExecutor);
            String dfLib = decafImpl.getDfLib();
            if (dfLib == null || dfLib.isEmpty()) {
                dfLib = Constants.UNASSIGNED;
            }
            lArgs.add(dfLib);
            lArgs.add(decafImpl.getMpiRunner());
            break;
        case OMPSS:
            OmpSsImplementation ompssImpl = (OmpSsImplementation) absImpl;
            lArgs.add(ompssImpl.getBinary());
            break;
        case OPENCL:
            OpenCLImplementation openclImpl = (OpenCLImplementation) absImpl;
            lArgs.add(openclImpl.getKernel());
            break;
        case BINARY:
            BinaryImplementation binaryImpl = (BinaryImplementation) absImpl;
            lArgs.add(binaryImpl.getBinary());
            break;
    }
    // Slave nodes and cus description
    lArgs.add(String.valueOf(slaveWorkersNodeNames.size()));
    lArgs.addAll(slaveWorkersNodeNames);
    lArgs.add(String.valueOf(((MethodResourceDescription) this.impl.getRequirements()).getTotalCPUComputingUnits()));
    // Add parameter arguments already processed
    lArgs.addAll(paramArgs);
    // Conversion vector -> array
    String[] arguments = new String[lArgs.size()];
    arguments = lArgs.toArray(arguments);
    try {
        sd.setArguments(arguments);
    } catch (NullPointerException e) {
        StringBuilder sb = new StringBuilder("Null argument parameter of job " + this.jobId + " " + absImpl.getMethodDefinition() + "\n");
        int i = 0;
        for (Parameter param : taskParams.getParameters()) {
            sb.append("Parameter ").append(i).append("\n");
            DataType type = param.getType();
            sb.append("\t Type: ").append(param.getType()).append("\n");
            if (type == DataType.FILE_T || type == DataType.OBJECT_T) {
                DependencyParameter dPar = (DependencyParameter) param;
                DataAccessId dAccId = dPar.getDataAccessId();
                sb.append("\t Target: ").append(dPar.getDataTarget()).append("\n");
                if (type == DataType.OBJECT_T) {
                    if (dAccId instanceof RAccessId) {
                        sb.append("\t Direction: " + "R").append("\n");
                    } else {
                        // for the worker to know it must write the object to disk
                        sb.append("\t Direction: " + "W").append("\n");
                    }
                }
            } else if (type == DataType.STRING_T) {
                BasicTypeParameter btParS = (BasicTypeParameter) param;
                // Check spaces
                String value = btParS.getValue().toString();
                int numSubStrings = value.split(" ").length;
                sb.append("\t Num Substrings: " + Integer.toString(numSubStrings)).append("\n");
                sb.append("\t Value:" + value).append("\n");
            } else {
                // Basic types
                BasicTypeParameter btParB = (BasicTypeParameter) param;
                sb.append("\t Value: " + btParB.getValue().toString()).append("\n");
            }
            i++;
        }
        logger.error(sb.toString());
        listener.jobFailed(this, JobEndStatus.SUBMISSION_FAILED);
    }
    sd.addAttribute("jobId", jobId);
    // JEA Changed to allow execution in MN
    sd.addAttribute(SoftwareDescription.WALLTIME_MAX, absImpl.getRequirements().getWallClockLimit());
    if (absImpl.getRequirements().getHostQueues().size() > 0) {
        sd.addAttribute(SoftwareDescription.JOB_QUEUE, absImpl.getRequirements().getHostQueues().get(0));
    }
    sd.addAttribute("coreCount", absImpl.getRequirements().getTotalCPUComputingUnits());
    sd.addAttribute("gpuCount", absImpl.getRequirements().getTotalGPUComputingUnits());
    sd.addAttribute("fpgaCount", absImpl.getRequirements().getTotalFPGAComputingUnits());
    sd.addAttribute(SoftwareDescription.MEMORY_MAX, absImpl.getRequirements().getMemorySize());
    // sd.addAttribute(SoftwareDescription.SANDBOX_ROOT, "/tmp/");
    sd.addAttribute(SoftwareDescription.SANDBOX_ROOT, getResourceNode().getWorkingDir());
    sd.addAttribute(SoftwareDescription.SANDBOX_USEROOT, "true");
    sd.addAttribute(SoftwareDescription.SANDBOX_DELETE, "false");
    /*
         * sd.addAttribute(SoftwareDescription.SANDBOX_PRESTAGE_STDIN, "false");
         * sd.addAttribute(SoftwareDescription.SANDBOX_POSTSTAGE_STDOUT, "false");
         * sd.addAttribute(SoftwareDescription.SANDBOX_POSTSTAGE_STDERR, "false");
         */
    if (debug) {
        // Set standard output file for job
        File outFile = GAT.createFile(context, Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR + "job" + jobId + "_" + this.getHistory() + ".out");
        sd.setStdout(outFile);
    }
    if (debug || usingGlobus) {
        // Set standard error file for job
        File errFile = GAT.createFile(context, Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR + "job" + jobId + "_" + this.getHistory() + ".err");
        sd.setStderr(errFile);
    }
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put(RES_ATTR, Protocol.ANY_URI.getSchema() + targetUser + targetHost);
    attributes.put("Jobname", "compss_remote_job_" + jobId);
    ResourceDescription rd = new HardwareResourceDescription(attributes);
    if (debug) {
        logger.debug("Ready to submit job " + jobId + ":");
        logger.debug("  * Host: " + targetHost);
        logger.debug("  * Executable: " + sd.getExecutable());
        StringBuilder sb = new StringBuilder("  - Arguments:");
        for (String arg : sd.getArguments()) {
            sb.append(" ").append(arg);
        }
        logger.debug(sb.toString());
    }
    JobDescription jd = new JobDescription(sd, rd);
    // jd.setProcessCount(method.getRequirements().getProcessorCoreCount());
    return jd;
}
Also used : MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) AbstractMethodImplementation(es.bsc.compss.types.implementations.AbstractMethodImplementation) MPIImplementation(es.bsc.compss.types.implementations.MPIImplementation) RAccessId(es.bsc.compss.types.data.DataAccessId.RAccessId) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) BasicTypeParameter(es.bsc.compss.types.parameter.BasicTypeParameter) OpenCLImplementation(es.bsc.compss.types.implementations.OpenCLImplementation) JobDescription(org.gridlab.gat.resources.JobDescription) TaskDescription(es.bsc.compss.types.TaskDescription) DecafImplementation(es.bsc.compss.types.implementations.DecafImplementation) DataType(es.bsc.compss.types.annotations.parameter.DataType) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) BinaryImplementation(es.bsc.compss.types.implementations.BinaryImplementation) AbstractMethodImplementation(es.bsc.compss.types.implementations.AbstractMethodImplementation) HardwareResourceDescription(org.gridlab.gat.resources.HardwareResourceDescription) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription) LogicalData(es.bsc.compss.types.data.LogicalData) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) HardwareResourceDescription(org.gridlab.gat.resources.HardwareResourceDescription) ResourceDescription(org.gridlab.gat.resources.ResourceDescription) Parameter(es.bsc.compss.types.parameter.Parameter) DependencyParameter(es.bsc.compss.types.parameter.DependencyParameter) BasicTypeParameter(es.bsc.compss.types.parameter.BasicTypeParameter) File(org.gridlab.gat.io.File) OmpSsImplementation(es.bsc.compss.types.implementations.OmpSsImplementation) DataAccessId(es.bsc.compss.types.data.DataAccessId)

Aggregations

TaskDescription (es.bsc.compss.types.TaskDescription)4 DependencyParameter (es.bsc.compss.types.parameter.DependencyParameter)3 DataAccessId (es.bsc.compss.types.data.DataAccessId)2 RAccessId (es.bsc.compss.types.data.DataAccessId.RAccessId)2 DataInstanceId (es.bsc.compss.types.data.DataInstanceId)2 Parameter (es.bsc.compss.types.parameter.Parameter)2 FullGraphScore (es.bsc.es.bsc.compss.scheduler.types.FullGraphScore)2 FakeAllocatableAction (es.bsc.es.bsc.compss.scheduler.types.fake.FakeAllocatableAction)2 FakeImplementation (es.bsc.es.bsc.compss.scheduler.types.fake.FakeImplementation)2 FakeProfile (es.bsc.es.bsc.compss.scheduler.types.fake.FakeProfile)2 FakeResourceDescription (es.bsc.es.bsc.compss.scheduler.types.fake.FakeResourceDescription)2 Test (org.junit.Test)2 DataType (es.bsc.compss.types.annotations.parameter.DataType)1 RWAccessId (es.bsc.compss.types.data.DataAccessId.RWAccessId)1 LogicalData (es.bsc.compss.types.data.LogicalData)1 AbstractMethodImplementation (es.bsc.compss.types.implementations.AbstractMethodImplementation)1 BinaryImplementation (es.bsc.compss.types.implementations.BinaryImplementation)1 DecafImplementation (es.bsc.compss.types.implementations.DecafImplementation)1 MPIImplementation (es.bsc.compss.types.implementations.MPIImplementation)1 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)1