Search in sources :

Example 1 with BioModelLink

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

the class SimulationRepresentation method getBioModelLink.

private static BioModelLink getBioModelLink(BioModelRep bioModelRep, SimulationRep simulationRep) {
    SimContextRep simContextRep = bioModelRep.getSimContextRepFromMathKey(simulationRep.getMathKey());
    BioModelLink bioModelLink = new BioModelLink(bioModelRep.getBmKey().toString(), bioModelRep.getBranchID().toString(), bioModelRep.getName(), (simContextRep != null) ? (simContextRep.getScKey().toString()) : null, (simContextRep != null) ? (simContextRep.getBranchID().toString()) : null, (simContextRep != null) ? (simContextRep.getName()) : null);
    return bioModelLink;
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) SimContextRep(cbit.vcell.modeldb.SimContextRep)

Example 2 with BioModelLink

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

the class SimulationJobsTableModel method getValueAt.

@Override
public Object getValueAt(int iRow, int iCol) {
    SimpleJobStatus sjs = getValueAt(iRow);
    if (sjs == null) {
        return null;
    }
    switch(iCol) {
        case iColModelApp:
            if (sjs.simulationDocumentLink instanceof BioModelLink) {
                BioModelLink bml = (BioModelLink) sjs.simulationDocumentLink;
                return "(BM) " + bml.bioModelName + ", (App) " + bml.simContextName;
            } else if (sjs.simulationDocumentLink instanceof MathModelLink) {
                MathModelLink mml = (MathModelLink) sjs.simulationDocumentLink;
                return "(MM) " + mml.mathModelName;
            } else {
                return null;
            }
        case iColSimulation:
            return sjs.simulationMetadata.simname;
        case iColSimId:
            return sjs.simulationMetadata.vcSimID.getSimulationKey().toString() + " / " + sjs.jobStatus.getJobIndex() + " / " + sjs.jobStatus.getTaskID();
        case iColSolver:
            String str = "";
            if (sjs.simulationMetadata.solverTaskDesc != null) {
                str = sjs.simulationMetadata.solverTaskDesc.getSolverDescription() == null ? "" : sjs.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
            }
            return str;
        case iColSubmitDate:
            DateFormat df = new SimpleDateFormat("MM.dd.yyyy");
            Date date = sjs.jobStatus.getStartDate();
            return df.format(date);
        case iColHasData:
            return sjs.jobStatus.hasData() == true ? "Yes" : "No";
        case iColStatus:
            return sjs.jobStatus.getSchedulerStatus().getDescription();
        case iColMessage:
            return sjs.jobStatus.getSimulationMessage().getDisplayMessage();
        case iColSite:
            return sjs.jobStatus.getServerID().toString();
        // return sjs.jobStatus.getComputeHost();
        default:
            return null;
    }
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) MathModelLink(cbit.vcell.server.MathModelLink) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) SimpleJobStatus(cbit.vcell.server.SimpleJobStatus)

Example 3 with BioModelLink

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

the class SimulationJobsTableModel method getComparator.

