Examples of RunId


Examples of com.sun.faban.harness.common.RunId

            response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                                        "Missing RunId.");
            return;
        }
        String runId = reqC[1];
        String status = RunResult.getStatus(new RunId(runId));
        if (status == null) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND,
                                        "No such runId: " + runId);
        } else {
            Writer w = response.getWriter();
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        if (reqC.length < 2) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                                        "Missing RunId.");
            return;
        }
        RunId runId = new RunId(reqC[1]);
        boolean[] options = new boolean[2];
        options[TAIL] = false;
        options[FOLLOW] = false;
        for (int i = 2; i < reqC.length; i++) {
            if ("tail".equals(reqC[i])) {
                options[TAIL] = true;
            } else if ("follow".equals(reqC[i])) {
                options[FOLLOW] = true;
            } else {
                response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                    "Invalid option \"" + reqC[i] + "\"."); ;
                return;
            }
        }
        File logFile = new File(Config.OUT_DIR + runId, "log.xml");
        String status = null;
        response.setContentType("text/plain");
        PrintWriter out = response.getWriter();
        while (!logFile.exists()) {
            String[] pending = RunQ.listPending();
            if (pending == null) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND,
                                            "RunId " + runId +" not found");
                return;
            }
            boolean queued = false;
            for (String run : pending) {
                if (run.equals(runId.toString())) {
                    if (status == null) {
                        status = "QUEUED";
                        out.println(status);
                        response.flushBuffer();
                    }
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        if (reqC.length < 2) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST,
                    "Missing RunId.");
            return;
        }
        RunId runId = new RunId(reqC[1]);
        String user = request.getParameter("sun");
        String password = request.getParameter("sp");

        // Check the status of the run
        boolean found = false;
        boolean queued = false;
        String terminateStatus = null;
        RunResult result = RunResult.getInstance(runId);
        if (result != null) {
            found = true;
            if ( "COMPLETED".equals(result.status) ||
                    "FAILED".equals(result.status) ||
                    "KILLED".equals(result.status) ) {
                terminateStatus = result.status;
            }
        } else { // If not found, look in queue
            String[] pending = RunQ.listPending();
            if (pending != null) {
                for (String run : pending) {
                    if (run.equals(runId.toString())) {
                        found = true;
                        queued = true;
                        break;
                    }
                }
            }
        }

        if (found && terminateStatus == null) { // not yet terminated

            // First authenticate the user and make sure he/she is the CLI user.
            boolean hasPermission = true;
            if (Config.SECURITY_ENABLED) {
                if (Config.CLI_SUBMITTER == null ||
                        Config.CLI_SUBMITTER.length() == 0 ||
                        !Config.CLI_SUBMITTER.equals(user)) {
                    hasPermission = false;
                }
                if (Config.SUBMIT_PASSWORD == null ||
                        Config.SUBMIT_PASSWORD.length() == 0 ||
                        !Config.SUBMIT_PASSWORD.equals(password)) {
                    hasPermission = false;
                }
                if (AccessController.isKillAllowed(user, runId.toString())) {
                    hasPermission = false;
                }
            }

            if (hasPermission) {

                // No matter of status, the run may be running by now.
                // So check for active runs first.
                if (RunQ.getHandle().killCurrentRun(runId.toString(), user)
                        != null) {
                    terminateStatus = "KILLING";
                } else { // Or the run may have already terminated...
                    result = RunResult.getInstance(runId);
                    if (result != null) {
                        if ( "COMPLETED".equals(result.status) ||
                                "FAILED".equals(result.status) ||
                                "KILLED".equals(result.status) ) {
                            terminateStatus = result.status;
                        }
                    } else if (queued) { // Or it still is in the queue
                        RunQ.getHandle().deleteRun(runId.toString());
                        terminateStatus = "DELETED";
                    }
                }
            } else {
                if (queued) // Run was removed in the meantime
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

     */
    public String getRunInfo(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
        UserEnv usrEnv = getUserEnv(req);
        String runId = req.getParameter("runId");
        RunResult result = RunResult.getInstance(new RunId(runId));
        String[] header = {"RunId","Description","Result","Scale","Metric","Status","Date/Time","Submitter","Tags"};
        String[] runInfo = new String[9];
        runInfo[0] = result.runId.toString();
        if (result.description == null || result.description.length() == 0)
                runInfo[1] = "UNAVAILABLE";
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

            throws IOException {
        String[] restRequest = (String[]) req.getAttribute("rest.request");
        String runId = restRequest[0];
        UserEnv usrEnv = getUserEnv(req);

        RunResult result = RunResult.getInstance(new RunId(runId));
        if (result == null) {
            // Perhaps the runId is still in the pending queue.
            boolean found = false;
            String[] pending = RunQ.listPending();
            for (String run : pending) {
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        else
            model.head = "Repository";

        model.results = new RunResult[runIds.length];
        for (int i = 0; i < runIds.length; i++) {
            model.results[i] = RunResult.getInstance(new RunId(runIds[i]));
        }
        // We use request attributes as not to reflect session state.
        request.setAttribute("editarchive.model", model);
        return "/edit_archive.jsp";
    }
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        return existingRuns;
    }*/

    private String editResultInfo(String runID)
            throws FileNotFoundException, IOException {
        RunId runId = new RunId(runID);
        String ts = null;
        String[] status = new String[2];
        File file = new File(Config.OUT_DIR + runID + '/' + Config.RESULT_INFO);
        RandomAccessFile rf = new RandomAccessFile(file, "rwd");
        long size = rf.length();
        byte[] buffer = new byte[(int) size];
        rf.readFully(buffer);
        String content = new String(buffer, 0, (int) size );
        int idx = content.indexOf('\t');
        if (idx != -1) {
                status[0] = content.substring(0, idx).trim();
                status[1] = content.substring(++idx).trim();
        } else {
                status[0] = content.trim();
                int lastIdxln = status[0].lastIndexOf("\n");
                if(lastIdxln != -1)
                    status[0] = status[0].substring(0, lastIdxln-1);
        }
        if (status[1] != null) {
            ts = status[1];
        }else{
            String paramFileName = runId.getResultDir().getAbsolutePath() +
                    File.separator + "run.xml";
            File paramFile = new File(paramFileName);
            long dt = paramFile.lastModified();
            ts = dateFormat.format(new Date(dt));
            rf.seek(rf.length());
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        else
            model.head = "Repository";

        model.results = new RunResult[runIds.length];
        for (int i = 0; i < runIds.length; i++) {
            model.results[i] = RunResult.getInstance(new RunId(runIds[i]));
        }

        if (submitAction.equals("Archive")) {
            for (int i = 0; i < model.runIds.length; i++) {
                String runId = model.runIds[i];
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

            } catch (ClassNotFoundException ex) {
                logger.log(Level.SEVERE, "Cannot find tag engine class", ex);
                throw new IOException("Cannot find tag engine class", ex);
            }
            for (String r : runIds) {
                RunResult runResult = RunResult.getInstance(new RunId(r));
                runResult.delete(r);
                tagEngine.removeRun(r);
                tagEngine.save();
            }
        }
View Full Code Here

Examples of com.sun.faban.harness.common.RunId

        Set<String> runIds = tagEngine.search(tags);
        ArrayList<RunResult> resultList =
                new ArrayList<RunResult>(runIds.size());
        for (String runid : runIds) {
            try {
                RunId runId = new RunId(runid);
                if (!AccessController.isViewAllowed(user, runid))
                    continue;
                RunResult res = getInstance(runId);
                if (res == null){
                    try{                       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.