Search in sources :

Example 16 with HtcJobID

use of cbit.vcell.server.HtcJobID in project vcell by virtualcell.

the class SlurmProxy method getRunningJobs.

/**
 * sacct
 *
 *        JobID    JobName  Partition    Account  AllocCPUS      State ExitCode
 *        ------------ ---------- ---------- ---------- ---------- ---------- --------
 *        4989         V_TEST_10+        amd      pi-loew          1 CANCELLED+      0:0
 *        4990         V_TEST_10+    general      pi-loew          2  COMPLETED      0:0
 *        4990.batch        batch                 pi-loew          2  COMPLETED      0:0
 *
 * allowed fields:
 *
 * AllocCPUS         AllocGRES         AllocNodes        AllocTRES
 * Account           AssocID           AveCPU            AveCPUFreq
 * AveDiskRead       AveDiskWrite      AvePages          AveRSS
 * AveVMSize         BlockID           Cluster           Comment
 * ConsumedEnergy    ConsumedEnergyRaw CPUTime           CPUTimeRAW
 * DerivedExitCode   Elapsed           Eligible          End
 * ExitCode          GID               Group             JobID
 * JobIDRaw          JobName           Layout            MaxDiskRead
 * MaxDiskReadNode   MaxDiskReadTask   MaxDiskWrite      MaxDiskWriteNode
 * MaxDiskWriteTask  MaxPages          MaxPagesNode      MaxPagesTask
 * MaxRSS            MaxRSSNode        MaxRSSTask        MaxVMSize
 * MaxVMSizeNode     MaxVMSizeTask     MinCPU            MinCPUNode
 * MinCPUTask        NCPUS             NNodes            NodeList
 * NTasks            Priority          Partition         QOS
 * QOSRAW            ReqCPUFreq        ReqCPUFreqMin     ReqCPUFreqMax
 * ReqCPUFreqGov     ReqCPUS           ReqGRES           ReqMem
 * ReqNodes          ReqTRES           Reservation       ReservationId
 * Reserved          ResvCPU           ResvCPURAW        Start
 * State             Submit            Suspended         SystemCPU
 * Timelimit         TotalCPU          UID               User
 * UserCPU           WCKey             WCKeyID
 *
 *  sacct -u vcell -P -o jobid%25,jobname%25,partition,user,alloccpus,ncpus,ntasks,state%13,exitcode
 *
 *  JobID|JobName|Partition|User|AllocCPUS|NCPUS|NTasks|State|ExitCode
 *  4989|V_TEST_107541132_0_0|amd|vcell|1|1||CANCELLED by 10001|0:0
 *  4990|V_TEST_107541132_0_0|general|vcell|2|2||COMPLETED|0:0
 *  4990.batch|batch||vcell|2|2|1|COMPLETED|0:0
 *  4991|V_TEST_107548598_0_0|general|vcell|2|2||COMPLETED|0:0
 *  4991.batch|batch||vcell|2|2|1|COMPLETED|0:0
 *
 *  sacct can specify a particular job:
 *
 *  -j job(.step) , --jobs=job(.step)
 *
 *     Displays information about the specified job(.step) or list of job(.step)s.
 *     The job(.step) parameter is a comma-separated list of jobs.
 *     Space characters are not permitted in this list.
 *     NOTE: A step id of 'batch' will display the information about the batch step.
 *     The batch step information is only available after the batch job is complete unlike regular steps which are available when they start.
 *     The default is to display information on all jobs.
 * @throws IOException
 */
@Override
public Map<HtcJobID, JobInfoAndStatus> getRunningJobs() throws ExecutableException, IOException {
    String states = SlurmJobStatus.RUNNING.shortName + "," + SlurmJobStatus.CONFIGURING.shortName + "," + SlurmJobStatus.RESIZING.shortName;
    String[] cmds = { Slurm_HOME + JOB_CMD_STATUS, "-u", "vcell", "-P", "-s", states, "-o", "jobid%25,jobname%25,partition,user,alloccpus,ncpus,ntasks,state%13,exitcode" };
    CommandOutput commandOutput = commandService.command(cmds);
    String output = commandOutput.getStandardOutput();
    Map<HtcJobID, JobInfoAndStatus> statusMap = extractJobIds(output);
    return statusMap;
}
Also used : CommandOutput(cbit.vcell.message.server.cmd.CommandService.CommandOutput) HtcJobID(cbit.vcell.server.HtcJobID)

Example 17 with HtcJobID

use of cbit.vcell.server.HtcJobID in project vcell by virtualcell.

the class SlurmProxy method extractJobIds.

