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/06/05 20:53:39 UTC
[2/2] airavata git commit: Rename few interfaces to have generic
names which self descriptive
Rename few interfaces to have generic names which self descriptive
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/bad2c1c0
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/bad2c1c0
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/bad2c1c0
Branch: refs/heads/master
Commit: bad2c1c0a60fa605defaa4c9e45665d2f91a722a
Parents: 2f3da01
Author: Shameera Rathanyaka <sh...@gmail.com>
Authored: Fri Jun 5 14:53:35 2015 -0400
Committer: Shameera Rathanyaka <sh...@gmail.com>
Committed: Fri Jun 5 14:53:35 2015 -0400
----------------------------------------------------------------------
.../airavata/gfac/core/cluster/Cluster.java | 161 -------------------
.../gfac/core/cluster/RemoteCluster.java | 161 +++++++++++++++++++
.../gsi/ssh/impl/GSISSHAbstractCluster.java | 4 +-
.../gfac/gsi/ssh/impl/HPCRemoteCluster.java | 46 ++++++
.../airavata/gfac/gsi/ssh/impl/PBSCluster.java | 46 ------
.../handler/GSISSHDirectorySetupHandler.java | 14 +-
.../gfac/gsissh/handler/GSISSHInputHandler.java | 16 +-
.../gsissh/handler/GSISSHOutputHandler.java | 18 +--
.../gsissh/handler/NewGSISSHOutputHandler.java | 10 +-
.../gsissh/provider/impl/GSISSHProvider.java | 20 +--
.../gsissh/security/GSISecurityContext.java | 20 +--
.../gfac/gsissh/util/GFACGSISSHUtils.java | 36 ++---
.../airavata/gfac/monitor/HPCMonitorID.java | 4 +-
.../impl/pull/qstat/ResourceConnection.java | 16 +-
.../ssh/handler/AdvancedSCPInputHandler.java | 16 +-
.../ssh/handler/AdvancedSCPOutputHandler.java | 18 +--
.../gfac/ssh/handler/NewSSHOutputHandler.java | 10 +-
.../ssh/handler/SSHDirectorySetupHandler.java | 14 +-
.../gfac/ssh/handler/SSHInputHandler.java | 18 +--
.../gfac/ssh/handler/SSHOutputHandler.java | 20 +--
.../gfac/ssh/provider/impl/SSHProvider.java | 42 ++---
.../gfac/ssh/security/SSHSecurityContext.java | 12 +-
.../airavata/gfac/ssh/util/GFACSSHUtils.java | 56 +++----
.../airavata/gfac/ssh/util/HandleOutputs.java | 12 +-
.../services/impl/BigRed2TestWithSSHAuth.java | 10 +-
.../gfac/services/impl/CredentialStoreTest.java | 4 +-
.../impl/GSISSHProviderTestWithMyProxyAuth.java | 4 +-
.../impl/DefaultSSHApiTestWithMyProxyAuth.java | 4 +-
.../gfac/ssh/impl/VanilaTestWithSSHAuth.java | 34 ++--
.../apache/airavata/job/AMQPMonitorTest.java | 10 +-
.../job/QstatMonitorTestWithMyProxyAuth.java | 4 +-
31 files changed, 430 insertions(+), 430 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/Cluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/Cluster.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/Cluster.java
deleted file mode 100644
index b116bdc..0000000
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/Cluster.java
+++ /dev/null
@@ -1,161 +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.gfac.core.cluster;
-
-import com.jcraft.jsch.Session;
-import org.apache.airavata.gfac.core.JobDescriptor;
-import org.apache.airavata.gfac.core.SSHApiException;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * This interface represents a Cluster 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 Cluster {
-
- /**
- * This will submit a job to the cluster with a given pbs file and some parameters
- *
- * @param pbsFilePath path of the pbs file
- * @param workingDirectory working directory where pbs should has to copy
- * @return jobId after successful job submission
- * @throws SSHApiException throws exception during error
- */
- public String submitBatchJobWithScript(String pbsFilePath, String workingDirectory) throws SSHApiException;
-
- /**
- * This will submit the given job and not performing any monitoring
- *
- * @param jobDescriptor job descriptor to submit to cluster, this contains all the parameter
- * @return jobID after successful job submission.
- * @throws SSHApiException throws exception during error
- */
- public String submitBatchJob(JobDescriptor jobDescriptor) throws SSHApiException;
-
- /**
- * This will copy the localFile to remoteFile location in configured cluster
- *
- * @param remoteFile remote file location, this can be a directory too
- * @param localFile local file path of the file which needs to copy to remote location
- * @throws SSHApiException throws exception during error
- */
- public void scpTo(String remoteFile, String localFile) throws SSHApiException;
-
- /**
- * 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
- * @throws SSHApiException
- */
- public void scpFrom(String remoteFile, String localFile) throws SSHApiException;
-
- /**
- * 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
- * @throws SSHApiException
- */
- public void scpThirdParty(String remoteFileSorce, String remoteFileTarget) throws SSHApiException;
-
- /**
- * 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 SSHApiException;
-
-
- /**
- * This will get the job description of a job which is there in the cluster
- * if jbo is not available with the given ID it returns
- * @param jobID jobId has to pass
- * @return Returns full job description of the job which submitted successfully
- * @throws SSHApiException throws exception during error
- */
- public JobDescriptor getJobDescriptorById(String jobID) throws SSHApiException;
-
- /**
- * 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 JobDescriptor cancelJob(String jobID) throws SSHApiException;
-
- /**
- * 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 SSHApiException;
- /**
- * 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 SSHApiException;
-
- /**
- * 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
- * @return
- */
- public void getJobStatuses(String userName,Map<String,JobStatus> jobIDs)throws SSHApiException;
- /**
- * 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 SSHApiException;
-
- /**
- * This method can be used to get created ssh session
- * to reuse the created session.
- * @throws SSHApiException
- */
- public Session getSession() throws SSHApiException;
-
- /**
- * This method can be used to close the connections initialized
- * to handle graceful shutdown of the system
- * @throws SSHApiException
- */
- public void disconnect() throws SSHApiException;
-
- /**
- * This gives the server Info
- * @return
- */
- public ServerInfo getServerInfo();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/RemoteCluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/RemoteCluster.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/RemoteCluster.java
new file mode 100644
index 0000000..2bd4558
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cluster/RemoteCluster.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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.cluster;
+
+import com.jcraft.jsch.Session;
+import org.apache.airavata.gfac.core.JobDescriptor;
+import org.apache.airavata.gfac.core.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 {
+
+ /**
+ * This will submit a job to the cluster with a given pbs file and some parameters
+ *
+ * @param pbsFilePath path of the pbs file
+ * @param workingDirectory working directory where pbs should has to copy
+ * @return jobId after successful job submission
+ * @throws SSHApiException throws exception during error
+ */
+ public String submitBatchJobWithScript(String pbsFilePath, String workingDirectory) throws SSHApiException;
+
+ /**
+ * This will submit the given job and not performing any monitoring
+ *
+ * @param jobDescriptor job descriptor to submit to cluster, this contains all the parameter
+ * @return jobID after successful job submission.
+ * @throws SSHApiException throws exception during error
+ */
+ public String submitBatchJob(JobDescriptor jobDescriptor) throws SSHApiException;
+
+ /**
+ * This will copy the localFile to remoteFile location in configured cluster
+ *
+ * @param remoteFile remote file location, this can be a directory too
+ * @param localFile local file path of the file which needs to copy to remote location
+ * @throws SSHApiException throws exception during error
+ */
+ public void scpTo(String remoteFile, String localFile) throws SSHApiException;
+
+ /**
+ * 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
+ * @throws SSHApiException
+ */
+ public void scpFrom(String remoteFile, String localFile) throws SSHApiException;
+
+ /**
+ * 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
+ * @throws SSHApiException
+ */
+ public void scpThirdParty(String remoteFileSorce, String remoteFileTarget) throws SSHApiException;
+
+ /**
+ * 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 SSHApiException;
+
+
+ /**
+ * This will get the job description of a job which is there in the cluster
+ * if jbo is not available with the given ID it returns
+ * @param jobID jobId has to pass
+ * @return Returns full job description of the job which submitted successfully
+ * @throws SSHApiException throws exception during error
+ */
+ public JobDescriptor getJobDescriptorById(String jobID) throws SSHApiException;
+
+ /**
+ * 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 JobDescriptor cancelJob(String jobID) throws SSHApiException;
+
+ /**
+ * 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 SSHApiException;
+ /**
+ * 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 SSHApiException;
+
+ /**
+ * 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
+ * @return
+ */
+ public void getJobStatuses(String userName,Map<String,JobStatus> jobIDs)throws SSHApiException;
+ /**
+ * 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 SSHApiException;
+
+ /**
+ * This method can be used to get created ssh session
+ * to reuse the created session.
+ * @throws SSHApiException
+ */
+ public Session getSession() throws SSHApiException;
+
+ /**
+ * This method can be used to close the connections initialized
+ * to handle graceful shutdown of the system
+ * @throws SSHApiException
+ */
+ public void disconnect() throws SSHApiException;
+
+ /**
+ * This gives the server Info
+ * @return
+ */
+ public ServerInfo getServerInfo();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
index f89cb98..04241c8 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
@@ -36,7 +36,7 @@ import org.apache.airavata.gfac.core.authentication.SSHKeyAuthentication;
import org.apache.airavata.gfac.core.authentication.SSHPasswordAuthentication;
import org.apache.airavata.gfac.core.authentication.SSHPublicKeyAuthentication;
import org.apache.airavata.gfac.core.authentication.SSHPublicKeyFileAuthentication;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.cluster.JobStatus;
import org.apache.airavata.gfac.core.cluster.OutputParser;
import org.apache.airavata.gfac.core.cluster.RawCommandInfo;
@@ -69,7 +69,7 @@ import java.security.SecureRandom;
import java.util.List;
import java.util.Map;
-public class GSISSHAbstractCluster implements Cluster {
+public class GSISSHAbstractCluster implements RemoteCluster {
private static final Logger log = LoggerFactory.getLogger(GSISSHAbstractCluster.class);
public static final String X509_CERT_DIR = "X509_CERT_DIR";
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/HPCRemoteCluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/HPCRemoteCluster.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/HPCRemoteCluster.java
new file mode 100644
index 0000000..cc688e2
--- /dev/null
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/HPCRemoteCluster.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.gsi.ssh.impl;
+
+import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
+import org.apache.airavata.gfac.core.SSHApiException;
+import org.apache.airavata.gfac.core.cluster.ServerInfo;
+import org.apache.airavata.gfac.core.JobManagerConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * This is the default implementation of a cluster.
+ * this has most of the methods to be used by the end user of the
+ * library.
+ */
+public class HPCRemoteCluster extends GSISSHAbstractCluster {
+ private static final Logger log = LoggerFactory.getLogger(HPCRemoteCluster.class);
+
+
+ public HPCRemoteCluster(JobManagerConfiguration jobManagerConfiguration) {
+ super(jobManagerConfiguration);
+ }
+ public HPCRemoteCluster(ServerInfo serverInfo, AuthenticationInfo authenticationInfo, JobManagerConfiguration config) throws SSHApiException {
+ super(serverInfo, authenticationInfo,config);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
deleted file mode 100644
index 1d514f8..0000000
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
+++ /dev/null
@@ -1,46 +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.gfac.gsi.ssh.impl;
-
-import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
-import org.apache.airavata.gfac.core.SSHApiException;
-import org.apache.airavata.gfac.core.cluster.ServerInfo;
-import org.apache.airavata.gfac.core.JobManagerConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * This is the default implementation of a cluster.
- * this has most of the methods to be used by the end user of the
- * library.
- */
-public class PBSCluster extends GSISSHAbstractCluster {
- private static final Logger log = LoggerFactory.getLogger(PBSCluster.class);
-
-
- public PBSCluster(JobManagerConfiguration jobManagerConfiguration) {
- super(jobManagerConfiguration);
- }
- public PBSCluster(ServerInfo serverInfo, AuthenticationInfo authenticationInfo, JobManagerConfiguration config) throws SSHApiException {
- super(serverInfo, authenticationInfo,config);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index eeae272..8e243d3 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@ -21,13 +21,13 @@
package org.apache.airavata.gfac.gsissh.handler;
import org.apache.airavata.gfac.core.GFacException;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.core.cluster.Cluster;
import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.registry.cpi.ExpCatChildDataType;
import org.slf4j.Logger;
@@ -62,11 +62,11 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler {
makeDirectory(jobExecutionContext);
}
private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
String hostAddress = jobExecutionContext.getHostName();
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
try {
GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
} catch (GFacException e1) {
@@ -78,11 +78,11 @@ public class GSISSHDirectorySetupHandler extends AbstractHandler {
}
String workingDirectory = jobExecutionContext.getWorkingDir();
- cluster.makeDirectory(workingDirectory);
+ remoteCluster.makeDirectory(workingDirectory);
if(!jobExecutionContext.getInputDir().equals(workingDirectory))
- cluster.makeDirectory(jobExecutionContext.getInputDir());
+ remoteCluster.makeDirectory(jobExecutionContext.getInputDir());
if(!jobExecutionContext.getOutputDir().equals(workingDirectory))
- cluster.makeDirectory(jobExecutionContext.getOutputDir());
+ remoteCluster.makeDirectory(jobExecutionContext.getOutputDir());
DataTransferDetails detail = new DataTransferDetails();
TransferStatus status = new TransferStatus();
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index 958e04c..7b4f350 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@ -22,6 +22,7 @@ package org.apache.airavata.gfac.gsissh.handler;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.core.GFacException;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
@@ -29,7 +30,6 @@ import org.apache.airavata.gfac.core.handler.GFacHandlerException;
import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.core.cluster.Cluster;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
@@ -66,7 +66,7 @@ public class GSISSHInputHandler extends AbstractHandler {
DataTransferDetails detail = new DataTransferDetails();
TransferStatus status = new TransferStatus();
StringBuffer data = new StringBuffer("|");
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
String hostAddress = jobExecutionContext.getHostName();
@@ -74,8 +74,8 @@ public class GSISSHInputHandler extends AbstractHandler {
GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
}
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
@@ -123,7 +123,7 @@ public class GSISSHInputHandler extends AbstractHandler {
inputParamType.setValue(oldFiles.get(index));
data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index
} else {
- String stageInputFile = stageInputFiles(cluster, jobExecutionContext, paramValue);
+ String stageInputFile = stageInputFiles(remoteCluster, jobExecutionContext, paramValue);
inputParamType.setValue(stageInputFile);
StringBuffer temp = new StringBuffer(data.append(stageInputFile).append(",").toString());
status.setTransferState(TransferState.UPLOAD);
@@ -143,7 +143,7 @@ public class GSISSHInputHandler extends AbstractHandler {
// newFiles.add(oldFiles.get(index));
// data.append(oldFiles.get(index++)).append(",");
// } else {
-// String stageInputFiles = stageInputFiles(cluster, jobExecutionContext, paramValueEach);
+// String stageInputFiles = stageInputFiles(remoteCluster, jobExecutionContext, paramValueEach);
// status.setTransferState(TransferState.UPLOAD);
// detail.setTransferStatus(status);
// detail.setTransferDescription("Input Data Staged: " + stageInputFiles);
@@ -174,7 +174,7 @@ public class GSISSHInputHandler extends AbstractHandler {
jobExecutionContext.setInMessageContext(inputNew);
}
- private static String stageInputFiles(Cluster cluster, JobExecutionContext jobExecutionContext, String paramValue) throws IOException, GFacException {
+ private static String stageInputFiles(RemoteCluster remoteCluster, JobExecutionContext jobExecutionContext, String paramValue) throws IOException, GFacException {
int i = paramValue.lastIndexOf(File.separator);
String substring = paramValue.substring(i + 1);
try {
@@ -186,7 +186,7 @@ public class GSISSHInputHandler extends AbstractHandler {
int j = 1;
while(!success){
try {
- cluster.scpTo(targetFile, paramValue);
+ remoteCluster.scpTo(targetFile, paramValue);
success = true;
} catch (Exception e) {
log.info(e.getLocalizedMessage());
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index d93c2e3..a11b688 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -31,7 +31,7 @@ import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.impl.OutputUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
@@ -78,11 +78,11 @@ public class GSISSHOutputHandler extends AbstractHandler {
DataTransferDetails detail = new DataTransferDetails();
TransferStatus status = new TransferStatus();
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
throw new GFacProviderException("Security context is not set properly");
@@ -132,7 +132,7 @@ public class GSISSHOutputHandler extends AbstractHandler {
localStdOutFile = new File(outputDataDir + File.separator + jobExecutionContext.getApplicationName() + ".stdout");
while(stdOutStr.isEmpty()){
try {
- cluster.scpFrom(jobExecutionContext.getStandardOutput(), localStdOutFile.getAbsolutePath());
+ remoteCluster.scpFrom(jobExecutionContext.getStandardOutput(), localStdOutFile.getAbsolutePath());
stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
} catch (Exception e) {
log.error(e.getLocalizedMessage());
@@ -150,7 +150,7 @@ public class GSISSHOutputHandler extends AbstractHandler {
data.append(oldFiles.get(index++)).append(",");
} else {
localStdErrFile = new File(outputDataDir + File.separator + jobExecutionContext.getApplicationName() + ".stderr");
- cluster.scpFrom(jobExecutionContext.getStandardError(), localStdErrFile.getAbsolutePath());
+ remoteCluster.scpFrom(jobExecutionContext.getStandardError(), localStdErrFile.getAbsolutePath());
StringBuffer temp = new StringBuffer(data.append(localStdErrFile.getAbsolutePath()).append(",").toString());
GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
}
@@ -177,7 +177,7 @@ public class GSISSHOutputHandler extends AbstractHandler {
List<String> outputList = null;
int retry=3;
while(retry>0){
- outputList = cluster.listDirectory(jobExecutionContext.getOutputDir());
+ outputList = remoteCluster.listDirectory(jobExecutionContext.getOutputDir());
if (outputList.size() == 1 && outputList.get(0).isEmpty()) {
Thread.sleep(10000);
} else if (outputList.size() > 0) {
@@ -203,7 +203,7 @@ public class GSISSHOutputHandler extends AbstractHandler {
localFile = oldFiles.get(index);
data.append(oldFiles.get(index++)).append(",");
} else {
- cluster.scpFrom(downloadFile, outputDataDir);
+ remoteCluster.scpFrom(downloadFile, outputDataDir);
String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar) + 1, downloadFile.length());
localFile = outputDataDir + File.separator + fileName;
StringBuffer temp = new StringBuffer(data.append(localFile).append(",").toString());
@@ -262,7 +262,7 @@ public class GSISSHOutputHandler extends AbstractHandler {
outputFile = oldFiles.get(index);
data.append(oldFiles.get(index++)).append(",");
} else {
- cluster.scpFrom(jobExecutionContext.getOutputDir() + File.separator + valueList, outputDataDir);
+ remoteCluster.scpFrom(jobExecutionContext.getOutputDir() + File.separator + valueList, outputDataDir);
outputFile = outputDataDir + File.separator + valueList;
jobExecutionContext.addOutputFile(outputFile);
StringBuffer temp = new StringBuffer(data.append(outputFile).append(",").toString());
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
index 4c6d3bd..238d4e3 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/handler/NewGSISSHOutputHandler.java
@@ -12,7 +12,7 @@ import org.apache.airavata.gfac.core.GFacUtils;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
import org.apache.airavata.gfac.ssh.util.HandleOutputs;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
import org.apache.airavata.model.workspace.experiment.ErrorCategory;
@@ -39,11 +39,11 @@ public class NewGSISSHOutputHandler extends AbstractHandler{
log.error(e.getMessage());
throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
}
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
throw new GFacProviderException("Security context is not set properly");
@@ -61,7 +61,7 @@ public class NewGSISSHOutputHandler extends AbstractHandler{
}
super.invoke(jobExecutionContext);
- List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, cluster);
+ List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, remoteCluster);
try {
experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (RegistryException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index a4418fc..69edb7b 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@ -33,7 +33,7 @@ import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.util.GFACGSISSHUtils;
import org.apache.airavata.gfac.monitor.email.EmailBasedMonitor;
import org.apache.airavata.gfac.monitor.email.EmailMonitorFactory;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.SSHApiException;
import org.apache.airavata.gfac.core.JobDescriptor;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
@@ -84,25 +84,25 @@ public class GSISSHProvider extends AbstractProvider {
ApplicationDeploymentDescription appDeployDesc = jobExecutionContext.getApplicationContext()
.getApplicationDeploymentDescription();
JobDetails jobDetails = new JobDetails();
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
if (jobExecutionContext.getSecurityContext(jobExecutionContext.getHostName()) != null) {
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(jobExecutionContext.getHostName())).getPbsCluster();
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(jobExecutionContext.getHostName())).getRemoteCluster();
}
- if (cluster == null) {
+ if (remoteCluster == null) {
throw new GFacProviderException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
}
// This installed path is a mandetory field, because this could change based on the computing resource
- JobDescriptor jobDescriptor = GFACGSISSHUtils.createJobDescriptor(jobExecutionContext, cluster);
+ JobDescriptor jobDescriptor = GFACGSISSHUtils.createJobDescriptor(jobExecutionContext, remoteCluster);
jobDetails.setJobName(jobDescriptor.getJobName());
log.info(jobDescriptor.toXML());
data.append("jobDesc=").append(jobDescriptor.toXML());
jobDetails.setJobDescription(jobDescriptor.toXML());
- String jobID = cluster.submitBatchJob(jobDescriptor);
+ String jobID = remoteCluster.submitBatchJob(jobDescriptor);
jobExecutionContext.setJobDetails(jobDetails);
if (jobID == null) {
jobDetails.setJobID("none");
@@ -179,12 +179,12 @@ public class GSISSHProvider extends AbstractProvider {
JobDetails jobDetails = jobExecutionContext.getJobDetails();
String hostName = jobExecutionContext.getHostName();
try {
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
if (jobExecutionContext.getSecurityContext(hostName) == null) {
GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
}
- cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostName)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostName)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacProviderException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
@@ -196,7 +196,7 @@ public class GSISSHProvider extends AbstractProvider {
}
if (jobDetails.getJobID() != null) {
// if this operation success without any exceptions, we can assume cancel operation succeeded.
- cluster.cancelJob(jobDetails.getJobID());
+ remoteCluster.cancelJob(jobDetails.getJobID());
} else {
log.error("No Job Id is set, so cannot perform the cancel operation !!!");
return false;
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
index 7059475..dcdb3b0 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
@@ -23,7 +23,7 @@ package org.apache.airavata.gfac.gsissh.security;
import org.apache.airavata.credential.store.store.CredentialReader;
import org.apache.airavata.gfac.core.AbstractSecurityContext;
import org.apache.airavata.gfac.core.RequestData;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,12 +37,12 @@ public class GSISecurityContext extends AbstractSecurityContext {
* context name
*/
- private Cluster pbsCluster = null;
+ private RemoteCluster remoteCluster = null;
- public GSISecurityContext(CredentialReader credentialReader, RequestData requestData, Cluster pbsCluster) {
+ public GSISecurityContext(CredentialReader credentialReader, RequestData requestData, RemoteCluster remoteCluster) {
super(credentialReader, requestData);
- this.pbsCluster = pbsCluster;
+ this.remoteCluster = remoteCluster;
}
@@ -51,17 +51,17 @@ public class GSISecurityContext extends AbstractSecurityContext {
}
- public GSISecurityContext(Cluster pbsCluster) {
- this.setPbsCluster(pbsCluster);
+ public GSISecurityContext(RemoteCluster remoteCluster) {
+ this.setRemoteCluster(remoteCluster);
}
- public Cluster getPbsCluster() {
- return pbsCluster;
+ public RemoteCluster getRemoteCluster() {
+ return remoteCluster;
}
- public void setPbsCluster(Cluster pbsCluster) {
- this.pbsCluster = pbsCluster;
+ public void setRemoteCluster(RemoteCluster remoteCluster) {
+ this.remoteCluster = remoteCluster;
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index aa0b60e..6a4a23e 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -20,6 +20,8 @@
*/
package org.apache.airavata.gfac.gsissh.util;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
+import org.apache.airavata.gfac.gsi.ssh.impl.HPCRemoteCluster;
import org.apache.airavata.registry.cpi.AppCatalog;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
@@ -30,10 +32,8 @@ import org.apache.airavata.gfac.core.RequestData;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.core.GFacUtils;
-import org.apache.airavata.gfac.gsi.ssh.impl.PBSCluster;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.gsissh.security.TokenizedMyProxyAuthInfo;
-import org.apache.airavata.gfac.core.cluster.Cluster;
import org.apache.airavata.gfac.core.cluster.ServerInfo;
import org.apache.airavata.gfac.core.JobDescriptor;
import org.apache.airavata.gfac.core.JobManagerConfiguration;
@@ -64,7 +64,7 @@ public class GFACGSISSHUtils {
public static final String LSF_JOB_MANAGER = "lsf";
public static int maxClusterCount = 5;
- public static Map<String, List<Cluster>> clusters = new HashMap<String, List<Cluster>>();
+ public static Map<String, List<RemoteCluster>> clusters = new HashMap<String, List<RemoteCluster>>();
public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
JobSubmissionInterface jobSubmissionInterface = jobExecutionContext.getPreferredJobSubmissionInterface();
@@ -79,7 +79,7 @@ public class GFACGSISSHUtils {
String credentialStoreToken = jobExecutionContext.getCredentialStoreToken(); // this is set by the framework
RequestData requestData = new RequestData(jobExecutionContext.getGatewayID());
requestData.setTokenId(credentialStoreToken);
- PBSCluster pbsCluster = null;
+ HPCRemoteCluster HPCRemoteCluster = null;
GSISecurityContext context = null;
TokenizedMyProxyAuthInfo tokenizedMyProxyAuthInfo = new TokenizedMyProxyAuthInfo(requestData);
@@ -103,22 +103,22 @@ public class GFACGSISSHUtils {
} else if (clusters.containsKey(key)) {
int i = new Random().nextInt(Integer.MAX_VALUE) % maxClusterCount;
if (clusters.get(key).get(i).getSession().isConnected()) {
- pbsCluster = (PBSCluster) clusters.get(key).get(i);
+ HPCRemoteCluster = (HPCRemoteCluster) clusters.get(key).get(i);
} else {
clusters.get(key).remove(i);
recreate = true;
}
if (!recreate) {
try {
- pbsCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
+ HPCRemoteCluster.listDirectory("~/"); // its hard to trust isConnected method, so we try to connect if it works we are good,else we recreate
} catch (Exception e) {
clusters.get(key).remove(i);
logger.info("Connection found the connection map is expired, so we create from the scratch");
maxClusterCount++;
- recreate = true; // we make the pbsCluster to create again if there is any exception druing connection
+ recreate = true; // we make the HPCRemoteCluster to create again if there is any exception druing connection
}
logger.info("Re-using the same connection used with the connection string:" + key);
- context = new GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData, pbsCluster);
+ context = new GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData, HPCRemoteCluster);
}
} else {
recreate = true;
@@ -145,16 +145,16 @@ public class GFACGSISSHUtils {
jConfig = CommonUtils.getLSFJobManager(installedParentPath);
}
}
- pbsCluster = new PBSCluster(serverInfo, tokenizedMyProxyAuthInfo, jConfig);
- context = new GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData, pbsCluster);
- List<Cluster> pbsClusters = null;
+ HPCRemoteCluster = new HPCRemoteCluster(serverInfo, tokenizedMyProxyAuthInfo, jConfig);
+ context = new GSISecurityContext(tokenizedMyProxyAuthInfo.getCredentialReader(), requestData, HPCRemoteCluster);
+ List<RemoteCluster> pbsRemoteClusters = null;
if (!(clusters.containsKey(key))) {
- pbsClusters = new ArrayList<Cluster>();
+ pbsRemoteClusters = new ArrayList<RemoteCluster>();
} else {
- pbsClusters = clusters.get(key);
+ pbsRemoteClusters = clusters.get(key);
}
- pbsClusters.add(pbsCluster);
- clusters.put(key, pbsClusters);
+ pbsRemoteClusters.add(HPCRemoteCluster);
+ clusters.put(key, pbsRemoteClusters);
}
}
@@ -165,7 +165,7 @@ public class GFACGSISSHUtils {
}
}
- public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext, Cluster cluster) {
+ public static JobDescriptor createJobDescriptor(JobExecutionContext jobExecutionContext, RemoteCluster remoteCluster) {
JobDescriptor jobDescriptor = new JobDescriptor();
TaskDetails taskData = jobExecutionContext.getTaskData();
ResourceJobManager resourceJobManager = jobExecutionContext.getResourceJobManager();
@@ -274,10 +274,10 @@ public class GFACGSISSHUtils {
}
jobDescriptor.setInputValues(inputValues);
- jobDescriptor.setUserName(((GSISSHAbstractCluster) cluster).getServerInfo().getUserName());
+ jobDescriptor.setUserName(((GSISSHAbstractCluster) remoteCluster).getServerInfo().getUserName());
jobDescriptor.setShellName("/bin/bash");
jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setOwner(((PBSCluster) cluster).getServerInfo().getUserName());
+ jobDescriptor.setOwner(((HPCRemoteCluster) remoteCluster).getServerInfo().getUserName());
ComputationalResourceScheduling taskScheduling = taskData.getTaskScheduling();
if (taskScheduling != null) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
index 22c3a14..69119d2 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
@@ -63,13 +63,13 @@ public class HPCMonitorID extends MonitorID {
ServerInfo serverInfo = null;
if (securityContext != null) {
if (securityContext instanceof GSISecurityContext){
- serverInfo = (((GSISecurityContext) securityContext).getPbsCluster()).getServerInfo();
+ serverInfo = (((GSISecurityContext) securityContext).getRemoteCluster()).getServerInfo();
if (serverInfo.getUserName() != null) {
setUserName(serverInfo.getUserName());
}
}
if (securityContext instanceof SSHSecurityContext){
- serverInfo = (((SSHSecurityContext) securityContext).getPbsCluster()).getServerInfo();
+ serverInfo = (((SSHSecurityContext) securityContext).getRemoteCluster()).getServerInfo();
if (serverInfo.getUserName() != null) {
setUserName(serverInfo.getUserName());
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
index 7429381..f388de5 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@ -24,7 +24,7 @@ import org.apache.airavata.gfac.core.GFacException;
import org.apache.airavata.gfac.core.SecurityContext;
import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
import org.apache.airavata.gfac.core.monitor.MonitorID;
-import org.apache.airavata.gfac.gsi.ssh.impl.PBSCluster;
+import org.apache.airavata.gfac.gsi.ssh.impl.HPCRemoteCluster;
import org.apache.airavata.gfac.gsissh.security.GSISecurityContext;
import org.apache.airavata.gfac.monitor.HostMonitorData;
import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
@@ -42,7 +42,7 @@ import java.util.TreeMap;
public class ResourceConnection {
private static final Logger log = LoggerFactory.getLogger(ResourceConnection.class);
- private PBSCluster cluster;
+ private HPCRemoteCluster cluster;
private AuthenticationInfo authenticationInfo;
@@ -54,11 +54,11 @@ public class ResourceConnection {
if(securityContext != null) {
if (securityContext instanceof GSISecurityContext) {
GSISecurityContext gsiSecurityContext = (GSISecurityContext) securityContext;
- cluster = (PBSCluster) gsiSecurityContext.getPbsCluster();
+ cluster = (HPCRemoteCluster) gsiSecurityContext.getRemoteCluster();
} else if (securityContext instanceof SSHSecurityContext) {
SSHSecurityContext sshSecurityContext = (SSHSecurityContext)
securityContext;
- cluster = (PBSCluster) sshSecurityContext.getPbsCluster();
+ cluster = (HPCRemoteCluster) sshSecurityContext.getRemoteCluster();
}
}
// we just use cluster configuration from the incoming request and construct a new cluster because for monitoring
@@ -74,11 +74,11 @@ public class ResourceConnection {
try {
GSISecurityContext securityContext = (GSISecurityContext)
monitorID.getJobExecutionContext().getSecurityContext(monitorID.getComputeResourceDescription().getHostName());
- cluster = (PBSCluster) securityContext.getPbsCluster();
+ cluster = (HPCRemoteCluster) securityContext.getRemoteCluster();
// we just use cluster configuration from the incoming request and construct a new cluster because for monitoring
// we are using our own credentials and not using one users account to do everything.
- cluster = new PBSCluster(cluster.getServerInfo(), authenticationInfo, cluster.getJobManagerConfiguration());
+ cluster = new HPCRemoteCluster(cluster.getServerInfo(), authenticationInfo, cluster.getJobManagerConfiguration());
} catch (GFacException e) {
log.error("Error reading data from job ExecutionContext");
}
@@ -140,11 +140,11 @@ public class ResourceConnection {
return JobState.UNKNOWN;
}
- public PBSCluster getCluster() {
+ public HPCRemoteCluster getCluster() {
return cluster;
}
- public void setCluster(PBSCluster cluster) {
+ public void setCluster(HPCRemoteCluster cluster) {
this.cluster = cluster;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
index d19ccb5..ec350a5 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
@@ -22,7 +22,7 @@ package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.gfac.core.GFacException;
import org.apache.airavata.gfac.core.SSHApiException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
@@ -93,7 +93,7 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
List<String> oldFiles = new ArrayList<String>();
MessageContext inputNew = new MessageContext();
StringBuffer data = new StringBuffer("|");
- Cluster pbsCluster = null;
+ RemoteCluster remoteCluster = null;
try {
String pluginData = GFacUtils.getHandlerData(jobExecutionContext, this.getClass().getName());
@@ -146,12 +146,12 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
URL file = new URL(paramValue);
String key = file.getUserInfo() + file.getHost() + DEFAULT_SSH_PORT;
GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, file.getUserInfo(), file.getHost(), DEFAULT_SSH_PORT);
- pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
+ remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster();
paramValue = file.getPath();
} catch (MalformedURLException e) {
String key = this.userName + this.hostName + DEFAULT_SSH_PORT;
GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, this.userName, this.hostName, DEFAULT_SSH_PORT);
- pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
+ remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster();
log.error(e.getLocalizedMessage(), e);
}
@@ -160,7 +160,7 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
inputParamType.setValue(oldFiles.get(index));
data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index
} else {
- String stageInputFile = stageInputFiles(pbsCluster, paramValue, parentPath);
+ String stageInputFile = stageInputFiles(remoteCluster, paramValue, parentPath);
inputParamType.setValue(stageInputFile);
StringBuffer temp = new StringBuffer(data.append(stageInputFile).append(",").toString());
status.setTransferState(TransferState.UPLOAD);
@@ -189,7 +189,7 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
// newFiles.add(oldFiles.get(index));
// data.append(oldFiles.get(index++)).append(",");
// } else {
-// String stageInputFiles = stageInputFiles(pbsCluster, paramValueEach, parentPath);
+// String stageInputFiles = stageInputFiles(remoteCluster, paramValueEach, parentPath);
// StringBuffer temp = new StringBuffer(data.append(stageInputFiles).append(",").toString());
// GFacUtils.savePluginData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName());
// newFiles.add(stageInputFiles);
@@ -217,9 +217,9 @@ public class AdvancedSCPInputHandler extends AbstractHandler {
this.invoke(jobExecutionContext);
}
- private String stageInputFiles(Cluster cluster, String paramValue, String parentPath) throws GFacException {
+ private String stageInputFiles(RemoteCluster remoteCluster, String paramValue, String parentPath) throws GFacException {
try {
- cluster.scpFrom(paramValue, parentPath);
+ remoteCluster.scpFrom(paramValue, parentPath);
return "file://" + parentPath + File.separator + (new File(paramValue)).getName();
} catch (SSHApiException e) {
log.error("Error tranfering remote file to local file, remote path: " + paramValue);
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index faef464..5dc2224 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -23,7 +23,7 @@ package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.core.GFacException;
import org.apache.airavata.gfac.core.SSHApiException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
@@ -94,7 +94,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
@Override
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- Cluster pbsCluster = null;
+ RemoteCluster remoteCluster = null;
AuthenticationInfo authenticationInfo = null;
if (password != null) {
authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
@@ -134,14 +134,14 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
}
}
String key = GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, this.userName, this.hostName, DEFAULT_SSH_PORT);
- pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
+ remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster();
if(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() != null && !jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().isPersistOutputData()){
outputPath = outputPath + File.separator + jobExecutionContext.getExperimentID() + "-" + jobExecutionContext.getTaskData().getTaskID()
+ File.separator;
- pbsCluster.makeDirectory(outputPath);
+ remoteCluster.makeDirectory(outputPath);
}
- pbsCluster.scpTo(outputPath, standardError);
- pbsCluster.scpTo(outputPath, standardOutput);
+ remoteCluster.scpTo(outputPath, standardError);
+ remoteCluster.scpTo(outputPath, standardOutput);
List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>();
Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
Set<String> keys = output.keySet();
@@ -157,7 +157,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
GFacUtils.saveErrorDetails(jobExecutionContext, "Empty Output returned from the application", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
throw new GFacHandlerException("Empty Output returned from the application.." );
}
- pbsCluster.scpTo(outputPath, downloadFile);
+ remoteCluster.scpTo(outputPath, downloadFile);
String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar)+1, downloadFile.length());
OutputDataObjectType dataObjectType = new OutputDataObjectType();
dataObjectType.setValue(outputPath + File.separatorChar + fileName);
@@ -169,7 +169,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
dataObjectType.setSearchQuery(outputDataObjectType.getSearchQuery());
outputArray.add(dataObjectType);
}else if (outputDataObjectType.getType() == DataType.STDOUT) {
- pbsCluster.scpTo(outputPath, standardOutput);
+ remoteCluster.scpTo(outputPath, standardOutput);
String fileName = standardOutput.substring(standardOutput.lastIndexOf(File.separatorChar)+1, standardOutput.length());
OutputDataObjectType dataObjectType = new OutputDataObjectType();
dataObjectType.setValue(outputPath + File.separatorChar + fileName);
@@ -181,7 +181,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
dataObjectType.setSearchQuery(outputDataObjectType.getSearchQuery());
outputArray.add(dataObjectType);
}else if (outputDataObjectType.getType() == DataType.STDERR) {
- pbsCluster.scpTo(outputPath, standardError);
+ remoteCluster.scpTo(outputPath, standardError);
String fileName = standardError.substring(standardError.lastIndexOf(File.separatorChar)+1, standardError.length());
OutputDataObjectType dataObjectType = new OutputDataObjectType();
dataObjectType.setValue(outputPath + File.separatorChar + fileName);
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
index 6c2a198..0189ca3 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java
@@ -6,7 +6,7 @@ import java.util.List;
import java.util.Properties;
import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
@@ -29,14 +29,14 @@ public class NewSSHOutputHandler extends AbstractHandler{
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
String hostAddress = jobExecutionContext.getHostName();
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
// Security Context and connection
try {
if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
GFACSSHUtils.addSecurityContext(jobExecutionContext);
}
- cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacProviderException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
@@ -54,7 +54,7 @@ public class NewSSHOutputHandler extends AbstractHandler{
}
super.invoke(jobExecutionContext);
- List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, cluster);
+ List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, remoteCluster);
try {
experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
} catch (RegistryException e) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index e79903f..3b49f63 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@ -21,7 +21,7 @@
package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
@@ -70,21 +70,21 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
}
private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try{
String hostAddress = jobExecutionContext.getHostName();
- cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacHandlerException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
}
String workingDirectory = jobExecutionContext.getWorkingDir();
- cluster.makeDirectory(workingDirectory);
+ remoteCluster.makeDirectory(workingDirectory);
if(!jobExecutionContext.getInputDir().equals(workingDirectory))
- cluster.makeDirectory(jobExecutionContext.getInputDir());
+ remoteCluster.makeDirectory(jobExecutionContext.getInputDir());
if(!jobExecutionContext.getOutputDir().equals(workingDirectory))
- cluster.makeDirectory(jobExecutionContext.getOutputDir());
+ remoteCluster.makeDirectory(jobExecutionContext.getOutputDir());
DataTransferDetails detail = new DataTransferDetails();
TransferStatus status = new TransferStatus();
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index f907cc6..53bc2ca 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@ -22,7 +22,7 @@ package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.context.MessageContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
@@ -60,7 +60,7 @@ public class SSHInputHandler extends AbstractHandler {
List<String> oldFiles = new ArrayList<String>();
StringBuffer data = new StringBuffer("|");
MessageContext inputNew = new MessageContext();
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
String hostAddress = jobExecutionContext.getHostName();
@@ -80,8 +80,8 @@ public class SSHInputHandler extends AbstractHandler {
}
}
- cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
@@ -102,7 +102,7 @@ public class SSHInputHandler extends AbstractHandler {
inputParamType.setValue(oldFiles.get(index));
data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index
} else {
- String stageInputFile = stageInputFiles(cluster, jobExecutionContext, paramValue);
+ String stageInputFile = stageInputFiles(remoteCluster, jobExecutionContext, paramValue);
inputParamType.setValue(stageInputFile);
StringBuffer temp = new StringBuffer(data.append(stageInputFile).append(",").toString());
status.setTransferState(TransferState.UPLOAD);
@@ -122,7 +122,7 @@ public class SSHInputHandler extends AbstractHandler {
// List<String> split = Arrays.asList(StringUtil.getElementsFromString(paramValue));
// List<String> newFiles = new ArrayList<String>();
// for (String paramValueEach : split) {
-// String stageInputFiles = stageInputFiles(cluster,jobExecutionContext, paramValueEach);
+// String stageInputFiles = stageInputFiles(remoteCluster,jobExecutionContext, paramValueEach);
// status.setTransferState(TransferState.UPLOAD);
// detail.setTransferStatus(status);
// detail.setTransferDescription("Input Data Staged: " + stageInputFiles);
@@ -158,14 +158,14 @@ public class SSHInputHandler extends AbstractHandler {
// TODO: Auto generated method body.
}
- private static String stageInputFiles(Cluster cluster, JobExecutionContext jobExecutionContext, String paramValue) throws IOException, GFacException {
+ private static String stageInputFiles(RemoteCluster remoteCluster, JobExecutionContext jobExecutionContext, String paramValue) throws IOException, GFacException {
int i = paramValue.lastIndexOf(File.separator);
String substring = paramValue.substring(i + 1);
try {
String targetFile = jobExecutionContext.getInputDir() + File.separator + substring;
if(paramValue.startsWith("scp:")){
paramValue = paramValue.substring(paramValue.indexOf(":") + 1, paramValue.length());
- cluster.scpThirdParty(paramValue, targetFile);
+ remoteCluster.scpThirdParty(paramValue, targetFile);
}else{
if(paramValue.startsWith("file")){
paramValue = paramValue.substring(paramValue.indexOf(":") + 1, paramValue.length());
@@ -174,7 +174,7 @@ public class SSHInputHandler extends AbstractHandler {
int j = 1;
while(!success){
try {
- cluster.scpTo(targetFile, paramValue);
+ remoteCluster.scpTo(targetFile, paramValue);
success = true;
} catch (Exception e) {
log.info(e.getLocalizedMessage());
http://git-wip-us.apache.org/repos/asf/airavata/blob/bad2c1c0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index 3f9edae..a131557 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -23,7 +23,7 @@ package org.apache.airavata.gfac.ssh.handler;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.gfac.core.Constants;
import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.cluster.Cluster;
+import org.apache.airavata.gfac.core.cluster.RemoteCluster;
import org.apache.airavata.gfac.core.context.JobExecutionContext;
import org.apache.airavata.gfac.core.handler.AbstractHandler;
import org.apache.airavata.gfac.core.handler.GFacHandlerException;
@@ -79,10 +79,10 @@ public class SSHOutputHandler extends AbstractHandler {
detail.setTransferDescription("Output data staging");
TransferStatus status = new TransferStatus();
- Cluster cluster = null;
+ RemoteCluster remoteCluster = null;
try {
- cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
- if (cluster == null) {
+ remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster();
+ if (remoteCluster == null) {
throw new GFacProviderException("Security context is not set properly");
} else {
log.info("Successfully retrieved the Security Context");
@@ -108,12 +108,12 @@ public class SSHOutputHandler extends AbstractHandler {
localStdOutFile = new File(outputDataDir + File.separator + timeStampedExperimentID + "stdout");
localStdErrFile = new File(outputDataDir + File.separator + timeStampedExperimentID + "stderr");
-// cluster.makeDirectory(outputDataDir);
+// remoteCluster.makeDirectory(outputDataDir);
int i = 0;
String stdOutStr = "";
while (stdOutStr.isEmpty()) {
try {
- cluster.scpFrom(jobExecutionContext.getStandardOutput(), localStdOutFile.getAbsolutePath());
+ remoteCluster.scpFrom(jobExecutionContext.getStandardOutput(), localStdOutFile.getAbsolutePath());
stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath());
} catch (Exception e) {
log.error(e.getLocalizedMessage());
@@ -123,7 +123,7 @@ public class SSHOutputHandler extends AbstractHandler {
if (i == 3) break;
}
Thread.sleep(1000);
- cluster.scpFrom(jobExecutionContext.getStandardError(), localStdErrFile.getAbsolutePath());
+ remoteCluster.scpFrom(jobExecutionContext.getStandardError(), localStdErrFile.getAbsolutePath());
Thread.sleep(1000);
String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath());
@@ -147,7 +147,7 @@ public class SSHOutputHandler extends AbstractHandler {
List<String> outputList = null;
int retry = 3;
while (retry > 0) {
- outputList = cluster.listDirectory(jobExecutionContext.getOutputDir());
+ outputList = remoteCluster.listDirectory(jobExecutionContext.getOutputDir());
if (outputList.size() > 0) {
break;
}
@@ -163,7 +163,7 @@ public class SSHOutputHandler extends AbstractHandler {
OutputDataObjectType actualParameter1 = (OutputDataObjectType) output.get(key);
if (DataType.URI == actualParameter1.getType()) {
String downloadFile = actualParameter1.getValue();
- cluster.scpFrom(downloadFile, outputDataDir);
+ remoteCluster.scpFrom(downloadFile, outputDataDir);
String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar) + 1, downloadFile.length());
String localFile = outputDataDir + File.separator + fileName;
jobExecutionContext.addOutputFile(localFile);
@@ -198,7 +198,7 @@ public class SSHOutputHandler extends AbstractHandler {
break;
} else if (outputList.size() == 1) {//FIXME: Ultrascan case
String valueList = outputList.get(0);
- cluster.scpFrom(jobExecutionContext.getOutputDir() + File.separator + valueList, outputDataDir);
+ remoteCluster.scpFrom(jobExecutionContext.getOutputDir() + File.separator + valueList, outputDataDir);
String outputPath = outputDataDir + File.separator + valueList;
jobExecutionContext.addOutputFile(outputPath);
actualParameter.setValue(outputPath);