airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Added TaskContext and updated ProcessContext
Date Mon, 15 Jun 2015 16:02:54 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 62ad1c2c0 -> 59d2f2507


Added TaskContext and updated ProcessContext


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/59d2f250
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/59d2f250
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/59d2f250

Branch: refs/heads/master
Commit: 59d2f2507647ec3cbd0f4a89f2fefc1efd33d077
Parents: 62ad1c2
Author: Shameera Rathanyaka <shameerainfo@gmail.com>
Authored: Mon Jun 15 12:02:52 2015 -0400
Committer: Shameera Rathanyaka <shameerainfo@gmail.com>
Committed: Mon Jun 15 12:02:52 2015 -0400

----------------------------------------------------------------------
 .../gfac/core/context/ProcessContext.java       | 21 +++++++++
 .../airavata/gfac/core/context/TaskContext.java | 49 ++++++++++++++++++++
 .../gfac/core/task/JobSubmissionTask.java       |  6 ++-
 .../apache/airavata/gfac/core/task/Task.java    | 31 +++++++++++++
 .../src/main/resources/gfac-config.yaml         | 10 ++++
 .../apache/airavata/gfac/impl/GFacEngine.java   |  3 +-
 6 files changed, 118 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
index 7db8a9e..7ac2807 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/ProcessContext.java
@@ -22,11 +22,14 @@
 package org.apache.airavata.gfac.core.context;
 
 import org.apache.airavata.common.utils.LocalEventPublisher;
+import org.apache.airavata.gfac.core.task.Task;
 import org.apache.airavata.model.process.ProcessModel;
 import org.apache.airavata.registry.cpi.AppCatalog;
 import org.apache.airavata.registry.cpi.ExperimentCatalog;
 import org.apache.curator.framework.CuratorFramework;
 
+import java.util.List;
+
 public class ProcessContext {
 	// process model
     private ExperimentCatalog experimentCatalog;
@@ -37,6 +40,8 @@ public class ProcessContext {
 	private final String gatewayId;
 	private final String tokenId;
 	private ProcessModel processModel;
+	private String workingDir;
+	private List<Task> taskChain;
 
 	public ProcessContext(String processId, String gatewayId, String tokenId) {
 		this.processId = processId;
@@ -97,4 +102,20 @@ public class ProcessContext {
 	public void setProcessModel(ProcessModel processModel) {
 		this.processModel = processModel;
 	}
+
+	public String getWorkingDir() {
+		return workingDir;
+	}
+
+	public void setWorkingDir(String workingDir) {
+		this.workingDir = workingDir;
+	}
+
+	public List<Task> getTaskChain() {
+		return taskChain;
+	}
+
+	public void setTaskChain(List<Task> taskChain) {
+		this.taskChain = taskChain;
+	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/TaskContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/TaskContext.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/TaskContext.java
new file mode 100644
index 0000000..477c1ae
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/context/TaskContext.java
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.airavata.gfac.core.context;
+
+import org.apache.airavata.model.task.TaskModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TaskContext {
+	private static final Logger log = LoggerFactory.getLogger(TaskContext.class);
+
+	private TaskModel taskModel;
+	private ProcessContext parentProcessContext;
+
+	public TaskModel getTaskModel() {
+		return taskModel;
+	}
+
+	public void setTaskModel(TaskModel taskModel) {
+		this.taskModel = taskModel;
+	}
+
+	public ProcessContext getParentProcessContext() {
+		return parentProcessContext;
+	}
+
+	public void setParentProcessContext(ProcessContext parentProcessContext) {
+		this.parentProcessContext = parentProcessContext;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/JobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/JobSubmissionTask.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/JobSubmissionTask.java
index 41a540e..138ca63 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/JobSubmissionTask.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/JobSubmissionTask.java
@@ -20,5 +20,9 @@
  */
 package org.apache.airavata.gfac.core.task;
 
-public interface JobSubmissionTask{
+public interface JobSubmissionTask extends Task {
+
 }
+
+
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/Task.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/Task.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/Task.java
index 7e764d4..4019138 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/Task.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/task/Task.java
@@ -20,5 +20,36 @@
  */
 package org.apache.airavata.gfac.core.task;
 
+import org.apache.airavata.gfac.core.context.TaskContext;
+import org.apache.airavata.model.status.TaskState;
+import org.apache.airavata.model.task.TaskModel;
+
+import java.util.Map;
+
+/**
+ * All Tasks should inherit this interface.
+ */
 public interface Task {
+
+	/**
+	 * Task initialization method, this method will be invoked after create a new task instance.
+	 * @param propertyMap
+	 */
+	public void init(Map<String, String> propertyMap);
+
+	/**
+	 * This method will be called at the first time of task chain execution. This method should
called before recover
+	 * method. For a given task chain execute method only call one time. recover method may
be called more than once.
+	 * @param taskContext
+	 * @return
+	 */
+	public TaskState execute(TaskContext taskContext);
+
+	/**
+	 * This methond will be invoked at recover path.Before this method is invoked, execute method
should be invoked.
+	 * This method may be called zero or few time in a process chain.
+	 * @param taskContext
+	 * @return
+	 */
+	public TaskState recover(TaskContext taskContext);
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-core/src/main/resources/gfac-config.yaml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/gfac-config.yaml b/modules/gfac/gfac-core/src/main/resources/gfac-config.yaml
index f33ca6e..5530547 100644
--- a/modules/gfac/gfac-core/src/main/resources/gfac-config.yaml
+++ b/modules/gfac/gfac-core/src/main/resources/gfac-config.yaml
@@ -22,6 +22,11 @@ config:
  jobSubmitters:
    - submissionProtocol: SSH
      taskClass: org.apache.airavata.task.adapters.SSHJobSubmissionTask
+     properties:
+      - password: pwd123
+      - passPhrase: test
+      - privateKey: key
+      - publicKey: pubkey
 
    - submissionProtocol: GSISSH
      taskClass: org.apache.airavata.task.adapters.GSISSHJobSubmissionTask
@@ -36,6 +41,11 @@ config:
  fileTransferTasks:
    - transferProtocol: SCP
      taskClass: org.apache.airavata.task.adapters.SCPFileTransferTask
+     properties:
+      - password: pwd123
+      - passPhrase: test
+      - privateKey: key
+      - publicKey: pubkey
 
    - transferProtocol: HTTP
      taskClass: org.apache.airavata.task.adapters.HTTPFileTransferTask

http://git-wip-us.apache.org/repos/asf/airavata/blob/59d2f250/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngine.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngine.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngine.java
index 476da59..0085dde 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngine.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacEngine.java
@@ -74,7 +74,8 @@ public class GFacEngine {
 	}
 
 	public ProcessContext populateProcessContext(ProcessContext processContext) {
-		processContext.setProcessModel(new ProcessModel());
+		processContext.setProcessModel(new ProcessModel()); // TODO: get rocess model from app
catalog
+		// TODO: set datamovement protocol and jobsubmission protocol
 		return processContext;
 	}
 


Mime
View raw message