Search in sources :

Example 1 with PartitionStatistics

use of cbit.vcell.message.server.htc.HtcProxy.PartitionStatistics in project vcell by virtualcell.

the class SlurmProxyTest method testSLURM.

@Test
public void testSLURM() throws IOException, ExecutableException {
    System.setProperty("log4j2.trace", "true");
    System.setProperty(PropertyLoader.vcellServerIDProperty, "Test2");
    System.setProperty(PropertyLoader.htcLogDirExternal, "/Volumes/vcell/htclogs");
    VCMongoMessage.enabled = false;
    String[] partitions = new String[] { "vcell", "vcell2" };
    System.setProperty(PropertyLoader.slurm_partition, partitions[0]);
    CommandServiceSshNative cmd = null;
    try {
        cmd = new CommandServiceSshNative(new String[] { "vcell-service.cam.uchc.edu" }, "vcell", new File("/Users/schaff/.ssh/schaff_rsa"));
        SlurmProxy slurmProxy = new SlurmProxy(cmd, "vcell");
        Map<HtcJobInfo, HtcJobStatus> runningJobs = slurmProxy.getRunningJobs();
        for (HtcJobInfo jobInfo : runningJobs.keySet()) {
            HtcJobStatus jobStatus = runningJobs.get(jobInfo);
            System.out.println("job " + jobInfo.getHtcJobID() + " " + jobInfo.getJobName() + ", status=" + jobStatus.toString());
        }
        for (String partition : partitions) {
            System.setProperty(PropertyLoader.slurm_partition, partition);
            PartitionStatistics partitionStatistics = slurmProxy.getPartitionStatistics();
            System.out.println("partition statistics for partition " + partition + ": " + partitionStatistics);
            System.out.println("number of cpus allocated = " + partitionStatistics.numCpusAllocated);
            System.out.println("load = " + partitionStatistics.load);
            System.out.println("number of cpus total = " + partitionStatistics.numCpusTotal);
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    } finally {
        if (cmd != null) {
            cmd.close();
        }
    }
}
Also used : PartitionStatistics(cbit.vcell.message.server.htc.HtcProxy.PartitionStatistics) HtcJobStatus(cbit.vcell.message.server.htc.HtcJobStatus) HtcJobInfo(cbit.vcell.message.server.htc.HtcProxy.HtcJobInfo) File(java.io.File) CommandServiceSshNative(cbit.vcell.message.server.cmd.CommandServiceSshNative) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ExecutableException(org.vcell.util.exe.ExecutableException) Test(org.junit.Test)

Example 2 with PartitionStatistics

use of cbit.vcell.message.server.htc.HtcProxy.PartitionStatistics in project vcell by virtualcell.

the class BatchSchedulerTest method test.

@Test
public void test() {
    ArrayList<BatchScheduler.ActiveJob> activeJobs = new ArrayList<BatchScheduler.ActiveJob>();
    activeJobs.addAll(Arrays.asList(job1, job2, job3, job4, job5, job6, job7, job8, job9, job10));
    int numCpusAllocated = 5;
    int numCpusTotal = 10;
    double load = 0.4;
    PartitionStatistics partitionStatistics = new PartitionStatistics(numCpusAllocated, numCpusTotal, load);
    int userQuotaOde = 2;
    int userQuotaPde = 2;
    VCellServerID systemID = relSite;
    SchedulerDecisions schedulerDecisions = BatchScheduler.schedule(activeJobs, partitionStatistics, userQuotaOde, userQuotaPde, systemID, null);
    schedulerDecisions.show();
// 
// enhance BatchScheduler to give reason why not to run each job that is not run.
// 
}
Also used : VCellServerID(org.vcell.util.document.VCellServerID) ActiveJob(cbit.vcell.message.server.dispatcher.BatchScheduler.ActiveJob) PartitionStatistics(cbit.vcell.message.server.htc.HtcProxy.PartitionStatistics) ArrayList(java.util.ArrayList) SchedulerDecisions(cbit.vcell.message.server.dispatcher.BatchScheduler.SchedulerDecisions) Test(org.junit.Test)

Aggregations

PartitionStatistics (cbit.vcell.message.server.htc.HtcProxy.PartitionStatistics)2 Test (org.junit.Test)2 CommandServiceSshNative (cbit.vcell.message.server.cmd.CommandServiceSshNative)1 ActiveJob (cbit.vcell.message.server.dispatcher.BatchScheduler.ActiveJob)1 SchedulerDecisions (cbit.vcell.message.server.dispatcher.BatchScheduler.SchedulerDecisions)1 HtcJobStatus (cbit.vcell.message.server.htc.HtcJobStatus)1 HtcJobInfo (cbit.vcell.message.server.htc.HtcProxy.HtcJobInfo)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 VCellServerID (org.vcell.util.document.VCellServerID)1 ExecutableException (org.vcell.util.exe.ExecutableException)1