diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5dc63e514a..e23cdee11c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -49,7 +49,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -60,7 +60,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -74,4 +74,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/pythonCopasiOpt/vcell-opt/poetry.lock b/pythonCopasiOpt/vcell-opt/poetry.lock index 606aab791e..8b00c8a3be 100644 --- a/pythonCopasiOpt/vcell-opt/poetry.lock +++ b/pythonCopasiOpt/vcell-opt/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "anyio" @@ -1523,11 +1523,7 @@ files = [ ] [package.dependencies] -numpy = [ - {version = ">=1.20.3", markers = "python_version < \"3.10\""}, - {version = ">=1.23.2", markers = "python_version >= \"3.11\""}, - {version = ">=1.21.0", markers = "python_version >= \"3.10\" and python_version < \"3.11\""}, -] +numpy = {version = ">=1.20.3", markers = "python_version < \"3.10\""} python-dateutil = ">=2.8.1" pytz = ">=2020.1" @@ -2210,13 +2206,13 @@ win32 = ["pywin32"] [[package]] name = "shellingham" -version = "1.5.0" +version = "1.5.4" description = "Tool to Detect Surrounding Shell" optional = false -python-versions = ">=3.4" +python-versions = ">=3.7" files = [ - {file = "shellingham-1.5.0-py2.py3-none-any.whl", hash = "sha256:a8f02ba61b69baaa13facdba62908ca8690a94b8119b69f5ec5873ea85f7391b"}, - {file = "shellingham-1.5.0.tar.gz", hash = "sha256:72fb7f5c63103ca2cb91b23dee0c71fe8ad6fbfd46418ef17dbe40db51592dad"}, + {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, + {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, ] [[package]] @@ -2495,5 +2491,5 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" -python-versions = "^3.9" -content-hash = "421aec668be9be404488993f689d6eb93084d4b5bd306130fd79656dd2660513" +python-versions = "3.9.*" +content-hash = "cd637e67ad66110dd5d90d7a9a114972ae8a783cb4633adc5d7fbd3bf80a0b49" diff --git a/vcell-core/src/main/java/cbit/vcell/util/VCellSimStatus.java b/vcell-admin/src/main/java/org/vcell/admin/cli/tools/VCellSimStatus_NOT_USED.java similarity index 95% rename from vcell-core/src/main/java/cbit/vcell/util/VCellSimStatus.java rename to vcell-admin/src/main/java/org/vcell/admin/cli/tools/VCellSimStatus_NOT_USED.java index ca8edd9c29..b4fc095425 100644 --- a/vcell-core/src/main/java/cbit/vcell/util/VCellSimStatus.java +++ b/vcell-admin/src/main/java/org/vcell/admin/cli/tools/VCellSimStatus_NOT_USED.java @@ -1,4 +1,4 @@ -package cbit.vcell.util; +package org.vcell.admin.cli.tools; import java.io.BufferedReader; import java.io.File; @@ -14,6 +14,7 @@ import java.util.StringTokenizer; import java.util.TreeMap; +import cbit.vcell.message.server.htc.HtcProxy; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.vcell.util.BeanUtils; @@ -27,8 +28,8 @@ import net.schmizz.sshj.userauth.keyprovider.FileKeyProvider; import net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile; -public class VCellSimStatus { - private final static Logger lg = LogManager.getLogger(VCellSimStatus.class); +public class VCellSimStatus_NOT_USED { + private final static Logger lg = LogManager.getLogger(VCellSimStatus_NOT_USED.class); public static class CommandExecError extends Exception { public CommandExecError(String message){ @@ -115,7 +116,7 @@ public VCellSlurmAssoc(VCellSlurmAssoc other){ public static void main(String[] args){ if(args.length != 6){ - System.out.println("Usage: " + VCellSimStatus.class.getSimpleName() + " dbHost dbName dbUser dbPassword sshRSAKeyFile slurmHost"); + System.out.println("Usage: " + VCellSimStatus_NOT_USED.class.getSimpleName() + " dbHost dbName dbUser dbPassword sshRSAKeyFile slurmHost"); System.exit(1); } String dbHost = args[0]; @@ -138,7 +139,7 @@ public static void main(String[] args){ //TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') stmt = con.createStatement(); String sql = - "select 'V_' || vc_simulationjob.serverid || '_' || simref || '_' || vc_simulationjob.jobindex || '_' || vc_simulationjob.taskid slurnjobname,vc_userinfo.userid," + + "select '"+HtcProxy.JOB_NAME_PREFIX_SIMULATION+"' || vc_simulationjob.serverid || '_' || simref || '_' || vc_simulationjob.jobindex || '_' || vc_simulationjob.taskid slurnjobname,vc_userinfo.userid," + "vc_simulationjob.*" + " from vc_simulationjob,vc_simulation,vc_userinfo" + " where schedulerstatus not in (4,5,6) and vc_simulation.id=vc_simulationjob.simref" + @@ -230,7 +231,7 @@ public static void main(String[] args){ // continue; // } // String s = st.nextToken(); - if(nextStr.contains("V_")){ + if(nextStr.contains(HtcProxy.JOB_NAME_PREFIX_SIMULATION)){ StringTokenizer st = new StringTokenizer(nextStr, " ", false); //GEt slurmjobid (and array job index if present) String slurmJobIDAndArrayIndex = st.nextToken(); diff --git a/vcell-server/src/main/java/cbit/vcell/message/server/dispatcher/SimulationDispatcher.java b/vcell-server/src/main/java/cbit/vcell/message/server/dispatcher/SimulationDispatcher.java index f717b0a81e..c076e91880 100644 --- a/vcell-server/src/main/java/cbit/vcell/message/server/dispatcher/SimulationDispatcher.java +++ b/vcell-server/src/main/java/cbit/vcell/message/server/dispatcher/SimulationDispatcher.java @@ -382,6 +382,9 @@ public void run() { for (HtcJobInfo htcJobInfo : runningJobs.keySet()){ try { String simJobName = htcJobInfo.getJobName(); + if (!simJobName.startsWith(HtcProxy.JOB_NAME_PREFIX_SIMULATION)){ + continue; + } HtcProxy.SimTaskInfo simTaskInfo = HtcProxy.getSimTaskInfoFromSimJobName(simJobName); SimulationJobStatus simJobStatus = simulationDatabase.getLatestSimulationJobStatus(simTaskInfo.simId, simTaskInfo.jobIndex); String failureMessage = null; @@ -404,7 +407,7 @@ public void run() { } } } - if (killJob && HtcProxy.isMyJob(htcJobInfo)){ + if (killJob && HtcProxy.isMySimulationJob(htcJobInfo)){ if (lg.isWarnEnabled()) { lg.warn("killing " + htcJobInfo + ", " + failureMessage); } diff --git a/vcell-server/src/main/java/cbit/vcell/message/server/htc/HtcProxy.java b/vcell-server/src/main/java/cbit/vcell/message/server/htc/HtcProxy.java index e556300baa..cb19ed6884 100644 --- a/vcell-server/src/main/java/cbit/vcell/message/server/htc/HtcProxy.java +++ b/vcell-server/src/main/java/cbit/vcell/message/server/htc/HtcProxy.java @@ -32,6 +32,8 @@ public abstract class HtcProxy { public static final Logger LG = LogManager.getLogger(HtcProxy.class); + public static final String JOB_NAME_PREFIX_SIMULATION = "V_"; + public static final String JOB_NAME_PREFIX_COPASI_PAREST = "CopasiParest_"; public interface HtcProxyFactory { HtcProxy getHtcProxy(); @@ -124,17 +126,28 @@ public boolean equals(Object obj) { * set {@link HtcProxy#HTC_SIMULATION_JOB_NAME_PREFIX} * @return V_server */ - private static String jobNamePrefix( ){ - String stub = "V_"; + private static String simulationJobNamePrefix( ){ + String stub = JOB_NAME_PREFIX_SIMULATION; String server = PropertyLoader.getRequiredProperty(PropertyLoader.vcellServerIDProperty); return stub + server + "_"; } - - public static boolean isMyJob(HtcJobInfo htcJobInfo){ - return htcJobInfo.getJobName().startsWith(jobNamePrefix()); + + /** + * set {@link HtcProxy#HTC_SIMULATION_JOB_NAME_PREFIX} + * @return CopasiParest + */ + private static String parameterEstimationJobNamePrefix( ){ + return JOB_NAME_PREFIX_COPASI_PAREST; } - - public final static String HTC_SIMULATION_JOB_NAME_PREFIX = jobNamePrefix(); + + public static boolean isMySimulationJob(HtcJobInfo htcJobInfo){ + return htcJobInfo.getJobName().startsWith(simulationJobNamePrefix()); + } + public static boolean isMyParameterEstimationJob(HtcJobInfo htcJobInfo){ + return htcJobInfo.getJobName().startsWith(parameterEstimationJobNamePrefix()); + } + + public final static String HTC_SIMULATION_JOB_NAME_PREFIX = simulationJobNamePrefix(); protected final CommandService commandService; protected final String htcUser; @@ -196,7 +209,8 @@ public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } - if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ + String expectedSimPrefix = HtcProxy.JOB_NAME_PREFIX_SIMULATION.replace("_",""); + if (PREFIX.equals(expectedSimPrefix) && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); diff --git a/vcell-server/src/main/java/cbit/vcell/message/server/htc/slurm/SlurmProxy.java b/vcell-server/src/main/java/cbit/vcell/message/server/htc/slurm/SlurmProxy.java index 2e5cc336f1..8b53127d08 100644 --- a/vcell-server/src/main/java/cbit/vcell/message/server/htc/slurm/SlurmProxy.java +++ b/vcell-server/src/main/java/cbit/vcell/message/server/htc/slurm/SlurmProxy.java @@ -81,7 +81,7 @@ public static SlurmProxy createLocalProxy(List htcDispatchHostNames, Str @Override public void killJobSafe(HtcJobInfo htcJobInfo) throws ExecutableException, HtcException { final String JOB_CMD_DELETE = PropertyLoader.getProperty(PropertyLoader.slurm_cmd_scancel,"scancel"); - String[] cmd = new String[]{JOB_CMD_DELETE, "--jobname", htcJobInfo.getJobName(), Long.toString(htcJobInfo.getHtcJobID().getJobNumber())}; + String[] cmd = new String[]{JOB_CMD_DELETE,"-u",getHtcUser(), "--jobname", htcJobInfo.getJobName(), Long.toString(htcJobInfo.getHtcJobID().getJobNumber())}; try { //CommandOutput commandOutput = commandService.command(cmd, new int[] { 0, QDEL_JOB_NOT_FOUND_RETURN_CODE }); if (LG.isDebugEnabled()) { @@ -108,7 +108,7 @@ public void killJobSafe(HtcJobInfo htcJobInfo) throws ExecutableException, HtcEx @Override public void killJobUnsafe(HtcJobID htcJobId) throws ExecutableException, HtcException { final String JOB_CMD_DELETE = PropertyLoader.getProperty(PropertyLoader.slurm_cmd_scancel,"scancel"); - String[] cmd = new String[]{JOB_CMD_DELETE, Long.toString(htcJobId.getJobNumber())}; + String[] cmd = new String[]{JOB_CMD_DELETE, "-u", getHtcUser(), Long.toString(htcJobId.getJobNumber())}; try { //CommandOutput commandOutput = commandService.command(cmd, new int[] { 0, QDEL_JOB_NOT_FOUND_RETURN_CODE }); if (LG.isDebugEnabled()) { @@ -282,7 +282,7 @@ public Map getRunningJobs() throws ExecutableException final String JOB_CMD_SQUEUE = PropertyLoader.getProperty(PropertyLoader.slurm_cmd_squeue,"squeue"); // squeue -p vcell2 -O jobid:25,name:25,state:13 String partition = PropertyLoader.getRequiredProperty(PropertyLoader.slurm_partition); - String[] cmds = {JOB_CMD_SQUEUE,"-p",partition,"-O","jobid:25,name:25,state:13,batchhost"}; + String[] cmds = {JOB_CMD_SQUEUE,"-p",partition,"-u",getHtcUser(),"-O","jobid:25,name:25,state:13,batchhost"}; CommandOutput commandOutput = commandService.command(cmds); String output = commandOutput.getStandardOutput(); @@ -330,7 +330,7 @@ public Map getJobStatus(List requestedHtcJo jobNumbers.add(Long.toString(jobInfo.getHtcJobID().getJobNumber())); } String jobList = String.join(",", jobNumbers); - String[] cmds = {JOB_CMD_SACCT,"-P","-j",jobList,"-o","jobid%25,jobname%25,state%13"}; + String[] cmds = {JOB_CMD_SACCT,"-P","-u",getHtcUser(),"-j",jobList,"-o","jobid%25,jobname%25,state%13"}; CommandOutput commandOutput = commandService.command(cmds); String output = commandOutput.getStandardOutput(); diff --git a/vcell-server/src/test/java/cbit/vcell/message/server/htc/HtcProxyTest.java b/vcell-server/src/test/java/cbit/vcell/message/server/htc/HtcProxyTest.java index 854c099ee6..6d02a99a73 100644 --- a/vcell-server/src/test/java/cbit/vcell/message/server/htc/HtcProxyTest.java +++ b/vcell-server/src/test/java/cbit/vcell/message/server/htc/HtcProxyTest.java @@ -10,7 +10,7 @@ import org.vcell.util.document.KeyValue; import static cbit.vcell.message.server.htc.HtcProxy.getSimTaskInfoFromSimJobName; -import static cbit.vcell.message.server.htc.HtcProxy.isMyJob; +import static cbit.vcell.message.server.htc.HtcProxy.isMySimulationJob; import static cbit.vcell.server.HtcJobID.BatchSystemType.SLURM; import static org.junit.jupiter.api.Assertions.*; @@ -51,11 +51,11 @@ public void test_getSimTaskInfoFromSimJobName() throws NumberFormatException, Ht @Test public void test_isMyJob(){ PropertyLoader.setProperty(PropertyLoader.vcellServerIDProperty, "ALPHA"); - assertTrue(HtcProxy.isMyJob(new HtcJobInfo(new HtcJobID("1200725", BatchSystemType.SLURM), "V_ALPHA_115785823_0_0"))); - assertFalse(isMyJob(new HtcJobInfo(new HtcJobID("1200725", SLURM), "V_BETA_115785823_0_0"))); + assertTrue(HtcProxy.isMySimulationJob(new HtcJobInfo(new HtcJobID("1200725", BatchSystemType.SLURM), "V_ALPHA_115785823_0_0"))); + assertFalse(isMySimulationJob(new HtcJobInfo(new HtcJobID("1200725", SLURM), "V_BETA_115785823_0_0"))); PropertyLoader.setProperty(PropertyLoader.vcellServerIDProperty, "BETA"); - assertTrue(HtcProxy.isMyJob(new HtcJobInfo(new HtcJobID("1200725", BatchSystemType.SLURM), "V_BETA_115785823_0_0"))); + assertTrue(HtcProxy.isMySimulationJob(new HtcJobInfo(new HtcJobID("1200725", BatchSystemType.SLURM), "V_BETA_115785823_0_0"))); } }