You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/05/13 21:40:51 UTC
[1/2] airavata git commit: Added Experiment state transition validate
method to Experiment Registry
Repository: airavata
Updated Branches:
refs/heads/master 2fe26fb6e -> 473723565
Added Experiment state transition validate method to Experiment Registry
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/563c6248
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/563c6248
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/563c6248
Branch: refs/heads/master
Commit: 563c62488c6cc735080613d771096878d71f3f21
Parents: 16b58b8
Author: shamrath <sh...@gmail.com>
Authored: Wed May 13 15:40:29 2015 -0400
Committer: shamrath <sh...@gmail.com>
Committed: Wed May 13 15:40:29 2015 -0400
----------------------------------------------------------------------
.../registry/jpa/impl/ExperimentRegistry.java | 55 +++++++++++++++++---
1 file changed, 49 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/563c6248/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index a0e9ecf..acc6779 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -482,14 +482,15 @@ public class ExperimentRegistry {
}
status.setExperimentResource(experiment);
status.setStatusUpdateTime(AiravataUtils.getTime(experimentStatus.getTimeOfStateChange()));
- if (experimentStatus.getExperimentState() == null) {
- status.setState(ExperimentState.UNKNOWN.toString());
- } else {
+ if (status.getState() == null) {
+ status.setState(ExperimentState.UNKNOWN.name());
+ }
+ if (isValidStatusTransition(ExperimentState.valueOf(status.getState()), experimentStatus.getExperimentState())) {
status.setState(experimentStatus.getExperimentState().toString());
+ status.setStatusType(StatusType.EXPERIMENT.toString());
+ status.save();
+ logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
}
- status.setStatusType(StatusType.EXPERIMENT.toString());
- status.save();
- logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
} catch (Exception e) {
logger.errorId(expId, "Error while updating experiment status...", e);
throw new RegistryException(e);
@@ -3011,4 +3012,46 @@ public class ExperimentRegistry {
throw new RegistryException(e);
}
}
+
+ public boolean isValidStatusTransition(ExperimentState oldState, ExperimentState nextState) {
+ if (nextState == null) {
+ return false;
+ }
+ switch (oldState) {
+ case CREATED:
+ return true;
+ case VALIDATED:
+ return nextState != ExperimentState.CREATED;
+ case SCHEDULED:
+ return nextState != ExperimentState.CREATED
+ || nextState != ExperimentState.VALIDATED;
+ case LAUNCHED:
+ return nextState != ExperimentState.CREATED
+ || nextState != ExperimentState.VALIDATED
+ || nextState != ExperimentState.SCHEDULED;
+ case EXECUTING:
+ return nextState != ExperimentState.CREATED
+ || nextState != ExperimentState.VALIDATED
+ || nextState != ExperimentState.SCHEDULED
+ || nextState != ExperimentState.LAUNCHED;
+
+ case CANCELING:
+ return nextState == ExperimentState.CANCELING
+ || nextState == ExperimentState.CANCELED
+ || nextState == ExperimentState.COMPLETED
+ || nextState == ExperimentState.FAILED;
+ case CANCELED:
+ return nextState == ExperimentState.CANCELED;
+ case COMPLETED:
+ return nextState == ExperimentState.COMPLETED;
+ case FAILED:
+ return nextState == ExperimentState.FAILED;
+ //case SUSPENDED: // We don't change state to SUSPEND
+ case UNKNOWN:
+ return true;
+ default:
+ return false;
+ }
+ }
+ß
}
[2/2] airavata git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/airavata
Posted by sh...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/47372356
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/47372356
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/47372356
Branch: refs/heads/master
Commit: 4737235654d2eae5672b26ea99302de3da4fc57d
Parents: 563c624 2fe26fb
Author: shamrath <sh...@gmail.com>
Authored: Wed May 13 15:40:45 2015 -0400
Committer: shamrath <sh...@gmail.com>
Committed: Wed May 13 15:40:45 2015 -0400
----------------------------------------------------------------------
.../api/server/listener/AiravataExperimentStatusUpdator.java | 2 +-
.../airavata/orchestrator/server/OrchestratorServerHandler.java | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------