Package bg.smoc.agent

Examples of bg.smoc.agent.GraderAgent


        gradingQueueManager.push(job, notified);
        dispatchJob();
    }

    public void releaseMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent) {
            gm = (GraderAgent) objMachineid;
            gm.assureNoCurrentJob();
        } else {
            Syslog.log("!AgentManager: releaseMachine: obj not instanceof Agent");
            return;
        }
View Full Code Here


    public void OnMsgGaEntry(Object objMachineid) {
        registerMachine(objMachineid);
    }

    private void registerMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent)
            gm = (GraderAgent) objMachineid;
        else {
            Syslog.log("!AgentManager: registerMachine: obj not instanceof Agent");
            return;
        }

        machineQueueManager.registerMachine(gm);

        // provide obj2astr
        String version = gm.getVersion();
        if (version == null)
            version = "";
        String desc = gm.getIP().toString();
        Date current = new Date();

        String[] aRecord = new String[5];
        aRecord[0] = desc;
        aRecord[1] = version;
        aRecord[2] = "RESERVED";
        aRecord[3] = kr.or.ioi2002.RMIServer.Util.DATETIME_FORMAT_DATE.format(current);
        aRecord[4] = kr.or.ioi2002.RMIServer.Util.DATETIME_FORMAT_TIME.format(current);
        Object objRet = obj2astr.put(gm, aRecord);
        if (objRet != null)
            Syslog.log("!AgentManager: registerMachine: overwriting existing key in obj2astr: "
                    + objRet.toString());

        LogGraderAgent.log("registerMachine[" + version + "][" + gm.getIP() + "]");

        dispatchJob();
    }
View Full Code Here

            return true;
        }
    }

    private void removeMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent)
            gm = (GraderAgent) objMachineid;
        else {
            Syslog.log("!AgentManager: removeMachine: obj not instanceof Agent");
            return;
        }

        String state = machineQueueManager.removeMachine(gm);

        String version = "";
        String date = "";
        String time = "";

        String[] astr = (String[]) obj2astr.remove(gm);
        if (astr == null) {
            Syslog.log("!AgentManager: removeMachine: obj not found in obj2astr: " + gm.toString());
        } else {
            if (astr[0] != null) {
            }
            if (astr[1] != null)
                version = astr[1];
            if (astr[3] != null)
                date = astr[3];
            if (astr[4] != null)
                time = astr[4];
        }

        LogGraderAgent.log("removeMachine["
                + version
                + "]["
                + gm.getIP()
                + "] registered at["
                + date
                + " "
                + time
                + "] in state ["
                + state
                + "] Job["
                + gm.getJob()
                + "]");
    }
View Full Code Here

    protected void dispatchJobToGrader(JobType jobType) {
        if (!gradingQueueManager.hasJob(jobType)) {
            return;
        }
        GraderAgent gm = machineQueueManager.moveMachineToBusy();
        if (gm == null) {
            return;
        }
        Job job = gradingQueueManager.popJob(jobType);

        if (gm != null && job != null && gm.assignJob(job)) {
            gradingQueueManager.markSuccessfullyAssignedJob(job);
        } else {
            machineQueueManager.releaseMachineFromBusyMode(gm);
            if (job != null) {
                gradingQueueManager.rePush(job);
View Full Code Here

                sleep(400);
            } catch (InterruptedException e) {
                return;
            }
        }
        new GraderAgent(this, mediator.getContestManager(), socket);
    }
View Full Code Here

    public GraderAgent moveMachineToBusy() {
        synchronized (this) {
            if (idleMachineQueue.isEmpty())
                return null;
            GraderAgent gm = idleMachineQueue.remove(0);
            busyMachineQueue.add(gm);
            return gm;
        }
    }
View Full Code Here

        gradingQueueManager.push(job, notified);
        dispatchJob();
    }

    private void releaseMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent)
            gm = (GraderAgent) objMachineid;
        else {
            Syslog.log("!AgentManager: releaseMachine: obj not instanceof Agent");
            return;
View Full Code Here

    public void OnMsgGaEntry(Object objMachineid) {
        registerMachine(objMachineid);
    }

    private void registerMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent)
            gm = (GraderAgent) objMachineid;
        else {
            Syslog.log("!AgentManager: registerMachine: obj not instanceof Agent");
            return;
        }

        machineQueueManager.registerMachine(gm);

        // provide obj2astr
        String version = gm.getVersion();
        if (version == null)
            version = "";
        String desc = gm.getIP().toString();
        Date current = new Date();

        String[] aRecord = new String[5];
        aRecord[0] = desc;
        aRecord[1] = version;
        aRecord[2] = "RESERVED";
        aRecord[3] = kr.or.ioi2002.RMIServer.Util.sdfDate.format(current);
        aRecord[4] = kr.or.ioi2002.RMIServer.Util.sdfTime.format(current);
        Object objRet = obj2astr.put(gm, aRecord);
        if (objRet != null)
            Syslog.log("!AgentManager: registerMachine: overwriting existing key in obj2astr: "
                    + objRet.toString());

        LogGraderAgent.log("registerMachine[" + version + "][" + gm.getIP() + "]");

        dispatchJob();
    }
View Full Code Here

            return true;
        }
    }

    private void removeMachine(Object objMachineid) {
        GraderAgent gm = null;
        if (objMachineid instanceof GraderAgent)
            gm = (GraderAgent) objMachineid;
        else {
            Syslog.log("!AgentManager: removeMachine: obj not instanceof Agent");
            return;
        }

        String state = machineQueueManager.removeMachine(gm);

        String version = "";
        String date = "";
        String time = "";

        String[] astr = (String[]) obj2astr.remove(gm);
        if (astr == null) {
            Syslog.log("!AgentManager: removeMachine: obj not found in obj2astr: " + gm.toString());
        } else {
            if (astr[0] != null) {
            }
            if (astr[1] != null)
                version = astr[1];
            if (astr[3] != null)
                date = astr[3];
            if (astr[4] != null)
                time = astr[4];
        }

        LogGraderAgent.log("removeMachine["
                + version
                + "]["
                + gm.getIP()
                + "] registered at["
                + date
                + " "
                + time
                + "] in state ["
                + state
                + "] Job["
                + gm.getJob()
                + "]");
    }
View Full Code Here

    protected void dispatchJobToGrader(JobType jobType) {
        if (!gradingQueueManager.hasJob(jobType)) {
            return;
        }
        GraderAgent gm = machineQueueManager.moveMachineToBusy();
        if (gm == null) {
            return;
        }
        Job job = gradingQueueManager.popJob(jobType);

        if (gm != null && job != null && gm.assignJob(job)) {
            gradingQueueManager.markSuccessfullyAssignedJob(job);
        } else {
            machineQueueManager.releaseMachineFromBusyMode(gm);
            if (job != null)
                gradingQueueManager.rePush(job);
View Full Code Here

TOP

Related Classes of bg.smoc.agent.GraderAgent

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.