@Test public void test_getSimTaskInfoFromSimJobName() throws NumberFormatException, HtcException { System.setProperty(PropertyLoader.vcellServerIDProperty,"ALPHA"); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_ALPHA_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_BETA_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_REL_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_TEST_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_TEST2_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_TEST3_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_TEST4_115785823_0_0")); Assert.assertEquals(new SimTaskInfo(new KeyValue("115785823"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_JUNK_115785823_0_0")); Assert.assertNotEquals(new SimTaskInfo(new KeyValue("555"),0,0), HtcProxy.getSimTaskInfoFromSimJobName("V_ALPHA_115785823_0_0")); try { HtcProxy.getSimTaskInfoFromSimJobName("V_ALPHA_115785823_0"); Assert.fail("SimTaskInfo "+"V_ALPHA_115785823_0"+" should have failed"); }catch (HtcException e){ } try { HtcProxy.getSimTaskInfoFromSimJobName("ALPHA_115785823_0_0"); Assert.fail("SimTaskInfo "+"V_ALPHA_115785823_0"+" should have failed"); }catch (HtcException e){ } }
public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws HtcException{ StringTokenizer tokens = new StringTokenizer(simJobName,"_"); String PREFIX = null; if (tokens.hasMoreTokens()){ PREFIX = tokens.nextToken(); } String SITE = null; if (tokens.hasMoreTokens()){ SITE = tokens.nextToken(); } String simIdString = null; if (tokens.hasMoreTokens()){ simIdString = tokens.nextToken(); } String jobIndexString = null; if (tokens.hasMoreTokens()){ jobIndexString = tokens.nextToken(); } String taskIdString = null; if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); return new SimTaskInfo(simId,jobIndex,taskId); }else{ throw new HtcException("simJobName : "+simJobName+" not in expected format for a simulation job name"); } }
HtcProxy { public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws HtcException{ StringTokenizer tokens = new StringTokenizer(simJobName,"_"); String PREFIX = null; if (tokens.hasMoreTokens()){ PREFIX = tokens.nextToken(); } String SITE = null; if (tokens.hasMoreTokens()){ SITE = tokens.nextToken(); } String simIdString = null; if (tokens.hasMoreTokens()){ simIdString = tokens.nextToken(); } String jobIndexString = null; if (tokens.hasMoreTokens()){ jobIndexString = tokens.nextToken(); } String taskIdString = null; if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); return new SimTaskInfo(simId,jobIndex,taskId); }else{ throw new HtcException("simJobName : "+simJobName+" not in expected format for a simulation job name"); } } }
HtcProxy { public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws HtcException{ StringTokenizer tokens = new StringTokenizer(simJobName,"_"); String PREFIX = null; if (tokens.hasMoreTokens()){ PREFIX = tokens.nextToken(); } String SITE = null; if (tokens.hasMoreTokens()){ SITE = tokens.nextToken(); } String simIdString = null; if (tokens.hasMoreTokens()){ simIdString = tokens.nextToken(); } String jobIndexString = null; if (tokens.hasMoreTokens()){ jobIndexString = tokens.nextToken(); } String taskIdString = null; if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); return new SimTaskInfo(simId,jobIndex,taskId); }else{ throw new HtcException("simJobName : "+simJobName+" not in expected format for a simulation job name"); } } HtcProxy(CommandService commandService, String htcUser); }
HtcProxy { public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws HtcException{ StringTokenizer tokens = new StringTokenizer(simJobName,"_"); String PREFIX = null; if (tokens.hasMoreTokens()){ PREFIX = tokens.nextToken(); } String SITE = null; if (tokens.hasMoreTokens()){ SITE = tokens.nextToken(); } String simIdString = null; if (tokens.hasMoreTokens()){ simIdString = tokens.nextToken(); } String jobIndexString = null; if (tokens.hasMoreTokens()){ jobIndexString = tokens.nextToken(); } String taskIdString = null; if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); return new SimTaskInfo(simId,jobIndex,taskId); }else{ throw new HtcException("simJobName : "+simJobName+" not in expected format for a simulation job name"); } } HtcProxy(CommandService commandService, String htcUser); static boolean isMyJob(HtcJobInfo htcJobInfo); abstract void killJobSafe(HtcJobInfo htcJobInfo); abstract void killJobUnsafe(HtcJobID htcJobId); abstract void killJobs(String htcJobSubstring); abstract Map<HtcJobInfo,HtcJobStatus> getJobStatus(List<HtcJobInfo> requestedHtcJobInfos); abstract HtcJobID submitJob(String jobName, File sub_file_internal, File sub_file_external, ExecutableCommand.Container commandSet,
			int ncpus, double memSize, Collection<PortableCommand> postProcessingCommands, SimulationTask simTask,File primaryUserDirExternal); abstract HtcJobID submitOptimizationJob(String jobName, File sub_file_internal, File sub_file_external,File optProblemInput,File optProblemOutput); abstract HtcProxy cloneThreadsafe(); abstract Map<HtcJobInfo,HtcJobStatus> getRunningJobs(); abstract PartitionStatistics getPartitionStatistics(); final CommandService getCommandService(); final String getHtcUser(); static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName); static String createHtcSimJobName(SimTaskInfo simTaskInfo); static void writeUnixStyleTextFile(File file, String javaString); abstract String getSubmissionFileExtension(); static MemLimitResults getMemoryLimit(String vcellUserid,KeyValue simID,SolverDescription solverDescription,double estimatedMemSizeMB); static boolean isStochMultiTrial(SimulationTask simTask); }