static Map<HtcJobID, JobInfoAndStatus> extractJobIds(String output) throws IOException {
    BufferedReader reader = new BufferedReader(new StringReader(output));
    String line = reader.readLine();
    if (!line.equals("JobID|JobName|Partition|User|AllocCPUS|NCPUS|NTasks|State|ExitCode")) {
        throw new RuntimeException("unexpected first line from sacct: '" + line + "'");
    }
    Map<HtcJobID, JobInfoAndStatus> statusMap = new HashMap<HtcJobID, JobInfoAndStatus>();
    while ((line = reader.readLine()) != null) {
        String[] tokens = line.split("\\|");
        String jobID = tokens[0];
        String jobName = tokens[1];
        String partition = tokens[2];
        String user = tokens[3];
        String allocCPUs = tokens[4];
        String ncpus = tokens[5];
        String ntasks = tokens[6];
        String state = tokens[7];
        String exitcode = tokens[8];
        if (jobName.equals("batch")) {
            continue;
        }
        HtcJobID htcJobID = new HtcJobID(jobID, BatchSystemType.SLURM);
        String errorPath = null;
        String outputPath = null;
        HtcJobInfo htcJobInfo = new HtcJobInfo(htcJobID, true, jobName, errorPath, outputPath);
        HtcJobStatus htcJobStatus = new HtcJobStatus(SlurmJobStatus.parseStatus(state));
        statusMap.put(htcJobID, new JobInfoAndStatus(htcJobInfo, htcJobStatus));
    }
    return statusMap;
}
Also used : HashMap(java.util.HashMap) HtcJobStatus(cbit.vcell.message.server.htc.HtcJobStatus) BufferedReader(java.io.BufferedReader) StringReader(java.io.StringReader) HtcJobID(cbit.vcell.server.HtcJobID)

Example 18 with HtcJobID

use of cbit.vcell.server.HtcJobID in project vcell by virtualcell.

the class JobIdTest method sysSame.

private void sysSame(BatchSystemType bt) {
    long n = r.nextLong();
    HtcJobID x = gen(n, bt, null);
    HtcJobID y = gen(n, bt, null);
    assertTrue(x.equals(y));
    assertTrue(x.compareEqual(y));
    assertTrue(x.hashCode() == y.hashCode());
    String server = randomServer();
    x = gen(n, bt, server);
    y = gen(n, bt, server);
    assertTrue(x.equals(y));
    assertTrue(x.compareEqual(y));
    assertTrue(x.hashCode() == y.hashCode());
}
Also used : HtcJobID(cbit.vcell.server.HtcJobID)

Example 19 with HtcJobID

use of cbit.vcell.server.HtcJobID in project vcell by virtualcell.

the class JobIdTest method diffBatch.

@Test
public void diffBatch() {
    long n = r.nextLong();
    HtcJobID x = gen(n, BatchSystemType.SGE, null);
    HtcJobID y = gen(n, BatchSystemType.PBS, null);
    HtcJobID z = gen(n, BatchSystemType.SLURM, null);
    assertFalse(x.equals(y));
    assertFalse(x.compareEqual(y));
    assertFalse(x.equals(z));
    assertFalse(x.compareEqual(z));
    assertFalse(y.equals(z));
    assertFalse(y.compareEqual(z));
    String server = randomServer();
    x = gen(n, BatchSystemType.SGE, server);
    y = gen(n, BatchSystemType.PBS, server);
    z = gen(n, BatchSystemType.SLURM, server);
    assertFalse(x.equals(y));
    assertFalse(x.compareEqual(y));
    assertFalse(x.equals(z));
    assertFalse(x.compareEqual(z));
    assertFalse(y.equals(z));
    assertFalse(y.compareEqual(z));
}
Also used : HtcJobID(cbit.vcell.server.HtcJobID) Test(org.junit.Test)

Aggregations

HtcJobID (cbit.vcell.server.HtcJobID)19 SimulationExecutionStatus (cbit.vcell.server.SimulationExecutionStatus)5 SimulationQueueEntryStatus (cbit.vcell.server.SimulationQueueEntryStatus)5 Date (java.util.Date)5 VCellServerID (org.vcell.util.document.VCellServerID)5 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)4 KeyValue (org.vcell.util.document.KeyValue)4 StatusMessage (cbit.vcell.message.messages.StatusMessage)3 CommandOutput (cbit.vcell.message.server.cmd.CommandService.CommandOutput)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 ExecutableException (org.vcell.util.exe.ExecutableException)3 HtcJobStatus (cbit.vcell.message.server.htc.HtcJobStatus)2 HtcProxy (cbit.vcell.message.server.htc.HtcProxy)2 SchedulerStatus (cbit.vcell.server.SimulationJobStatus.SchedulerStatus)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 File (java.io.File)2 User (org.vcell.util.document.User)2 RollbackException (cbit.vcell.message.RollbackException)1 VCMessage (cbit.vcell.message.VCMessage)1