Package com.sun.grid.jsv

Examples of com.sun.grid.jsv.JobDescription


    public void onStart(JsvManager jsv) {
        jsv.requestEnvironment(true);
    }

    public void onVerify(JsvManager jsv) {
        JobDescription params = jsv.getJobDescription();

        if ((params.isBinary() != null) && params.isBinary()) {
            jsv.reject("Binary job is rejected.");
        } else if ((params.getParallelEnvironment() != null) &&
                ((params.getParallelEnvironment().getRangeMin() % 16) != 0)) {
            jsv.reject("Parallel job does not request a multiple of 16 slots");
        } else {
            Map<String,String> hard = params.getHardResourceRequirements();
            boolean wait = false;
            boolean mod = false;

            if (hard != null) {
                if (hard.containsKey("h_vmem")) {
                    wait = true;
                }

                if (hard.remove("h_data") != null) {
                    mod = true;

                    if (params.getContext().equalsIgnoreCase("client")) {
                        jsv.log(JsvManager.LogLevel.INFO, "h_data as hard resource requirement has been deleted");
                    }

                    params.setHardResourceRequirements(hard);
                }
            }

            Map<String,String> context = params.getJobContext();

            if (context != null) {
                if (context.containsKey("a")) {
                    context.put("a", Integer.toString(Integer.parseInt(context.get("a")) + 1));
                } else {
                    context.put("a", "1");
                }

                context.remove("b");
                context.remove("c");
                context.put("d", "5");

                params.setJobContext(context);
            }

            if (wait) {
                jsv.rejectWait("Job is rejected. It might be submitted later.");
            } else if (mod) {
View Full Code Here


    public void onStart(JsvManager jsv) {
        log.info("Starting job verification");
    }

    public void onVerify(JsvManager jsv) {
        JobDescription job = jsv.getJobDescription();
        Map<String,String> res = job.getHardResourceRequirements();
        String path = null;

        if ((res != null) && res.containsKey(PATH_KEY)) {
            path = res.get(PATH_KEY);
        } else if ((res != null) && res.containsKey(PATH_KEY_SHORT)) {
            path = res.get(PATH_KEY_SHORT);
        }

        if (path != null) {
            if (verifyPath(path)) {
                Map<String,String> soft = job.getSoftResourceRequirements();

                try {
                    Collection<LocatedBlock> blocks = null;

                    blocks = getBlocks(path, getConf());

                    // Add new requests
                    soft.putAll(buildRackRequests(blocks));
                    soft.putAll(buildBlockRequests(blocks));
                    job.setSoftResourceRequirements(soft);

                    // Remove old request
                    res.remove(PATH_KEY);
                    res.remove(PATH_KEY_SHORT);
                    job.setHardResourceRequirements(res);
                } catch (FileNotFoundException e) {
                    jsv.reject("The requested data path does not exist: " + path);
                } catch (IOException e) {
                    log.warning("Unable to contact Namenode: " + StringUtils.stringifyException(e));
                    jsv.log(JsvManager.LogLevel.ERROR, "Unable to contact Namenode: " + e.getMessage());
View Full Code Here

TOP

Related Classes of com.sun.grid.jsv.JobDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.