You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2015/04/29 16:51:36 UTC
[2/2] airavata git commit: fixing zookeeper wait with a timeout
fixing zookeeper wait with a timeout
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/bcc5f583
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/bcc5f583
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/bcc5f583
Branch: refs/heads/master
Commit: bcc5f583e22db7823b30b982b79fe50e80798c8a
Parents: 2f319c1 e5f16f2
Author: Lahiru Gunathilake <gl...@gmail.com>
Authored: Wed Apr 29 10:51:28 2015 -0400
Committer: Lahiru Gunathilake <gl...@gmail.com>
Committed: Wed Apr 29 10:51:28 2015 -0400
----------------------------------------------------------------------
.../server/src/main/resources/SGETemplate.xslt | 10 +-
.../main/resources/airavata-server.properties | 1 +
.../airavata/gfac/server/GfacServerHandler.java | 7 +-
.../airavata/gfac/core/cpi/BetterGfacImpl.java | 17 +-
.../gfac/monitor/email/EmailBasedMonitor.java | 92 +++---
.../monitor/email/parser/LSFEmailParser.java | 4 +-
.../monitor/email/parser/PBSEmailParser.java | 4 +-
.../monitor/email/parser/SLURMEmailParser.java | 6 +-
.../monitor/email/parser/UGEEmailParser.java | 99 +++++++
.../server/OrchestratorServerHandler.java | 3 +
.../validator/impl/SimpleAppDataValidator.java | 2 +-
.../persistance/registry/jpa/JPAConstants.java | 1 +
.../persistance/registry/jpa/ResourceUtils.java | 4 +-
.../registry/jpa/impl/ExperimentRegistry.java | 31 +-
.../registry/jpa/impl/LoggingRegistryImpl.java | 5 +
.../registry/jpa/impl/ProjectRegistry.java | 54 +++-
.../registry/jpa/impl/RegistryImpl.java | 34 ++-
.../jpa/resources/AbstractResource.java | 7 +-
.../registry/jpa/resources/Utils.java | 9 +
.../registry/jpa/resources/WorkerResource.java | 95 +++++-
.../registry/jpa/RegistryUseCaseTest.java | 290 +++++++++++++++++++
.../apache/airavata/registry/cpi/Registry.java | 16 +
.../airavata/registry/cpi/ResultOrderType.java | 29 ++
.../gsissh/src/main/resources/SGETemplate.xslt | 7 +-
24 files changed, 729 insertions(+), 98 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/bcc5f583/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --cc modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 836f04d,efd2005..0d1c8d3
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@@ -102,9 -102,8 +102,9 @@@ public class GfacServerHandler implemen
zk = new ZooKeeper(zkhostPort, AiravataZKUtils.getZKTimeout(), this); // no watcher is required, this will only use to store some data
gfacServer = ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_SERVER_NODE, "/gfac-server");
gfacExperiments = ServerSettings.getSetting(Constants.ZOOKEEPER_GFAC_EXPERIMENT_NODE, "/gfac-experiments");
+ logger.info("Waiting for zookeeper to connect to the server");
synchronized (mutex) {
-- mutex.wait(); // waiting for the syncConnected event
++ mutex.wait(5000); // waiting for the syncConnected event
}
storeServerConfig();
logger.info("Finished starting ZK: " + zk);
http://git-wip-us.apache.org/repos/asf/airavata/blob/bcc5f583/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
----------------------------------------------------------------------
diff --cc modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
index 69ed97e,30889b8..c080312
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
@@@ -957,23 -958,13 +957,16 @@@ public class BetterGfacImpl implements
}
public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
+ String experimentPath = null;
try {
- experimentPath = AiravataZKUtils.getExpZnodePath(jobExecutionContext.getExperimentID());
- } catch (ApplicationSettingsException e) {
- log.error(e.getMessage(), e);
- return;
- }
-
- try {
- if (zk == null || !zk.getState().isConnected()){
- zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), AiravataZKUtils.getZKTimeout(),this);
- }
- jobExecutionContext.setZk(zk);
+ jobExecutionContext.setZk(new ZooKeeper(AiravataZKUtils.getZKhostPort(), AiravataZKUtils.getZKTimeout(), this));
+ log.info("Waiting until zookeeper client connect to the server...");
synchronized (mutex) {
-- mutex.wait(); // waiting for the syncConnected event
++ mutex.wait(5000); // waiting for the syncConnected event
+ }
+ if (jobExecutionContext.getZk().exists(experimentPath, false) == null) {
+ log.error("Experiment is already finalized so no output handlers will be invoked");
+ return;
}
} catch (IOException e) {
log.error(e.getMessage(), e);
@@@ -1139,24 -1127,12 +1133,17 @@@
}
public void reInvokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
+ String experimentPath = null;
try {
- experimentPath = AiravataZKUtils.getExpZnodePath(jobExecutionContext.getExperimentID());
- } catch (ApplicationSettingsException e) {
- log.error(e.getMessage(), e);
- return;
- }
-
- try {
- if (zk == null || !zk.getState().isConnected()){
- zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), AiravataZKUtils.getZKTimeout(),this);
+ jobExecutionContext.setZk(new ZooKeeper(AiravataZKUtils.getZKhostPort(), AiravataZKUtils.getZKTimeout(), this));
+ log.info("Waiting for zookeeper to connect to the server");
+ synchronized (mutex) {
+ mutex.wait(); // waiting for the syncConnected event
+ }
+ if (jobExecutionContext.getZk().exists(experimentPath, false) == null) {
+ log.error("Experiment is already finalized so no output handlers will be invoked");
+ return;
}
- jobExecutionContext.setZk(zk);
-
} catch (IOException e) {
log.error(e.getMessage(), e);
} catch (ApplicationSettingsException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/bcc5f583/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------