Refactored code
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/50e5ceea Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/50e5ceea Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/50e5ceea Branch: refs/heads/orchestratorJobThrottleFeature Commit: 50e5ceea06c3c1568b835510803ca95d3b9d699f Parents: 3cfc711 Author: shamrath <[email protected]> Authored: Fri Sep 26 11:12:19 2014 -0400 Committer: shamrath <[email protected]> Committed: Fri Sep 26 11:12:19 2014 -0400 ---------------------------------------------------------------------- .../airavata/orchestrator/core/utils/OrchestratorUtils.java | 8 +++----- .../orchestrator/cpi/impl/SimpleOrchestratorImpl.java | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/50e5ceea/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java index d51cce7..c668fac 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java @@ -142,11 +142,9 @@ public class OrchestratorUtils { public static boolean isJobSpaceAvailable(String communityUserName, String computeHostName, String queueName, int resourceMaxJobCount) throws ApplicationSettingsException { - if (communityUserName == null) { - throw new IllegalArgumentException("Community user name should not be null"); - } - if (computeHostName == null) { - throw new IllegalArgumentException("Compute resource should not be null"); + if (communityUserName == null || computeHostName == null) { + throw new IllegalArgumentException("Either Community user name or copute host name should not be null , " + + "communityUserName = " + communityUserName + " , computeHostName = " + computeHostName); } String keyPath = new StringBuilder("/" + Constants.STAT).append("/").append(communityUserName) .append("/").toString(); http://git-wip-us.apache.org/repos/asf/airavata/blob/50e5ceea/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java ---------------------------------------------------------------------- diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java index 53edc83..181eb62 100644 --- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java +++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java @@ -118,9 +118,9 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{ task.getTaskScheduling().getQueueName()); synchronized (this) { - boolean spaceAvaialble = OrchestratorUtils.isJobSpaceAvailable(communityUserName, + boolean spaceAvailable = OrchestratorUtils.isJobSpaceAvailable(communityUserName, computeResourceDes.getHostName(), batchQueue.getQueueName(), batchQueue.getMaxJobsInQueue()); - if (spaceAvaialble) { + if (spaceAvailable) { if (jobSubmitter.submit(experimentId, taskId, tokenId)) { logger.info("Job submitted, experiment Id : " + experimentId + " , task Id : " + taskId); Map<String, Integer> jobUpdateMap = new HashMap<String, Integer>();