HtcProxy { public static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName) throws HtcException{ StringTokenizer tokens = new StringTokenizer(simJobName,"_"); String PREFIX = null; if (tokens.hasMoreTokens()){ PREFIX = tokens.nextToken(); } String SITE = null; if (tokens.hasMoreTokens()){ SITE = tokens.nextToken(); } String simIdString = null; if (tokens.hasMoreTokens()){ simIdString = tokens.nextToken(); } String jobIndexString = null; if (tokens.hasMoreTokens()){ jobIndexString = tokens.nextToken(); } String taskIdString = null; if (tokens.hasMoreTokens()){ taskIdString = tokens.nextToken(); } if (PREFIX.equals("V") && SITE!=null && simIdString!=null && jobIndexString!=null && taskIdString!=null){ KeyValue simId = new KeyValue(simIdString); int jobIndex = Integer.valueOf(jobIndexString); int taskId = Integer.valueOf(taskIdString); return new SimTaskInfo(simId,jobIndex,taskId); }else{ throw new HtcException("simJobName : "+simJobName+" not in expected format for a simulation job name"); } } HtcProxy(CommandService commandService, String htcUser); static boolean isMyJob(HtcJobInfo htcJobInfo); abstract void killJobSafe(HtcJobInfo htcJobInfo); abstract void killJobUnsafe(HtcJobID htcJobId); abstract void killJobs(String htcJobSubstring); abstract Map<HtcJobInfo,HtcJobStatus> getJobStatus(List<HtcJobInfo> requestedHtcJobInfos); abstract HtcJobID submitJob(String jobName, File sub_file_internal, File sub_file_external, ExecutableCommand.Container commandSet,
			int ncpus, double memSize, Collection<PortableCommand> postProcessingCommands, SimulationTask simTask,File primaryUserDirExternal); abstract HtcJobID submitOptimizationJob(String jobName, File sub_file_internal, File sub_file_external,File optProblemInput,File optProblemOutput); abstract HtcProxy cloneThreadsafe(); abstract Map<HtcJobInfo,HtcJobStatus> getRunningJobs(); abstract PartitionStatistics getPartitionStatistics(); final CommandService getCommandService(); final String getHtcUser(); static SimTaskInfo getSimTaskInfoFromSimJobName(String simJobName); static String createHtcSimJobName(SimTaskInfo simTaskInfo); static void writeUnixStyleTextFile(File file, String javaString); abstract String getSubmissionFileExtension(); static MemLimitResults getMemoryLimit(String vcellUserid,KeyValue simID,SolverDescription solverDescription,double estimatedMemSizeMB); static boolean isStochMultiTrial(SimulationTask simTask); static final Logger LG; final static String HTC_SIMULATION_JOB_NAME_PREFIX; static final boolean bDebugMemLimit; }