public Comparator<SimpleJobStatus> getComparator(final int col, final boolean ascending) {
    final int scale = ascending ? 1 : -1;
    return new Comparator<SimpleJobStatus>() {

        public int compare(SimpleJobStatus o1, SimpleJobStatus o2) {
            String s1 = "";
            String s2 = "";
            switch(col) {
                case iColModelApp:
                    if (o1.simulationDocumentLink instanceof BioModelLink) {
                        BioModelLink bml = (BioModelLink) o1.simulationDocumentLink;
                        s1 = "(BM) " + bml.bioModelName + ",(App) " + bml.simContextName;
                    } else if (o1.simulationDocumentLink instanceof MathModelLink) {
                        MathModelLink mml = (MathModelLink) o1.simulationDocumentLink;
                        s1 = "(MM) " + mml.mathModelName;
                    }
                    if (o2.simulationDocumentLink instanceof BioModelLink) {
                        BioModelLink bml = (BioModelLink) o2.simulationDocumentLink;
                        s2 = "(BM) " + bml.bioModelName + ",(App) " + bml.simContextName;
                    } else if (o2.simulationDocumentLink instanceof MathModelLink) {
                        MathModelLink mml = (MathModelLink) o2.simulationDocumentLink;
                        s2 = "(MM) " + mml.mathModelName;
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSimulation:
                    s1 = o1.simulationMetadata.simname;
                    s2 = o2.simulationMetadata.simname;
                    if (!s1.equalsIgnoreCase(s2)) {
                        return scale * s1.compareToIgnoreCase(s2);
                    } else {
                        // if same simulation, sort by date
                        Date d1 = o1.jobStatus.getStartDate();
                        Date d2 = o2.jobStatus.getStartDate();
                        return scale * d1.compareTo(d2);
                    }
                case iColSimId:
                    s1 = o1.simulationMetadata.vcSimID.getSimulationKey().toString() + "," + o1.jobStatus.getJobIndex() + "," + o1.jobStatus.getTaskID();
                    s2 = o2.simulationMetadata.vcSimID.getSimulationKey().toString() + "," + o2.jobStatus.getJobIndex() + "," + o2.jobStatus.getTaskID();
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSolver:
                    if (o1.simulationMetadata.solverTaskDesc != null && o1.simulationMetadata.solverTaskDesc.getSolverDescription() != null) {
                        s1 = o1.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
                    }
                    if (o2.simulationMetadata.solverTaskDesc != null && o2.simulationMetadata.solverTaskDesc.getSolverDescription() != null) {
                        s2 = o2.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSubmitDate:
                    Date d1 = o1.jobStatus.getSubmitDate();
                    Date d2 = o2.jobStatus.getSubmitDate();
                    return scale * d1.compareTo(d2);
                case iColHasData:
                    Boolean b1 = o1.jobStatus.hasData();
                    Boolean b2 = o2.jobStatus.hasData();
                    return scale * b1.compareTo(b2);
                case iColStatus:
                    SchedulerStatus ss1 = o1.jobStatus.getSchedulerStatus();
                    SchedulerStatus ss2 = o2.jobStatus.getSchedulerStatus();
                    return scale * ss1.compareTo(ss2);
                case iColMessage:
                    if (o1.jobStatus != null && o1.jobStatus.getSimulationMessage() != null) {
                        s1 = o1.jobStatus.getSimulationMessage().getDisplayMessage();
                    }
                    if (o2.jobStatus != null && o2.jobStatus.getSimulationMessage() != null) {
                        s2 = o2.jobStatus.getSimulationMessage().getDisplayMessage();
                    }
                    return scale * s1.compareToIgnoreCase(s2);
                case iColSite:
                    s1 = o1.jobStatus.getServerID().toString();
                    s2 = o2.jobStatus.getServerID().toString();
                    return scale * s1.compareToIgnoreCase(s2);
                default:
                    return 0;
            }
        }
    };
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) SchedulerStatus(cbit.vcell.server.SimulationJobStatus.SchedulerStatus) MathModelLink(cbit.vcell.server.MathModelLink) Date(java.util.Date) Comparator(java.util.Comparator) SimpleJobStatus(cbit.vcell.server.SimpleJobStatus)

Example 4 with BioModelLink

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

the class SimulationJobsTableModel method refreshData.

public void refreshData() {
    List<SimpleJobStatus> allJobStatusList = new ArrayList<>();
    for (SimpleJobStatus sjj : jobStatusArray) {
        allJobStatusList.add(sjj);
    }
    // ----- apply filters that are not applied by running the query -----------------
    List<SimpleJobStatus> filteredJobStatusList = new ArrayList<>();
    if (owner.getOrphanedButton().isSelected()) {
        // if checked, hide orphans
        for (SimpleJobStatus sjj : allJobStatusList) {
            if (sjj.simulationDocumentLink != null) {
                filteredJobStatusList.add(sjj);
            }
        }
    } else {
        filteredJobStatusList = allJobStatusList;
    }
    // ------- apply search --------------------------------------------------------------------
    List<SimpleJobStatus> jobStatusList = new ArrayList<>();
    if (searchText == null || searchText.length() == 0) {
        jobStatusList.addAll(filteredJobStatusList);
    } else {
        String lowerCaseSearchText = searchText.toLowerCase();
        for (SimpleJobStatus sjs : filteredJobStatusList) {
            // search in Solver column
            if (sjs.simulationMetadata.solverTaskDesc != null && sjs.simulationMetadata.solverTaskDesc.getSolverDescription() != null) {
                String str = sjs.simulationMetadata.solverTaskDesc.getSolverDescription().getDisplayLabel();
                if (str != null && str.toLowerCase().contains(lowerCaseSearchText)) {
                    jobStatusList.add(sjs);
                    continue;
                }
            }
            // search in Message column
            if (sjs.jobStatus != null && sjs.jobStatus.getSimulationMessage() != null) {
                String str = sjs.jobStatus.getSimulationMessage().getDisplayMessage();
                if (str != null && str.toLowerCase().contains(lowerCaseSearchText)) {
                    jobStatusList.add(sjs);
                    continue;
                }
            }
            // search in Model name, Application name (if available)
            String str = null;
            if (sjs.simulationDocumentLink instanceof BioModelLink) {
                BioModelLink bml = (BioModelLink) sjs.simulationDocumentLink;
                str = "(BM) " + bml.bioModelName + ",(App) " + bml.simContextName;
            } else if (sjs.simulationDocumentLink instanceof MathModelLink) {
                MathModelLink mml = (MathModelLink) sjs.simulationDocumentLink;
                str = "(MM) " + mml.mathModelName;
            }
            if (str != null && !str.isEmpty() && str.toLowerCase().contains(lowerCaseSearchText)) {
                jobStatusList.add(sjs);
                continue;
            }
            // Search in Simulation name
            str = sjs.simulationMetadata.simname;
            if (str != null && !str.isEmpty() && str.toLowerCase().contains(lowerCaseSearchText)) {
                jobStatusList.add(sjs);
                continue;
            }
        }
    }
    setData(jobStatusList);
    GuiUtils.flexResizeTableColumns(ownerTable);
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) ArrayList(java.util.ArrayList) MathModelLink(cbit.vcell.server.MathModelLink) SimpleJobStatus(cbit.vcell.server.SimpleJobStatus)

Example 5 with BioModelLink

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

the class SimulationRepresentation method getBioModelLink.

private static BioModelLink getBioModelLink(BioModel bioModel, SimulationRep simulationRep) {
    SimulationContext simContext = null;
    for (SimulationContext sc : bioModel.getSimulationContexts()) {
        if (sc.getMathDescription().getKey().equals(simulationRep.getMathKey())) {
            simContext = sc;
            break;
        }
    }
    BioModelLink bioModelLink = new BioModelLink(bioModel.getVersion().getVersionKey().toString(), bioModel.getVersion().getBranchID().toString(), bioModel.getVersion().getName(), (simContext != null) ? (simContext.getVersion().getVersionKey().toString()) : null, (simContext != null) ? (simContext.getVersion().getBranchID().toString()) : null, (simContext != null) ? (simContext.getVersion().getName()) : null);
    return bioModelLink;
}
Also used : BioModelLink(cbit.vcell.server.BioModelLink) SimulationContext(cbit.vcell.mapping.SimulationContext)

Aggregations

BioModelLink (cbit.vcell.server.BioModelLink)6 MathModelLink (cbit.vcell.server.MathModelLink)4 SimpleJobStatus (cbit.vcell.server.SimpleJobStatus)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 SimulationContext (cbit.vcell.mapping.SimulationContext)1 BioModelSimulationLinkTable (cbit.vcell.modeldb.BioModelSimulationLinkTable)1 MathModelSimulationLinkTable (cbit.vcell.modeldb.MathModelSimulationLinkTable)1 SimContextRep (cbit.vcell.modeldb.SimContextRep)1 SimpleJobStatusPersistent (cbit.vcell.server.SimpleJobStatusPersistent)1 SimulationDocumentLink (cbit.vcell.server.SimulationDocumentLink)1 SchedulerStatus (cbit.vcell.server.SimulationJobStatus.SchedulerStatus)1 SimulationJobStatusPersistent (cbit.vcell.server.SimulationJobStatusPersistent)1 MathOverrides (cbit.vcell.solver.MathOverrides)1 SimulationMetadata (cbit.vcell.solver.SimulationMetadata)1 Gson (com.google.gson.Gson)1 BigDecimal (java.math.BigDecimal)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Statement (java.sql.Statement)1