Examples of JGDI


Examples of com.sun.grid.jgdi.JGDI

        return suite;
    }
   
    public void testSimple() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            PrintWriter pw = new PrintWriter(System.out);
            pw.println("Global Message List");
            JobSchedulingInfo schedInfo = jgdi.getJobSchedulingInfo();
            for (JobSchedulingMessage mes : schedInfo.getGlobalMessageList()) {
                pw.println(mes.getMessage() + " (" + mes.getMessageNumber() + ")");
                for (int i = 0; i < mes.getJobNumberCount(); i++) {
                    pw.println("Job " + mes.getJobNumberList().get(i).toString());
                }
            }
            if (schedInfo.isSetMessage()) {
                pw.println("Message List");
                for (JobSchedulingMessage mes : schedInfo.getMessageList()) {
                    pw.println(mes.getMessage() + " (" + mes.getMessageNumber() + ")");
                    for (int i = 0; i < mes.getJobNumberCount(); i++) {
                        int jobId = ((ULNG) mes.getJobNumberList().get(i)).getValue();
                        pw.println("job_number: " + jobId);
                        Job job = jgdi.getJob(jobId);
                        pw.println("exec_file:  " + job.getExecFile());
                        pw.println("submission_time: " + job.getSubmissionTime());
                        pw.println("owner: " + job.getOwner());
                        pw.println("uid: " + job.getUid());
                        pw.println("group: " + job.getGroup());
                        pw.println("gid: " + job.getGid());
//                  pw.println("default env: " + job.getDefaultEnv());
//                  pw.println("sge_o_home: " + job.getEnv("SGE_O_HOME"));
//                  pw.println("sge_o_log_name: " + job.getEnv("SGE_O_LOG_NAME"));
//                  pw.println("sge_o_path: " + job.getEnv("SGE_O_PATH"));
                    }
                }
            }
            pw.flush();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testAllHostValues() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            QHostOptions qhostOptions = new QHostOptions();
           
            ResourceAttributeFilter resourceAttributeFilter = new ResourceAttributeFilter();
           
            qhostOptions.setResourceAttributeFilter(resourceAttributeFilter);
           
            QHostResult res = jgdi.execQHost(qhostOptions);
           
            printResult(res);
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testQueueFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            QHostOptions qhostOptions = new QHostOptions();
            List<ExecHost> ehList = jgdi.getRealExecHostList();
            List<ClusterQueue> cqList = jgdi.getClusterQueueList();
            qhostOptions.setIncludeQueue(true);
            for (ExecHost eh : ehList) {
                HostFilter hf = new HostFilter();
                hf.addHost(eh.getName());
                qhostOptions.setHostFilter(hf);
                QHostResult res = jgdi.execQHost(qhostOptions);
                printResult(res);
                HostInfo hi = res.getHostInfo(eh.getName());
                assertNotNull(hi);
                for (ClusterQueue cq : cqList) {
                    for (QueueInstance cqi : cq.getQinstancesList()) {
                        if (cqi.getQhostname().equals(eh.getName())) {
                            boolean foundq = false;
                            for (QueueInfo qi : hi.getQueueList()) {
                                String hqname = qi.getQname();
                                // System.out.println("++ comparing cq.getName() " + cq.getName() +
                                //                      " and hqname " + hqname);
                                if (cq.getName().equals(hqname)) {
                                    //   System.out.println("-- matching cq.getName() " + cq.getName() +
                                    //                      " and hqname " + hqname);
                                    foundq = true;
                                    break;
                                }
                            }
                            assertTrue("queue " + cq.getName() + " not included for host " + eh.getName(), foundq);
                        }
                    }
                }
            }
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testHostValueFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            QHostOptions qhostOptions = new QHostOptions();
            List<ExecHost> ehList = jgdi.getRealExecHostList();
            for (ExecHost eh : ehList) {
                for (String loadValueName : eh.getLoadKeys()) {
                    String loadValue = eh.getLoad(loadValueName);
                    ResourceAttributeFilter resourceAttributeFilter = new ResourceAttributeFilter();
                    resourceAttributeFilter.addValueName(loadValueName);
                    qhostOptions.setResourceAttributeFilter(resourceAttributeFilter);
                    QHostResult res = jgdi.execQHost(qhostOptions);
                    printResult(res);
                    HostInfo hi = res.getHostInfo(eh.getName());
                    assertNotNull(hi);
                    assertNotNull("Resource Value " + loadValueName + " not found", hi.getResourceValue("hl", loadValueName));
                }
            }
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testHostFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            QHostOptions qhostOptions = new QHostOptions();
            List<ExecHost> ehList = jgdi.getRealExecHostList();
            for (ExecHost eh : ehList) {
                HostFilter hostFilter = new HostFilter();
                hostFilter.addHost(eh.getName());
                qhostOptions.setHostFilter(hostFilter);
                QHostResult res = jgdi.execQHost(qhostOptions);
                printResult(res);
                Set<String> hostNames = res.getHostNames();
                assertTrue("host " + eh.getName() + " not found", hostNames.contains(eh.getName()));
                assertTrue("host global not found", hostNames.contains("global"));
            }
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        return suite;
    }
   
    public void testSimple() throws Exception {
       
        JGDI jgdi = createJGDI();
       
        try {
            jgdi.disableQueues(new String[]{"*"}, false);
            try {
               
                String[] args = new String[]{"-e", "/dev/null", "-o", "/dev/null", "-l", "arch=*", "-soft", "-l", "arch=*", "$SGE_ROOT/examples/jobs/sleeper.sh"};
               
                int jobId = JobSubmitter.submitJob(getCurrentCluster(), args);
               
                QueueInstanceSummaryOptions options = new QueueInstanceSummaryOptions();
                options.setShowRequestedResourcesForJobs(true);
                options.setShowFullOutput(true);
                options.setShowArrayJobs(true);
                options.setShowExtendedSubTaskInfo(true);
               
                QueueInstanceSummaryResult result = jgdi.getQueueInstanceSummary(options);
               
                PrintWriter pw = new PrintWriter(System.out);
                QueueInstanceSummaryPrinter.print(pw, result, options);
                pw.flush();
               
               
                List<JobSummary> pendingJobs = result.getPendingJobs();
                JobSummary jobFound = null;
                for (JobSummary js : pendingJobs) {
                    if (js.getId() == jobId) {
                        jobFound = js;
                        break;
                    }
                }
                assertNotNull("job with id " + jobId + " not found in pending job list", jobFound);
               
                Set hardRequestNames = jobFound.getHardRequestNames();
                assertFalse("Job has not hard requested value", hardRequestNames.isEmpty());
                assertTrue(hardRequestNames.contains("arch"));
                assertEquals(jobFound.getHardRequestValue("arch").getValue(), "*");
            } finally {
                jgdi.enableQueues(new String[]{"*"}, false);
            }
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testSimple() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            ClusterQueueSummaryOptions options = new ClusterQueueSummaryOptions();
            List<ClusterQueueSummary> result = jgdi.getClusterQueueSummary(options);
            printResult(result);
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testResourceFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            ClusterQueueSummaryOptions options = new ClusterQueueSummaryOptions();
            ResourceFilter rsf = new ResourceFilter();
            rsf.addResource("NoAccessUsers", "lx-x86");
            options.setResourceFilter(rsf);
            List<ClusterQueueSummary> result = jgdi.getClusterQueueSummary(options);
            printResult(result);
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        TestSuite suite = new TestSuite(TestQmod.class);
        return suite;
    }
   
    public void testCleanQueues() throws Exception {
        JGDI jgdi = createJGDI();
        try {
            jgdi.cleanQueues(new String[]{"*"});
        } finally {
            jgdi.close();
        }
    }
View Full Code Here

Examples of com.sun.grid.jgdi.JGDI

        }
    }
   
    public void testQueueStateFilter() throws Exception {
       
        JGDI jgdi = createJGDI();
        try {
            ClusterQueueSummaryOptions options = new ClusterQueueSummaryOptions();
            QueueStateFilter qsf = new QueueStateFilter();
            qsf.setAlarm(true);
            options.setQueueStateFilter(qsf);
            logger.fine("queueStateFiter: " + qsf);
            List<ClusterQueueSummary> result = jgdi.getClusterQueueSummary(options);
            printResult(result);
        } finally {
            jgdi.close();
        }
    }
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.