You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by go...@apache.org on 2017/04/13 17:37:07 UTC
[4/4] airavata git commit: Refactor airavata-worker-commons to
airavata-worker-core
Refactor airavata-worker-commons to airavata-worker-core
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/56c67173
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/56c67173
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/56c67173
Branch: refs/heads/feature-workload-mgmt
Commit: 56c671738090373a18aeeee5c484a7a86093156a
Parents: 4f6ac4d
Author: Gourav Shenoy <go...@apache.org>
Authored: Thu Apr 13 13:37:00 2017 -0400
Committer: Gourav Shenoy <go...@apache.org>
Committed: Thu Apr 13 13:37:00 2017 -0400
----------------------------------------------------------------------
modules/worker/pom.xml | 14 +-
modules/worker/task-envsetup/pom.xml | 7 +
modules/worker/task-jobsubmission/pom.xml | 2 +-
modules/worker/worker-commons/pom.xml | 63 --
.../authentication/AuthenticationInfo.java | 27 -
.../authentication/GSIAuthenticationInfo.java | 43 -
.../authentication/SSHKeyAuthentication.java | 90 ---
.../SSHPasswordAuthentication.java | 42 -
.../SSHPublicKeyAuthentication.java | 45 --
.../SSHPublicKeyFileAuthentication.java | 45 --
.../commons/cluster/AbstractRemoteCluster.java | 45 --
.../worker/commons/cluster/CommandInfo.java | 34 -
.../worker/commons/cluster/CommandOutput.java | 56 --
.../commons/cluster/JobSubmissionOutput.java | 87 --
.../worker/commons/cluster/OutputParser.java | 68 --
.../worker/commons/cluster/RawCommandInfo.java | 45 --
.../worker/commons/cluster/RemoteCluster.java | 165 ----
.../worker/commons/cluster/ServerInfo.java | 59 --
.../commons/config/DataTransferTaskConfig.java | 60 --
.../commons/config/JobSubmitterTaskConfig.java | 59 --
.../worker/commons/config/ResourceConfig.java | 63 --
.../commons/config/WorkerYamlConfigruation.java | 150 ----
.../worker/commons/context/ProcessContext.java | 806 -------------------
.../worker/commons/context/TaskContext.java | 139 ----
.../commons/exceptions/SSHApiException.java | 34 -
.../commons/exceptions/WorkerException.java | 47 --
.../airavata/worker/commons/task/Task.java | 62 --
.../worker/commons/task/TaskException.java | 44 -
.../commons/utils/JobManagerConfiguration.java | 34 -
.../worker/commons/utils/WorkerConstants.java | 82 --
.../worker/commons/utils/WorkerFactory.java | 82 --
.../worker/commons/utils/WorkerUtils.java | 214 -----
modules/worker/worker-core/pom.xml | 63 ++
.../authentication/AuthenticationInfo.java | 27 +
.../authentication/GSIAuthenticationInfo.java | 43 +
.../authentication/SSHKeyAuthentication.java | 90 +++
.../SSHPasswordAuthentication.java | 42 +
.../SSHPublicKeyAuthentication.java | 45 ++
.../SSHPublicKeyFileAuthentication.java | 45 ++
.../commons/cluster/AbstractRemoteCluster.java | 45 ++
.../worker/commons/cluster/CommandInfo.java | 34 +
.../worker/commons/cluster/CommandOutput.java | 56 ++
.../commons/cluster/JobSubmissionOutput.java | 87 ++
.../worker/commons/cluster/OutputParser.java | 68 ++
.../worker/commons/cluster/RawCommandInfo.java | 45 ++
.../worker/commons/cluster/RemoteCluster.java | 165 ++++
.../worker/commons/cluster/ServerInfo.java | 59 ++
.../commons/config/DataTransferTaskConfig.java | 60 ++
.../commons/config/JobSubmitterTaskConfig.java | 59 ++
.../worker/commons/config/ResourceConfig.java | 63 ++
.../commons/config/WorkerYamlConfigruation.java | 150 ++++
.../worker/commons/context/ProcessContext.java | 806 +++++++++++++++++++
.../worker/commons/context/TaskContext.java | 139 ++++
.../commons/exceptions/SSHApiException.java | 34 +
.../commons/exceptions/WorkerException.java | 47 ++
.../airavata/worker/commons/task/Task.java | 62 ++
.../worker/commons/task/TaskException.java | 44 +
.../commons/utils/JobManagerConfiguration.java | 34 +
.../worker/commons/utils/WorkerConstants.java | 82 ++
.../worker/commons/utils/WorkerFactory.java | 82 ++
.../worker/commons/utils/WorkerUtils.java | 214 +++++
61 files changed, 2801 insertions(+), 2802 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/pom.xml
----------------------------------------------------------------------
diff --git a/modules/worker/pom.xml b/modules/worker/pom.xml
index e2681b8..0a05fbe 100644
--- a/modules/worker/pom.xml
+++ b/modules/worker/pom.xml
@@ -17,20 +17,12 @@
<description>Encapsulates tasks</description>
<url>http://airavata.apache.org/</url>
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>task-envsetup</module>
- </modules>
- </profile>
- </profiles>
<modules>
+ <module>worker-core</module>
+ <module>task-envsetup</module>
<module>task-jobsubmission</module>
</modules>
+
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/task-envsetup/pom.xml
----------------------------------------------------------------------
diff --git a/modules/worker/task-envsetup/pom.xml b/modules/worker/task-envsetup/pom.xml
index 2e6cfff..4906cab 100644
--- a/modules/worker/task-envsetup/pom.xml
+++ b/modules/worker/task-envsetup/pom.xml
@@ -16,5 +16,12 @@
<description>Environment setup task implementation.</description>
<url>http://airavata.apache.org/</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-worker-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/task-jobsubmission/pom.xml
----------------------------------------------------------------------
diff --git a/modules/worker/task-jobsubmission/pom.xml b/modules/worker/task-jobsubmission/pom.xml
index dfdf734..0d468da 100644
--- a/modules/worker/task-jobsubmission/pom.xml
+++ b/modules/worker/task-jobsubmission/pom.xml
@@ -18,7 +18,7 @@
<dependencies>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-worker-commons</artifactId>
+ <artifactId>airavata-worker-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/pom.xml
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/pom.xml b/modules/worker/worker-commons/pom.xml
deleted file mode 100644
index 7dceaa6..0000000
--- a/modules/worker/worker-commons/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-worker</artifactId>
- <version>0.17-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-worker-commons</artifactId>
- <name>Worker Commons - Holds commons for all workers</name>
- <description>Environment setup task implementation.</description>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.53</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messaging-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.5</version>
- </dependency>
- <!-- Configuration file read-->
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>${snakeyaml.version}</version>
- </dependency>
- <!-- Guava -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- </dependencies>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/AuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/AuthenticationInfo.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/AuthenticationInfo.java
deleted file mode 100644
index 51e94c8..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/AuthenticationInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-/**
- * An empty interface that represents authentication data to the API.
- */
-public interface AuthenticationInfo {
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/GSIAuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/GSIAuthenticationInfo.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/GSIAuthenticationInfo.java
deleted file mode 100644
index db33fb2..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/GSIAuthenticationInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-import org.ietf.jgss.GSSCredential;
-
-import java.util.Properties;
-
-/**
- * Authentication data. Could be MyProxy user name, password, could be GSSCredentials
- * or could be SSH keys.
- */
-public abstract class GSIAuthenticationInfo implements AuthenticationInfo {
-
- public Properties properties = new Properties();
-
- public abstract GSSCredential getCredentials() throws SecurityException;
-
- public Properties getProperties() {
- return properties;
- }
-
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHKeyAuthentication.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHKeyAuthentication.java
deleted file mode 100644
index 57a567e..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHKeyAuthentication.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 2:39 PM
- */
-
-/**
- * Abstracts out common methods for SSH key authentication.
- */
-public class SSHKeyAuthentication implements AuthenticationInfo {
-
- private String userName;
- private byte[] privateKey;
- private byte[] publicKey;
- private String passphrase;
- private String knownHostsFilePath;
- private String strictHostKeyChecking; // yes or no
-
- public SSHKeyAuthentication() {
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public byte[] getPrivateKey() {
- return privateKey;
- }
-
- public void setPrivateKey(byte[] privateKey) {
- this.privateKey = privateKey;
- }
-
- public byte[] getPublicKey() {
- return publicKey;
- }
-
- public void setPublicKey(byte[] publicKey) {
- this.publicKey = publicKey;
- }
-
- public String getPassphrase() {
- return passphrase;
- }
-
- public void setPassphrase(String passphrase) {
- this.passphrase = passphrase;
- }
-
- public String getKnownHostsFilePath() {
- return knownHostsFilePath;
- }
-
- public void setKnownHostsFilePath(String knownHostsFilePath) {
- this.knownHostsFilePath = knownHostsFilePath;
- }
-
- public String getStrictHostKeyChecking() {
- return strictHostKeyChecking;
- }
-
- public void setStrictHostKeyChecking(String strictHostKeyChecking) {
- this.strictHostKeyChecking = strictHostKeyChecking;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPasswordAuthentication.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPasswordAuthentication.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPasswordAuthentication.java
deleted file mode 100644
index 2f9d372..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPasswordAuthentication.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-/**
- * Password authentication for vanilla SSH.
- */
-public class SSHPasswordAuthentication implements AuthenticationInfo {
-
- private String userName;
- private String password;
-
- public SSHPasswordAuthentication(String userName, String password) {
- this.userName = userName;
- this.password = password;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public String getPassword() {
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyAuthentication.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyAuthentication.java
deleted file mode 100644
index 8134065..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyAuthentication.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-/**
- * Public key authentication for vanilla SSH.
- * The public key and private key are returned as byte arrays. Useful when we store private key/public key
- * in a secure storage such as credential store. API user should implement this.
- */
-public interface SSHPublicKeyAuthentication extends AuthenticationInfo {
-
- /**
- * Gets the public key as byte array.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The public key as a byte array.
- */
- byte[] getPrivateKey(String userName, String hostName);
-
- /**
- * Gets the private key as byte array.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The private key as a byte array.
- */
- byte[] getPublicKey(String userName, String hostName);
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyFileAuthentication.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyFileAuthentication.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyFileAuthentication.java
deleted file mode 100644
index 1915d21..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/authentication/SSHPublicKeyFileAuthentication.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * 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.worker.commons.authentication;
-
-/**
- * Public key authentication for vanilla SSH.
- * The public key and private key stored files are returned. API user should implement this.
- */
-public interface SSHPublicKeyFileAuthentication extends AuthenticationInfo {
-
- /**
- * The file which contains the public key.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The name of the file which contains the public key.
- */
- String getPublicKeyFile(String userName, String hostName);
-
- /**
- * The file which contains the public key.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The name of the file which contains the private key.
- */
- String getPrivateKeyFile(String userName, String hostName);
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/AbstractRemoteCluster.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/AbstractRemoteCluster.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/AbstractRemoteCluster.java
deleted file mode 100644
index 11f2c03..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/AbstractRemoteCluster.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-import org.apache.airavata.worker.commons.authentication.AuthenticationInfo;
-import org.apache.airavata.worker.commons.utils.JobManagerConfiguration;
-
-public abstract class AbstractRemoteCluster implements RemoteCluster {
-
- protected final OutputParser outputParser;
- protected final AuthenticationInfo authenticationInfo;
- protected final ServerInfo serverInfo;
- protected final JobManagerConfiguration jobManagerConfiguration;
-
- public AbstractRemoteCluster(ServerInfo serverInfo,
- JobManagerConfiguration jobManagerConfiguration,
- AuthenticationInfo authenticationInfo) {
-
- this.serverInfo = serverInfo;
- this.jobManagerConfiguration = jobManagerConfiguration;
- this.authenticationInfo = authenticationInfo;
- if (jobManagerConfiguration != null) {
- this.outputParser = jobManagerConfiguration.getParser();
- }else {
- this.outputParser = null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandInfo.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandInfo.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandInfo.java
deleted file mode 100644
index 559430a..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandInfo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-/**
- * Encapsulates information about
- */
-public interface CommandInfo {
-
- /**
- * Gets the executable command as a string.
- * @return String encoded command. Should be able to execute
- * directly on remote shell. Should includes appropriate parameters.
- */
- String getCommand();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandOutput.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandOutput.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandOutput.java
deleted file mode 100644
index 791616c..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/CommandOutput.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-
-import com.jcraft.jsch.Channel;
-
-import java.io.OutputStream;
-
-/**
- * Output of a certain command. TODO rethink
- */
-public interface CommandOutput {
-
- /**
- * Gets the output of the command as a stream.
- * @param channel Command output as a stream.
- */
- void onOutput(Channel channel);
-
- /**
- * Gets standard error as a output stream.
- * @return Command error as a stream.
- */
- OutputStream getStandardError();
-
- /**
- * The command exit code.
- * @param code The program exit code
- */
- void exitCode(int code);
-
- /**
- * Return the exit code of the command execution.
- * @return exit code
- */
- int getExitCode();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/JobSubmissionOutput.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/JobSubmissionOutput.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/JobSubmissionOutput.java
deleted file mode 100644
index 85cb033..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/JobSubmissionOutput.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-public class JobSubmissionOutput {
-
- private int exitCode = Integer.MIN_VALUE;
- private String stdOut;
- private String stdErr;
- private String command;
- private String jobId;
- private boolean isJobSubmissionFailed;
- private String failureReason;
-
- public int getExitCode() {
- return exitCode;
- }
-
- public void setExitCode(int exitCode) {
- this.exitCode = exitCode;
- }
-
- public String getStdOut() {
- return stdOut;
- }
-
- public void setStdOut(String stdOut) {
- this.stdOut = stdOut;
- }
-
- public String getStdErr() {
- return stdErr;
- }
-
- public void setStdErr(String stdErr) {
- this.stdErr = stdErr;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
-
- public boolean isJobSubmissionFailed() {
- return isJobSubmissionFailed;
- }
-
- public void setJobSubmissionFailed(boolean jobSubmissionFailed) {
- isJobSubmissionFailed = jobSubmissionFailed;
- }
-
- public String getFailureReason() {
- return failureReason;
- }
-
- public void setFailureReason(String failureReason) {
- this.failureReason = failureReason;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/OutputParser.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/OutputParser.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/OutputParser.java
deleted file mode 100644
index f6f1824..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/OutputParser.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.SSHApiException;
-import org.apache.airavata.model.status.JobStatus;
-
-import java.util.Map;
-
-public interface OutputParser {
-
- /**
- * This can be used to parseSingleJob the result of a job submission to get the JobID
- * @param rawOutput
- * @return
- */
- public String parseJobSubmission(String rawOutput)throws GFacException;
-
-
- /**
- * Parse output return by job submission task and identify jobSubmission failures.
- * @param rawOutput
- * @return true if job submission has been failed, false otherwise.
- */
- public boolean isJobSubmissionFailed(String rawOutput);
-
-
- /**
- * This can be used to get the job status from the output
- * @param jobID
- * @param rawOutput
- */
- public JobStatus parseJobStatus(String jobID, String rawOutput)throws GFacException;
-
- /**
- * This can be used to parseSingleJob a big output and get multipleJob statuses
- * @param statusMap list of status map will return and key will be the job ID
- * @param rawOutput
- */
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput)throws GFacException;
-
- /**
- * filter the jobId value of given JobName from rawOutput
- * @param jobName
- * @param rawOutput
- * @return
- * @throws SSHApiException
- */
- public String parseJobId(String jobName, String rawOutput) throws GFacException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RawCommandInfo.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RawCommandInfo.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RawCommandInfo.java
deleted file mode 100644
index 6045f4e..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RawCommandInfo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-/**
- * The raw command information. String returned by getCommand is directly executed in SSH
- * shell. E.g :- getCommand return string set for rawCommand - "/opt/torque/bin/qsub /home/ogce/test.pbs".
- */
-public class RawCommandInfo implements CommandInfo {
-
- private String rawCommand;
-
- public RawCommandInfo(String cmd) {
- this.rawCommand = cmd;
- }
-
- public String getCommand() {
- return this.rawCommand;
- }
-
- public String getRawCommand() {
- return rawCommand;
- }
-
- public void setRawCommand(String rawCommand) {
- this.rawCommand = rawCommand;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RemoteCluster.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RemoteCluster.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RemoteCluster.java
deleted file mode 100644
index 936e1ce..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/RemoteCluster.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-import com.jcraft.jsch.Session;
-import org.apache.airavata.model.status.JobStatus;
-import org.apache.airavata.worker.commons.authentication.AuthenticationInfo;
-import org.apache.airavata.worker.commons.exceptions.WorkerException;
-import org.apache.airavata.worker.commons.exceptions.SSHApiException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * This interface represents a RemoteCluster machine
- * End users of the API can implement this and come up with their own
- * implementations, but mostly this interface is for internal usage.
- */
-public interface RemoteCluster { // FIXME: replace SSHApiException with suitable exception.
-
- /**
- * This will submit a job to the cluster with a given pbs file and some parameters
- *
- * @param jobScriptFilePath path of the job script file
- * @param workingDirectory working directory where pbs should has to copy
- * @return jobId after successful job submission
- * @throws SSHApiException throws exception during error
- */
- public JobSubmissionOutput submitBatchJob(String jobScriptFilePath, String workingDirectory) throws WorkerException;
-
- /**
- * This will copy the localFile to remoteFile location in configured cluster
- *
- * @param localFile local file path of the file which needs to copy to remote location
- * @param remoteFile remote file location, this can be a directory too
- * @throws SSHApiException throws exception during error
- */
- public void copyTo(String localFile, String remoteFile) throws WorkerException;
-
- /**
- * This will copy a remote file in path rFile to local file lFile
- *
- * @param remoteFile remote file path, this has to be a full qualified path
- * @param localFile This is the local file to copy, this can be a directory too
- */
- public void copyFrom(String remoteFile, String localFile) throws WorkerException;
-
- /**
- * This wil copy source remote file to target remote file.
- *
- * @param sourceFile remote file path, this has to be a full qualified path
- * @param destinationFile This is the local file to copy, this can be a directory too
- * @param session jcraft session of other coner of thirdparty file transfer.
- * @param inOrOut direction to file transfer , to the remote cluster(DIRECTION.IN) or from the remote cluster(DIRECTION.OUT)
- *
- */
- public void scpThirdParty(String sourceFile,
- String destinationFile,
- Session session,
- DIRECTION inOrOut,
- boolean ignoreEmptyFile) throws WorkerException;
-
- /**
- * This will create directories in computing resources
- *
- * @param directoryPath the full qualified path for the directory user wants to create
- * @throws SSHApiException throws during error
- */
- public void makeDirectory(String directoryPath) throws WorkerException;
-
- /**
- * This will delete the given job from the queue
- *
- * @param jobID jobId of the job which user wants to delete
- * @return return the description of the deleted job
- * @throws SSHApiException throws exception during error
- */
- public JobStatus cancelJob(String jobID) throws WorkerException;
-
- /**
- * This will get the job status of the the job associated with this jobId
- *
- * @param jobID jobId of the job user want to get the status
- * @return job status of the given jobID
- * @throws SSHApiException throws exception during error
- */
- public JobStatus getJobStatus(String jobID) throws WorkerException;
-
- /**
- * This will get the job status of the the job associated with this jobId
- *
- * @param jobName jobName of the job user want to get the status
- * @return jobId of the given jobName
- * @throws SSHApiException throws exception during error
- */
- public String getJobIdByJobName(String jobName, String userName) throws WorkerException;
-
- /**
- * This method can be used to poll the jobstatuses based on the given
- * user but we should pass the jobID list otherwise we will get unwanted
- * job statuses which submitted by different middleware outside apache
- * airavata with the same uername which we are not considering
- *
- * @param userName userName of the jobs which required to get the status
- * @param jobIDs precises set of jobIDs
- */
- public void getJobStatuses(String userName, Map<String, JobStatus> jobIDs) throws WorkerException;
-
- /**
- * This will list directories in computing resources
- *
- * @param directoryPath the full qualified path for the directory user wants to create
- * @throws SSHApiException throws during error
- */
- public List<String> listDirectory(String directoryPath) throws WorkerException;
-
- /**
- * This method can use to execute custom command on remote compute resource.
- * @param commandInfo
- * @return <code>true</code> if command successfully executed, <code>false</code> otherwise.
- * @throws SSHApiException
- */
- public boolean execute(CommandInfo commandInfo) throws WorkerException;
-
- /**
- * This method can be used to get created ssh session
- * to reuse the created session.
- */
- public Session getSession() throws WorkerException;
-
- /**
- * This method can be used to close the connections initialized
- * to handle graceful shutdown of the system
- */
- public void disconnect() throws WorkerException;
-
- /**
- * This gives the server Info
- */
- public ServerInfo getServerInfo();
-
- public AuthenticationInfo getAuthentication();
- enum DIRECTION {
- TO,
- FROM
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/ServerInfo.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/ServerInfo.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/ServerInfo.java
deleted file mode 100644
index a451d2b..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/cluster/ServerInfo.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * 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.worker.commons.cluster;
-
-/**
- * Encapsulate server information.
- */
-public class ServerInfo {
- private static int DEFAULT_PORT = 22;
- private String host;
- private String userName;
- private int port;
- private String credentialToken;
-
- public ServerInfo(String userName, String host, String credentialToken) {
- this(userName, host, credentialToken, DEFAULT_PORT);
- }
-
- public ServerInfo(String userName, String host, String credentialToken, int port) {
- this.host = host;
- this.userName = userName;
- this.port = port;
- this.credentialToken = credentialToken;
- }
-
- public String getHost() {
- return host;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public int getPort() {
- return port;
- }
-
- public String getCredentialToken() {
- return credentialToken;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/DataTransferTaskConfig.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/DataTransferTaskConfig.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/DataTransferTaskConfig.java
deleted file mode 100644
index 1241435..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/DataTransferTaskConfig.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- *
- * 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.worker.commons.config;
-
-import org.apache.airavata.model.data.movement.DataMovementProtocol;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class DataTransferTaskConfig {
- private DataMovementProtocol transferProtocol;
- private String taskClass;
- private Map<String,String> properties = new HashMap<>();
-
-
- public DataMovementProtocol getTransferProtocol() {
- return transferProtocol;
- }
-
- public void setTransferProtocol(DataMovementProtocol transferProtocol) {
- this.transferProtocol = transferProtocol;
- }
-
- public String getTaskClass() {
- return taskClass;
- }
-
- public void setTaskClass(String taskClass) {
- this.taskClass = taskClass;
- }
-
- public void addProperty(String key, String value) {
- properties.put(key, value);
- }
-
- public void addProperties(Map<String, String> propMap) {
- propMap.forEach(properties::put);
- }
-
- public Map<String,String> getProperties(){
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/JobSubmitterTaskConfig.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/JobSubmitterTaskConfig.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/JobSubmitterTaskConfig.java
deleted file mode 100644
index 5744345..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/JobSubmitterTaskConfig.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- *
- * 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.worker.commons.config;
-
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class JobSubmitterTaskConfig {
- private JobSubmissionProtocol submissionProtocol;
- private String taskClass;
- private Map<String,String> properties = new HashMap<>();
-
- public JobSubmissionProtocol getSubmissionProtocol() {
- return submissionProtocol;
- }
-
- public void setSubmissionProtocol(JobSubmissionProtocol submissionProtocol) {
- this.submissionProtocol = submissionProtocol;
- }
-
- public String getTaskClass() {
- return taskClass;
- }
-
- public void setTaskClass(String taskClass) {
- this.taskClass = taskClass;
- }
-
- public void addProperty(String key, String value) {
- properties.put(key, value);
- }
-
- public void addProperties(Map<String, String> propMap) {
- propMap.forEach(properties::put);
- }
-
- public Map<String,String> getProperties(){
- return properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/ResourceConfig.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/ResourceConfig.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/ResourceConfig.java
deleted file mode 100644
index 12eed5a..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/ResourceConfig.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- *
- * 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.worker.commons.config;
-
-import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType;
-
-import java.util.List;
-
-public class ResourceConfig {
- private ResourceJobManagerType jobManagerType;
- private String commandOutputParser;
- private String emailParser;
- private List<String> resourceEmailAddresses;
-
- public ResourceJobManagerType getJobManagerType() {
- return jobManagerType;
- }
-
- public void setJobManagerType(ResourceJobManagerType jobManagerType) {
- this.jobManagerType = jobManagerType;
- }
-
- public String getCommandOutputParser() {
- return commandOutputParser;
- }
-
- public void setCommandOutputParser(String commandOutputParser) {
- this.commandOutputParser = commandOutputParser;
- }
-
- public String getEmailParser() {
- return emailParser;
- }
-
- public void setEmailParser(String emailParser) {
- this.emailParser = emailParser;
- }
-
- public List<String> getResourceEmailAddresses() {
- return resourceEmailAddresses;
- }
-
- public void setResourceEmailAddresses(List<String> resourceEmailAddresses) {
- this.resourceEmailAddresses = resourceEmailAddresses;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/56c67173/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/WorkerYamlConfigruation.java
----------------------------------------------------------------------
diff --git a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/WorkerYamlConfigruation.java b/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/WorkerYamlConfigruation.java
deleted file mode 100644
index 5d2e372..0000000
--- a/modules/worker/worker-commons/src/main/java/org/apache/airavata/worker/commons/config/WorkerYamlConfigruation.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- *
- * 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.worker.commons.config;
-
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType;
-import org.apache.airavata.model.data.movement.DataMovementProtocol;
-import org.apache.airavata.worker.commons.exceptions.WorkerException;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class WorkerYamlConfigruation {
-
- private static final String CONFIG = "config";
- private static final String JOB_SUBMITTERS = "jobSubmitters";
- private static final String SUBMISSIO_PROTOCOL = "submissionProtocol";
- private static final String TASK_CLASS = "taskClass";
- private static final String COMMON_TASKS = "commonTasks";
- private static final String TYPE = "type";
- private static final String FILE_TRANSFER_TASKS = "fileTransferTasks";
- private static final String TRANSFER_PROTOCOL = "transferProtocol";
- private static final String RESOURCES = "resources";
- private static final String JOB_MANAGER_TYPE = "jobManagerType";
- private static final String COMMAND_OUTPUT_PARSER = "commandOutputParser";
- private static final String EMAIL_PARSER = "emailParser";
- private static final String RESOURCE_EMAIL_ADDRESS = "resourceEmailAddresses";
- private static final String PROPERTIES = "properties";
-
- private List<JobSubmitterTaskConfig> jobSubmitters = new ArrayList<>();
- private List<DataTransferTaskConfig> fileTransferTasks = new ArrayList<>();
- private List<ResourceConfig> resources = new ArrayList<>();
-
-
- public WorkerYamlConfigruation() throws WorkerException {
- InputStream resourceAsStream = WorkerYamlConfigruation.class.getClassLoader().
- getResourceAsStream("gfac-config.yaml");
- parse(resourceAsStream);
- }
-
- private void parse(InputStream resourceAsStream) throws WorkerException {
- if (resourceAsStream == null) {
- throw new WorkerException("Configuration file{gfac-config.yaml} is not fund");
- }
- Yaml yaml = new Yaml();
- Object load = yaml.load(resourceAsStream);
- if (load == null) {
- throw new WorkerException("Yaml configuration object null");
- }
-
- if (load instanceof Map) {
- Map<String, Object> loadMap = (Map<String, Object>) load;
- String identifier;
- List<Map<String,Object >> jobSubYamls = (List<Map<String, Object>>) loadMap.get(JOB_SUBMITTERS);
- JobSubmitterTaskConfig jobSubmitterTaskConfig;
- if (jobSubYamls != null) {
- for (Map<String, Object> jobSub : jobSubYamls) {
- jobSubmitterTaskConfig = new JobSubmitterTaskConfig();
- identifier = ((String) jobSub.get(SUBMISSIO_PROTOCOL));
- jobSubmitterTaskConfig.setSubmissionProtocol(JobSubmissionProtocol.valueOf(identifier));
- jobSubmitterTaskConfig.setTaskClass(((String) jobSub.get(TASK_CLASS)));
- Object propertiesObj = jobSub.get(PROPERTIES);
- List propertiesList;
- if (propertiesObj instanceof List) {
- propertiesList = ((List) propertiesObj);
- if (propertiesList.size() > 0) {
- Map<String, String> props = (Map<String, String>) propertiesList.get(0);
- jobSubmitterTaskConfig.addProperties(props);
- }
- }
- jobSubmitters.add(jobSubmitterTaskConfig);
- }
- }
-
- List<Map<String, Object>> fileTransYamls = (List<Map<String, Object>>) loadMap.get(FILE_TRANSFER_TASKS);
- DataTransferTaskConfig dataTransferTaskConfig;
- if (fileTransYamls != null) {
- for (Map<String, Object> fileTransConfig : fileTransYamls) {
- dataTransferTaskConfig = new DataTransferTaskConfig();
- identifier = ((String) fileTransConfig.get(TRANSFER_PROTOCOL));
- dataTransferTaskConfig.setTransferProtocol(DataMovementProtocol.valueOf(identifier));
- dataTransferTaskConfig.setTaskClass(((String) fileTransConfig.get(TASK_CLASS)));
- Object propertiesObj = fileTransConfig.get(PROPERTIES);
- List propertiesList;
- if (propertiesObj instanceof List) {
- propertiesList = (List) propertiesObj;
- if (propertiesList.size() > 0) {
- Map<String, String> props = (Map<String, String>) propertiesList.get(0);
- dataTransferTaskConfig.addProperties(props);
- }
- }
- fileTransferTasks.add(dataTransferTaskConfig);
- }
- }
-
- List<Map<String, Object>> resourcesYaml = (List<Map<String, Object>>) loadMap.get(RESOURCES);
- ResourceConfig resourceConfig;
- if (resourcesYaml != null) {
- for (Map<String, Object> resource : resourcesYaml) {
- resourceConfig = new ResourceConfig();
- identifier = resource.get(JOB_MANAGER_TYPE).toString();
- resourceConfig.setJobManagerType(ResourceJobManagerType.valueOf(identifier));
- resourceConfig.setCommandOutputParser(resource.get(COMMAND_OUTPUT_PARSER).toString());
- Object emailParser = resource.get(EMAIL_PARSER);
- if (emailParser != null){
- resourceConfig.setEmailParser(emailParser.toString());
- }
- List<String> emailAddressList = (List<String>) resource.get(RESOURCE_EMAIL_ADDRESS);
- resourceConfig.setResourceEmailAddresses(emailAddressList);
- resources.add(resourceConfig);
- }
- }
- }
- }
-
- public List<JobSubmitterTaskConfig> getJobSbumitters() {
- return jobSubmitters;
- }
-
- public List<DataTransferTaskConfig> getFileTransferTasks() {
- return fileTransferTasks;
- }
-
- public List<ResourceConfig> getResourceConfiguration() {
- return resources;
- }
-
-
-
-}