http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java new file mode 100644 index 0000000..002674c --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java @@ -0,0 +1,262 @@ +/* + * + * 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.ssh.impl; + +import org.apache.airavata.gfac.ssh.api.*; +import org.apache.airavata.gfac.core.authentication.AuthenticationInfo; +import org.apache.airavata.gfac.ssh.api.job.JobDescriptor; +import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPasswordAuthenticationInfo; +import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPublicKeyFileAuthentication; +import org.apache.airavata.gfac.ssh.util.CommonUtils; +import org.testng.AssertJUnit; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +public class VanilaTestWithSSHAuth { + + private String userName; + private String password; + private String passPhrase; + private String hostName; + private String workingDirectory; + private String privateKeyPath; + private String publicKeyPath; + private String path; + + @BeforeTest + public void setUp() throws Exception { + System.out.println("Test case name " + this.getClass().getName()); + //Trestles + this.hostName = "trestles.sdsc.xsede.org"; + this.userName = "ogce"; + this.path="/opt/torque/bin/"; + //Stampede: +// this.hostName = "stampede.tacc.xsede.org"; +// this.userName = "ogce"; +// this.path="/usr/bin"; + //Lonestar: +// this.hostName = "lonestar.tacc.utexas.edu"; +// this.userName = "us3"; +// this.path="/opt/sge6.2/bin/lx24-amd64"; + //Alamo: +// this.hostName = "alamo.uthscsa.edu"; +// this.userName = "raminder"; +// this.path="/opt/torque/bin/"; + //Bigred: +// this.hostName = "bigred2.uits.iu.edu"; +// this.userName = "cgateway"; +// this.path="/opt/torque/torque-5.0.1/bin/"; + + System.setProperty("ssh.host",hostName); + System.setProperty("ssh.username", userName); + System.setProperty("private.ssh.key", "/home/lginnali/.ssh/id_dsa"); + System.setProperty("public.ssh.key", "/home/lginnali/.ssh/id_dsa.pub"); + System.setProperty("ssh.working.directory", "/tmp"); + + this.hostName = System.getProperty("ssh.host"); + this.userName = System.getProperty("ssh.username"); + this.password = System.getProperty("ssh.password"); + this.privateKeyPath = System.getProperty("private.ssh.key"); + this.publicKeyPath = System.getProperty("public.ssh.key"); + + System.setProperty("ssh.keypass", ""); + this.passPhrase = System.getProperty("ssh.keypass"); + this.workingDirectory = System.getProperty("ssh.working.directory"); + + + if (this.userName == null + || (this.password==null && (this.publicKeyPath == null || this.privateKeyPath == null)) || this.workingDirectory == null) { + System.out.println("########### In order to test you have to either username password or private,public keys"); + System.out.println("Use -Dssh.user=xxx -Dssh.password=yyy -Dssh.private.key.passphrase=zzz " + + "-Dssh.private.key.path -Dssh.public.key.path -Dssh.working.directory "); + } + } + + + @Test + public void testSimplePBSJob() throws Exception { + + AuthenticationInfo authenticationInfo = null; + if (password != null) { + authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password); + } else { + authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath, + this.passPhrase); + } + // Server info + ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName); + Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path)); + + String date = new Date().toString(); + date = date.replaceAll(" ", "_"); + date = date.replaceAll(":", "_"); + + String pomFile = new File("").getAbsolutePath() + File.separator + "pom.xml"; + + workingDirectory = workingDirectory + File.separator + + date + "_" + UUID.randomUUID(); + pbsCluster.makeDirectory(workingDirectory); + Thread.sleep(1000); + pbsCluster.makeDirectory(workingDirectory + File.separator + "inputs"); + Thread.sleep(1000); + pbsCluster.makeDirectory(workingDirectory + File.separator + "outputs"); + + + // doing file transfer to the remote resource + String remoteLocation = workingDirectory + File.separator + "inputs"; + pbsCluster.scpTo(remoteLocation, pomFile); + + int i = pomFile.lastIndexOf(File.separator); + String fileName = pomFile.substring(i + 1); + // constructing the job object + JobDescriptor jobDescriptor = new JobDescriptor(); + jobDescriptor.setWorkingDirectory(workingDirectory); + jobDescriptor.setShellName("/bin/bash"); + jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB"); + jobDescriptor.setExecutablePath("/bin/echo"); + jobDescriptor.setAllEnvExport(true); + jobDescriptor.setMailOptions("n"); + jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out"); + jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err"); + jobDescriptor.setNodes(1); + jobDescriptor.setProcessesPerNode(1); + jobDescriptor.setQueueName("normal"); + jobDescriptor.setMaxWallTime("5"); + //jobDescriptor.setJobSubmitter("aprun -n 1"); + List<String> inputs = new ArrayList<String>(); + inputs.add(remoteLocation + File.separator + fileName); + jobDescriptor.setInputValues(inputs); + //finished construction of job object + System.out.println(jobDescriptor.toXML()); + if(hostName.contains("trestles")){ + String jobID = pbsCluster.submitBatchJob(jobDescriptor); + System.out.println("JobID returned : " + jobID); + +// Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo); + Thread.sleep(1000); + JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID); + + //printing job data got from previous call + AssertJUnit.assertEquals(jobById.getJobId(), jobID); + System.out.println(jobById.getAcountString()); + System.out.println(jobById.getAllEnvExport()); + System.out.println(jobById.getCompTime()); + System.out.println(jobById.getExecutablePath()); + System.out.println(jobById.getEllapsedTime()); + System.out.println(jobById.getQueueName()); + System.out.println(jobById.getExecuteNode()); + System.out.println(jobById.getJobName()); + System.out.println(jobById.getCTime()); + System.out.println(jobById.getSTime()); + System.out.println(jobById.getMTime()); + System.out.println(jobById.getCompTime()); + System.out.println(jobById.getOwner()); + System.out.println(jobById.getQTime()); + System.out.println(jobById.getUsedCPUTime()); + System.out.println(jobById.getUsedMemory()); + System.out.println(jobById.getVariableList()); + } + } + + @Test + public void testSimpleLSFJob() throws Exception { + + AuthenticationInfo authenticationInfo = null; + if (password != null) { + authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password); + } else { + authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath, + this.passPhrase); + } + // Server info + ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName); + + + // constructing the job object + JobDescriptor jobDescriptor = new JobDescriptor(); + jobDescriptor.setWorkingDirectory(workingDirectory); + jobDescriptor.setShellName("/bin/bash"); + jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB"); + jobDescriptor.setExecutablePath("/bin/echo"); + jobDescriptor.setAllEnvExport(true); + jobDescriptor.setMailOptions("n"); + jobDescriptor.setMailAddress("[email protected]"); + jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out"); + jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err"); + jobDescriptor.setNodes(1); + jobDescriptor.setProcessesPerNode(1); + jobDescriptor.setQueueName("long"); + jobDescriptor.setMaxWallTimeForLSF("5"); + jobDescriptor.setJobSubmitter("mpiexec"); + jobDescriptor.setModuleLoadCommands(new String[]{"module load openmpi/1.6.5"}); + jobDescriptor.setUsedMemory("1000"); + jobDescriptor.setChassisName("01"); + + //jobDescriptor.setJobSubmitter("aprun -n 1"); + List<String> inputs = new ArrayList<String>(); + jobDescriptor.setInputValues(inputs); + //finished construction of job object + System.out.println(jobDescriptor.toXML()); + Cluster pbsCluster = new PBSCluster(CommonUtils.getLSFJobManager("")); + ((PBSCluster) pbsCluster).generateJobScript(jobDescriptor); + } + + @Test + public void testSCPFromAndSCPTo() throws Exception { + + AuthenticationInfo authenticationInfo = null; + if (password != null) { + authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password); + } else { + authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath, + this.passPhrase); + } + // Server info + ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName); + Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path)); + new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path));; + + String date = new Date().toString(); + date = date.replaceAll(" ", "_"); + date = date.replaceAll(":", "_"); + + String pomFile = (new File(".")).getAbsolutePath() + File.separator + "pom.xml"; + File file = new File(pomFile); + if(!file.exists()){ + file.createNewFile(); + } + // Constructing theworking directory for demonstration and creating directories in the remote + // resource + workingDirectory = workingDirectory + File.separator + + date + "_" + UUID.randomUUID(); + pbsCluster.makeDirectory(workingDirectory); + pbsCluster.scpTo(workingDirectory, pomFile); + Thread.sleep(1000); + pbsCluster.scpFrom(workingDirectory + File.separator + "pom.xml", (new File(".")).getAbsolutePath()); + } +}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java new file mode 100644 index 0000000..29d6fca --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java @@ -0,0 +1,207 @@ +/* + * + * 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.job; + +import com.google.common.eventbus.EventBus; +import com.google.common.eventbus.Subscribe; +import org.airavata.appcatalog.cpi.AppCatalog; +import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; +import org.apache.airavata.common.utils.MonitorPublisher; +import org.apache.airavata.gfac.core.monitor.MonitorID; +import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor; +import org.apache.airavata.gfac.ssh.api.Cluster; +import org.apache.airavata.gfac.ssh.api.SSHApiException; +import org.apache.airavata.gfac.ssh.api.ServerInfo; +import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo; +import org.apache.airavata.gfac.ssh.api.job.JobDescriptor; +import org.apache.airavata.gfac.ssh.impl.PBSCluster; +import org.apache.airavata.gfac.ssh.impl.authentication.MyProxyAuthenticationInfo; +import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; +import org.apache.airavata.model.appcatalog.computeresource.DataMovementInterface; +import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol; +import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand; +import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; +import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; +import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager; +import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType; +import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission; +import org.apache.airavata.model.appcatalog.computeresource.SecurityProtocol; +import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; + +public class AMQPMonitorTest { + + private String myProxyUserName; + private String myProxyPassword; + private String certificateLocation; + private String pbsFilePath; + private String workingDirectory; + private MonitorPublisher monitorPublisher; + private BlockingQueue<MonitorID> finishQueue; + private BlockingQueue<MonitorID> pushQueue; + private Thread pushThread; + private String proxyFilePath; + private ComputeResourceDescription computeResourceDescription; + private final static Logger logger = LoggerFactory.getLogger(AMQPMonitorTest.class); + + @Before + public void setUp() throws Exception { + System.setProperty("myproxy.username", "ogce"); + System.setProperty("myproxy.password", ""); + System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh"); + System.setProperty("gsi.working.directory", "/home1/01437/ogce"); + System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates"); + System.setProperty("proxy.file.path", "/Users/lahirugunathilake/Downloads/x509up_u503876"); + myProxyUserName = System.getProperty("myproxy.username"); + myProxyPassword = System.getProperty("myproxy.password"); + workingDirectory = System.getProperty("gsi.working.directory"); + certificateLocation = System.getProperty("trusted.cert.location"); + proxyFilePath = System.getProperty("proxy.file.path"); + System.setProperty("connection.name", "xsede"); + if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) { + System.out.println(">>>>>> Please run tests with my proxy user name and password. " + + "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<"); + throw new Exception("Need my proxy user name password to run tests."); + } + + monitorPublisher = new MonitorPublisher(new EventBus()); + pushQueue = new LinkedBlockingQueue<MonitorID>(); + finishQueue = new LinkedBlockingQueue<MonitorID>(); + + + final AMQPMonitor amqpMonitor = new + AMQPMonitor(monitorPublisher, + pushQueue, finishQueue,proxyFilePath,"xsede", + Arrays.asList("info1.dyn.teragrid.org,info2.dyn.teragrid.org".split(","))); + try { + (new Thread(){ + public void run(){ + amqpMonitor.run(); + } + }).start(); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + computeResourceDescription = new ComputeResourceDescription("TestComputerResoruceId", "TestHostName"); + computeResourceDescription.setHostName("stampede-host"); + computeResourceDescription.addToIpAddresses("login1.stampede.tacc.utexas.edu"); + ResourceJobManager resourceJobManager = new ResourceJobManager("1234", ResourceJobManagerType.SLURM); + Map<JobManagerCommand, String> commandMap = new HashMap<JobManagerCommand, String>(); + commandMap.put(JobManagerCommand.SUBMISSION, "test"); + resourceJobManager.setJobManagerCommands(commandMap); + resourceJobManager.setJobManagerBinPath("/usr/bin/"); + resourceJobManager.setPushMonitoringEndpoint("push"); // TODO - add monitor mode + SSHJobSubmission sshJobSubmission = new SSHJobSubmission("TestSSHJobSubmissionInterfaceId", SecurityProtocol.GSI, + resourceJobManager); + + AppCatalog appCatalog = AppCatalogFactory.getAppCatalog(); + String jobSubmissionID = appCatalog.getComputeResource().addSSHJobSubmission(sshJobSubmission); + + JobSubmissionInterface jobSubmissionInterface = new JobSubmissionInterface(jobSubmissionID, JobSubmissionProtocol.SSH, 1); + + computeResourceDescription.addToJobSubmissionInterfaces(jobSubmissionInterface); + computeResourceDescription.addToDataMovementInterfaces(new DataMovementInterface("4532", DataMovementProtocol.SCP, 1)); + + } + + @Test + public void testAMQPMonitor() throws SSHApiException { + /* now have to submit a job to some machine and add that job to the queue */ + //Create authentication + GSIAuthenticationInfo authenticationInfo + = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org", + 7512, 17280000, certificateLocation); + + // Server info + ServerInfo serverInfo = new ServerInfo("ogce", "login1.stampede.tacc.utexas.edu",2222); + + + Cluster pbsCluster = new + PBSCluster(serverInfo, authenticationInfo, org.apache.airavata.gfac.ssh.util.CommonUtils.getPBSJobManager("/usr/bin/")); + + + // Execute command + System.out.println("Target PBS file path: " + workingDirectory); + // constructing the job object + String jobName = "GSI_SSH_SLEEP_JOB"; + JobDescriptor jobDescriptor = new JobDescriptor(); + jobDescriptor.setWorkingDirectory(workingDirectory); + jobDescriptor.setShellName("/bin/bash"); + jobDescriptor.setJobName(jobName); + jobDescriptor.setExecutablePath("/bin/echo"); + jobDescriptor.setAllEnvExport(true); + jobDescriptor.setMailOptions("n"); + jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out"); + jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err"); + jobDescriptor.setNodes(1); + jobDescriptor.setProcessesPerNode(1); + jobDescriptor.setQueueName("normal"); + jobDescriptor.setMaxWallTime("60"); + jobDescriptor.setAcountString("TG-STA110014S"); + List<String> inputs = new ArrayList<String>(); + jobDescriptor.setOwner("ogce"); + inputs.add("Hello World"); + jobDescriptor.setInputValues(inputs); + //finished construction of job object + System.out.println(jobDescriptor.toXML()); + String jobID = pbsCluster.submitBatchJob(jobDescriptor); + System.out.println(jobID); + try { + pushQueue.add(new MonitorID(computeResourceDescription, jobID,null,null,null, "ogce", jobName)); + } catch (Exception e) { + e.printStackTrace(); + } + try { + pushThread.join(); + } catch (InterruptedException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + class InnerClassAMQP{ + @Subscribe + private void getStatus(JobStatusChangeEvent status){ + Assert.assertNotNull(status); + pushThread.interrupt(); + } + } + monitorPublisher.registerListener(new InnerClassAMQP()); +// try { +// pushThread.join(5000); +// Iterator<MonitorID> iterator = pushQueue.iterator(); +// MonitorID next = iterator.next(); +// org.junit.Assert.assertNotNull(next.getStatus()); +// } catch (Exception e) { +// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +// } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java new file mode 100644 index 0000000..c405e8c --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java @@ -0,0 +1,172 @@ +///* +// * +// * 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.job; +// +//import java.io.File; +//import java.util.ArrayList; +//import java.util.List; +//import java.util.concurrent.BlockingQueue; +//import java.util.concurrent.LinkedBlockingQueue; +// +//import org.apache.airavata.common.utils.MonitorPublisher; +//import org.apache.airavata.commons.gfac.type.HostDescription; +//import org.apache.airavata.gfac.core.monitor.MonitorID; +//import org.apache.airavata.gfac.monitor.HPCMonitorID; +//import org.apache.airavata.gfac.monitor.UserMonitorData; +//import org.apache.airavata.gfac.monitor.impl.pull.qstat.HPCPullMonitor; +//import org.apache.airavata.gfac.ssh.api.Cluster; +//import org.apache.airavata.gfac.ssh.api.SSHApiException; +//import org.apache.airavata.gfac.ssh.api.ServerInfo; +//import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo; +//import org.apache.airavata.gfac.ssh.api.job.JobDescriptor; +//import org.apache.airavata.gfac.ssh.impl.PBSCluster; +//import org.apache.airavata.gfac.ssh.impl.authentication.MyProxyAuthenticationInfo; +//import org.apache.airavata.gfac.ssh.util.CommonUtils; +//import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; +//import org.apache.airavata.schemas.gfac.GsisshHostType; +//import org.junit.Assert; +//import org.testng.annotations.Test; +// +//import com.google.common.eventbus.EventBus; +//import com.google.common.eventbus.Subscribe; +// +//public class QstatMonitorTestWithMyProxyAuth { +// private String myProxyUserName; +// private String myProxyPassword; +// private String certificateLocation; +// private String pbsFilePath; +// private String workingDirectory; +// private HostDescription hostDescription; +// private MonitorPublisher monitorPublisher; +// private BlockingQueue<UserMonitorData> pullQueue; +// private Thread monitorThread; +// +// @org.testng.annotations.BeforeClass +// public void setUp() throws Exception { +//// System.setProperty("myproxy.username", "ogce"); +//// System.setProperty("myproxy.password", ""); +//// System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh"); +//// System.setProperty("gsi.working.directory", "/home/ogce"); +//// System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates"); +// myProxyUserName = System.getProperty("myproxy.username"); +// myProxyPassword = System.getProperty("myproxy.password"); +// workingDirectory = System.getProperty("gsi.working.directory"); +// certificateLocation = System.getProperty("trusted.cert.location"); +// if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) { +// System.out.println(">>>>>> Please run tests with my proxy user name and password. " + +// "E.g :- mvn clean install -Dmyproxy.username=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<"); +// throw new Exception("Need my proxy user name password to run tests."); +// } +// +// monitorPublisher = new MonitorPublisher(new EventBus()); +// class InnerClassQstat { +// +// @Subscribe +// private void getStatus(JobStatusChangeEvent status) { +// Assert.assertNotNull(status); +// System.out.println(status.getState().toString()); +// monitorThread.interrupt(); +// } +// } +// monitorPublisher.registerListener(this); +// pullQueue = new LinkedBlockingQueue<UserMonitorData>(); +// final HPCPullMonitor qstatMonitor = new +// HPCPullMonitor(pullQueue, monitorPublisher); +// try { +// (new Thread(){ +// public void run(){ +// qstatMonitor.run(); +// } +// }).start(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// hostDescription = new HostDescription(GsisshHostType.type); +// hostDescription.getType().setHostAddress("trestles.sdsc.edu"); +// hostDescription.getType().setHostName("gsissh-gordon"); +// ((GsisshHostType) hostDescription.getType()).setPort(22); +// ((GsisshHostType)hostDescription.getType()).setInstalledPath("/opt/torque/bin/"); +// } +// +// @Test +// public void testQstatMonitor() throws SSHApiException { +// /* now have to submit a job to some machine and add that job to the queue */ +// //Create authentication +// GSIAuthenticationInfo authenticationInfo +// = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org", +// 7512, 17280000, certificateLocation); +// +// // Server info +// ServerInfo serverInfo = new ServerInfo("ogce", hostDescription.getType().getHostAddress()); +// +// +// Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/")); +// +// +// // Execute command +// System.out.println("Target PBS file path: " + workingDirectory); +// // constructing the job object +// JobDescriptor jobDescriptor = new JobDescriptor(); +// jobDescriptor.setWorkingDirectory(workingDirectory); +// jobDescriptor.setShellName("/bin/bash"); +// jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB"); +// jobDescriptor.setExecutablePath("/bin/echo"); +// jobDescriptor.setAllEnvExport(true); +// jobDescriptor.setMailOptions("n"); +// jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out"); +// jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err"); +// jobDescriptor.setNodes(1); +// jobDescriptor.setProcessesPerNode(1); +// jobDescriptor.setQueueName("normal"); +// jobDescriptor.setMaxWallTime("60"); +// jobDescriptor.setAcountString("sds128"); +// List<String> inputs = new ArrayList<String>(); +// jobDescriptor.setOwner("ogce"); +// inputs.add("Hello World"); +// jobDescriptor.setInputValues(inputs); +// //finished construction of job object +// System.out.println(jobDescriptor.toXML()); +// for (int i = 0; i < 1; i++) { +// String jobID = pbsCluster.submitBatchJob(jobDescriptor); +// System.out.println("Job submitted successfully, Job ID: " + jobID); +// MonitorID monitorID = new HPCMonitorID(hostDescription, jobID,null,null,null, "ogce",""); +// ((HPCMonitorID)monitorID).setAuthenticationInfo(authenticationInfo); +// try { +// org.apache.airavata.gfac.monitor.util.CommonUtils.addMonitortoQueue(pullQueue, monitorID, jobExecutionContext); +// } catch (Exception e) { +// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +// } +// } +// try { +// +// monitorThread.join(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +// @Subscribe +// public void testCaseShutDown(JobStatusChangeEvent status) { +// Assert.assertNotNull(status.getState()); +// monitorThread.stop(); +// } +//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/PBSTemplate.xslt ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/PBSTemplate.xslt b/modules/gfac/gfac-impl/src/test/resources/PBSTemplate.xslt new file mode 100644 index 0000000..e749e9c --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/PBSTemplate.xslt @@ -0,0 +1,73 @@ +<!--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. --> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12"> +<xsl:output method="text" /> +<xsl:template match="/ns:JobDescriptor"> +#! /bin/sh +# PBS batch job script built by Globus job manager +# <xsl:choose> + <xsl:when test="ns:shellName"> +##PBS -S <xsl:value-of select="ns:shellName"/> + </xsl:when></xsl:choose> + <xsl:choose> + <xsl:when test="ns:queueName"> +#PBS -q <xsl:value-of select="ns:queueName"/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="ns:mailOptions"> +#PBS -m <xsl:value-of select="ns:mailOptions"/> + </xsl:when> + </xsl:choose> + <xsl:choose> +<xsl:when test="ns:acountString"> +#PBS -A <xsl:value-of select="ns:acountString"/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="ns:maxWallTime"> +#PBS -l walltime=<xsl:value-of select="ns:maxWallTime"/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="ns:standardOutFile"> +#PBS -o <xsl:value-of select="ns:standardOutFile"/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="ns:standardOutFile"> +#PBS -e <xsl:value-of select="ns:standardErrorFile"/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test="(ns:nodes) and (ns:processesPerNode)"> +#PBS -l nodes=<xsl:value-of select="ns:nodes"/>:ppn=<xsl:value-of select="ns:processesPerNode"/> +<xsl:text>
</xsl:text> + </xsl:when> + </xsl:choose> +<xsl:for-each select="ns:exports/ns:name"> +<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>
</xsl:text> +export<xsl:text> </xsl:text><xsl:value-of select="."/> +<xsl:text>
</xsl:text> +</xsl:for-each> +<xsl:for-each select="ns:preJobCommands/ns:command"> + <xsl:value-of select="."/><xsl:text> </xsl:text> + </xsl:for-each> +cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text> + <xsl:choose><xsl:when test="ns:jobSubmitterCommand"> +<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text></xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text> +<xsl:for-each select="ns:inputs/ns:input"> + <xsl:value-of select="."/><xsl:text> </xsl:text> + </xsl:for-each> +<xsl:for-each select="ns:postJobCommands/ns:command"> + <xsl:value-of select="."/><xsl:text> </xsl:text> +</xsl:for-each> + +</xsl:template> + +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/echo.bat ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/echo.bat b/modules/gfac/gfac-impl/src/test/resources/echo.bat new file mode 100644 index 0000000..c6b849b --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/echo.bat @@ -0,0 +1,22 @@ +:: +:: +:: 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. +:: +:: +@echo off +echo %1^=%2 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/gsissh.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/gsissh.properties b/modules/gfac/gfac-impl/src/test/resources/gsissh.properties new file mode 100644 index 0000000..3fdf76d --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/gsissh.properties @@ -0,0 +1,26 @@ +# +# +# 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. +# + +########################################################################### +# Specifies system level configurations as a key/value pairs. +########################################################################### + +StrictHostKeyChecking=no +ssh.session.timeout=360000 http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/log4j.properties b/modules/gfac/gfac-impl/src/test/resources/log4j.properties new file mode 100644 index 0000000..257802c --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/log4j.properties @@ -0,0 +1,34 @@ +# +# 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. +# + +# Set root category priority to INFO and its only appender to CONSOLE. +log4j.rootCategory=ALL, CONSOLE,LOGFILE +log4j.rootLogger=ALL, CONSOLE, LOGFILE + + +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n + +# LOGFILE is set to be a File appender using a PatternLayout. +log4j.appender.LOGFILE=org.apache.log4j.FileAppender +log4j.appender.LOGFILE.File=./target/integration-tests.log +log4j.appender.LOGFILE.Append=true +log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/logging.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/logging.properties b/modules/gfac/gfac-impl/src/test/resources/logging.properties new file mode 100644 index 0000000..0584d38 --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/logging.properties @@ -0,0 +1,42 @@ +# +# 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. +# +# +#default/fallback log4j configuration +# + +# Set root logger level to WARN and its only appender to A1. +log4j.rootLogger=INFO, A1, A2 + +# A1 is set to be a rolling file appender with default params +log4j.appender.A1=org.apache.log4j.RollingFileAppender +log4j.appender.A1.File=target/seclogs.txt + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n + +# A2 is a console appender +log4j.appender.A2=org.apache.log4j.ConsoleAppender + +# A2 uses PatternLayout. +log4j.appender.A2.layout=org.apache.log4j.PatternLayout +log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n + +log4j.logger.unicore.security=INFO + http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/sleep.pbs ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/sleep.pbs b/modules/gfac/gfac-impl/src/test/resources/sleep.pbs new file mode 100644 index 0000000..126e045 --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/sleep.pbs @@ -0,0 +1,32 @@ +#!/bin/bash +# +# +# 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. +# + +#$ -S /bin/bash +#$ -V +#$ -pe 1way 32 +#$ -m n +#$ -q normal +#$ -A +#$ -l h_rt=0:60:00 +#$ -o application.stdout +#$ -e application.stderr +#PBS -N GSI_SSH_SLEEP_JOB +/bin/sleep 60 http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-impl/src/test/resources/test.pbs ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/test/resources/test.pbs b/modules/gfac/gfac-impl/src/test/resources/test.pbs new file mode 100644 index 0000000..d18269b --- /dev/null +++ b/modules/gfac/gfac-impl/src/test/resources/test.pbs @@ -0,0 +1,30 @@ +#!/bin/bash +# +# +# 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. +# + +#PBS -q normal +#PBS -A sds128 +#PBS -l nodes=1:ppn=1 +#PBS -l walltime=00:00:01 +#PBS -o job_output +#PBS -N GSI_SSH_JOB +#PBS -V + +/bin/date http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/pom.xml b/modules/gfac/gfac-local/pom.xml deleted file mode 100644 index 081dfd8..0000000 --- a/modules/gfac/gfac-local/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!--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. --> - -<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>gfac</artifactId> - <version>0.16-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>airavata-gfac-local</artifactId> - <name>Airavata GFac Local implementation</name> - <description>This is the extension of GFAC Local.</description> - <url>http://airavata.apache.org/</url> - - <dependencies> - - <!-- Logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <!-- GFAC schemas --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-core</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- Test --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.1.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java deleted file mode 100644 index 2f9e3b0..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalDirectorySetupHandler.java +++ /dev/null @@ -1,62 +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.local.handler; - -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.handler.GFacHandler; -import org.apache.airavata.gfac.core.handler.GFacHandlerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.util.Properties; - -public class LocalDirectorySetupHandler implements GFacHandler { - private static final Logger log = LoggerFactory.getLogger(LocalDirectorySetupHandler.class); - - public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { - log.info("Invoking LocalDirectorySetupHandler ..."); - log.debug("working directory = " + jobExecutionContext.getWorkingDir()); - log.debug("temp directory = " + jobExecutionContext.getWorkingDir()); - - makeFileSystemDir(jobExecutionContext.getWorkingDir()); - makeFileSystemDir(jobExecutionContext.getInputDir()); - makeFileSystemDir(jobExecutionContext.getOutputDir()); - } - - @Override - public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { - // TODO: Auto generated method body. - } - - private void makeFileSystemDir(String dir) throws GFacHandlerException { - File f = new File(dir); - if (f.isDirectory() && f.exists()) { - return; - } else if (!new File(dir).mkdir()) { - throw new GFacHandlerException("Cannot create directory " + dir); - } - } - - public void initProperties(Properties properties) throws GFacHandlerException { - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalInputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalInputHandler.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalInputHandler.java deleted file mode 100644 index 884ccd5..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/handler/LocalInputHandler.java +++ /dev/null @@ -1,92 +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.local.handler; - -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.model.appcatalog.appinterface.DataType; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.commons.io.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.util.Map; -import java.util.Properties; - - -public class LocalInputHandler extends AbstractHandler { - private static final Logger logger = LoggerFactory.getLogger(LocalInputHandler.class); - @Override - public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { - super.invoke(jobExecutionContext); - Map<String, Object> inputParameters = jobExecutionContext.getInMessageContext().getParameters(); - for (Map.Entry<String, Object> inputParamEntry : inputParameters.entrySet()) { - if (inputParamEntry.getValue() instanceof InputDataObjectType) { - InputDataObjectType inputDataObject = (InputDataObjectType) inputParamEntry.getValue(); - if (inputDataObject.getType() == DataType.URI - && inputDataObject != null - && !inputDataObject.getValue().equals("")) { - try { - inputDataObject.setValue(stageFile(jobExecutionContext.getInputDir(), inputDataObject.getValue())); - } catch (IOException e) { - throw new GFacHandlerException("Error while data staging sourceFile= " + inputDataObject.getValue()); - } - } - } - } - } - - private String stageFile(String inputDir, String sourceFilePath) throws IOException { - int i = sourceFilePath.lastIndexOf(File.separator); - String substring = sourceFilePath.substring(i + 1); - if (inputDir.endsWith("/")) { - inputDir = inputDir.substring(0, inputDir.length() - 1); - } - String targetFilePath = inputDir + File.separator + substring; - - if (sourceFilePath.startsWith("file")) { - sourceFilePath = sourceFilePath.substring(sourceFilePath.indexOf(":") + 1, sourceFilePath.length()); - } - - File sourceFile = new File(sourceFilePath); - File targetFile = new File(targetFilePath); - if (targetFile.exists()) { - targetFile.delete(); - } - logger.info("staging source file : " + sourceFilePath + " to target file : " + targetFilePath); - FileUtils.copyFile(sourceFile, targetFile); - - return targetFilePath; - } - - @Override - public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { - - } - - @Override - public void initProperties(Properties properties) throws GFacHandlerException { - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java deleted file mode 100644 index 871193a..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/provider/impl/LocalProvider.java +++ /dev/null @@ -1,311 +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.local.provider.impl; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.airavata.gfac.Constants; -import org.apache.airavata.gfac.GFacException; -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.notification.events.StartExecutionEvent; -import org.apache.airavata.gfac.core.provider.AbstractProvider; -import org.apache.airavata.gfac.core.provider.GFacProviderException; -import org.apache.airavata.gfac.core.utils.GFacUtils; -import org.apache.airavata.gfac.core.utils.OutputUtils; -import org.apache.airavata.gfac.local.utils.InputStreamToFileWriter; -import org.apache.airavata.gfac.local.utils.InputUtils; -import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; -import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.airavata.model.messaging.event.JobIdentifier; -import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; -import org.apache.airavata.model.messaging.event.TaskIdentifier; -import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent; -import org.apache.airavata.model.workspace.experiment.JobDetails; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.registry.cpi.ChildDataType; -import org.apache.airavata.registry.cpi.RegistryModelType; -import org.apache.xmlbeans.XmlException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import sun.reflect.generics.reflectiveObjects.NotImplementedException; - -public class LocalProvider extends AbstractProvider { - private static final Logger log = LoggerFactory.getLogger(LocalProvider.class); - private ProcessBuilder builder; - private List<String> cmdList; - private String jobId; - - public static class LocalProviderJobData{ - private String applicationName; - private List<String> inputParameters; - private String workingDir; - private String inputDir; - private String outputDir; - public String getApplicationName() { - return applicationName; - } - public void setApplicationName(String applicationName) { - this.applicationName = applicationName; - } - public List<String> getInputParameters() { - return inputParameters; - } - public void setInputParameters(List<String> inputParameters) { - this.inputParameters = inputParameters; - } - public String getWorkingDir() { - return workingDir; - } - public void setWorkingDir(String workingDir) { - this.workingDir = workingDir; - } - public String getInputDir() { - return inputDir; - } - public void setInputDir(String inputDir) { - this.inputDir = inputDir; - } - public String getOutputDir() { - return outputDir; - } - public void setOutputDir(String outputDir) { - this.outputDir = outputDir; - } - } - public LocalProvider(){ - cmdList = new ArrayList<String>(); - } - - public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException { - super.initialize(jobExecutionContext); - - // build command with all inputs - buildCommand(); - initProcessBuilder(jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription()); - - // extra environment variables - builder.environment().put(Constants.INPUT_DATA_DIR_VAR_NAME, jobExecutionContext.getInputDir()); - builder.environment().put(Constants.OUTPUT_DATA_DIR_VAR_NAME, jobExecutionContext.getOutputDir()); - - // set working directory - builder.directory(new File(jobExecutionContext.getWorkingDir())); - - // log info - log.info("Command = " + InputUtils.buildCommand(cmdList)); - log.info("Working dir = " + builder.directory()); - /*for (String key : builder.environment().keySet()) { - log.info("Env[" + key + "] = " + builder.environment().get(key)); - }*/ - } - - public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException { - jobExecutionContext.getNotifier().publish(new StartExecutionEvent()); - JobDetails jobDetails = new JobDetails(); - try { - jobId = jobExecutionContext.getTaskData().getTaskID(); - jobDetails.setJobID(jobId); - jobDetails.setJobDescription(jobExecutionContext.getApplicationContext() - .getApplicationDeploymentDescription().getAppDeploymentDescription()); - jobExecutionContext.setJobDetails(jobDetails); - GFacUtils.saveJobStatus(jobExecutionContext, jobDetails, JobState.SETUP); - // running cmd - Process process = builder.start(); - - Thread standardOutWriter = new InputStreamToFileWriter(process.getInputStream(), jobExecutionContext.getStandardOutput()); - Thread standardErrorWriter = new InputStreamToFileWriter(process.getErrorStream(), jobExecutionContext.getStandardError()); - - // start output threads - standardOutWriter.setDaemon(true); - standardErrorWriter.setDaemon(true); - standardOutWriter.start(); - standardErrorWriter.start(); - - int returnValue = process.waitFor(); - - // make sure other two threads are done - standardOutWriter.join(); - standardErrorWriter.join(); - - /* - * check return value. usually not very helpful to draw conclusions based on return values so don't bother. - * just provide warning in the log messages - */ - if (returnValue != 0) { - log.error("Process finished with non zero return value. Process may have failed"); - } else { - log.info("Process finished with return value of zero."); - } - - StringBuffer buf = new StringBuffer(); - buf.append("Executed ").append(InputUtils.buildCommand(cmdList)) - .append(" on the localHost, working directory = ").append(jobExecutionContext.getWorkingDir()) - .append(" tempDirectory = ").append(jobExecutionContext.getScratchLocation()).append(" With the status ") - .append(String.valueOf(returnValue)); - - log.info(buf.toString()); - - // updating the job status to complete because there's nothing to monitor in local jobs -// MonitorID monitorID = createMonitorID(jobExecutionContext); - JobIdentifier jobIdentity = new JobIdentifier(jobExecutionContext.getJobDetails().getJobID(), - jobExecutionContext.getTaskData().getTaskID(), - jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), - jobExecutionContext.getExperimentID(), - jobExecutionContext.getGatewayID()); - jobExecutionContext.getMonitorPublisher().publish(new JobStatusChangeEvent(JobState.COMPLETE, jobIdentity)); - } catch (IOException io) { - throw new GFacProviderException(io.getMessage(), io); - } catch (InterruptedException e) { - throw new GFacProviderException(e.getMessage(), e); - }catch (GFacException e) { - throw new GFacProviderException(e.getMessage(), e); - } - } - -// private MonitorID createMonitorID(JobExecutionContext jobExecutionContext) { -// MonitorID monitorID = new MonitorID(jobExecutionContext.getApplicationContext().getHostDescription(), jobId, -// jobExecutionContext.getTaskData().getTaskID(), -// jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), jobExecutionContext.getExperimentID(), -// jobExecutionContext.getExperiment().getUserName(),jobId); -// return monitorID; -// } - -// private void saveApplicationJob(JobExecutionContext jobExecutionContext) -// throws GFacProviderException { -// ApplicationDeploymentDescriptionType app = jobExecutionContext. -// getApplicationContext().getApplicationDeploymentDescription().getType(); -// ApplicationJob appJob = GFacUtils.createApplicationJob(jobExecutionContext); -// appJob.setJobId(jobId); -// LocalProviderJobData data = new LocalProviderJobData(); -// data.setApplicationName(app.getExecutableLocation()); -// data.setInputDir(app.getInputDataDirectory()); -// data.setOutputDir(app.getOutputDataDirectory()); -// data.setWorkingDir(builder.directory().toString()); -// data.setInputParameters(ProviderUtils.getInputParameters(jobExecutionContext)); -// ByteArrayOutputStream stream = new ByteArrayOutputStream(); -// JAXB.marshal(data, stream); -// appJob.setJobData(stream.toString()); -// appJob.setSubmittedTime(Calendar.getInstance().getTime()); -// appJob.setStatus(ApplicationJobStatus.SUBMITTED); -// appJob.setStatusUpdateTime(appJob.getSubmittedTime()); -// GFacUtils.recordApplicationJob(jobExecutionContext, appJob); -// } - - public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException { - try { - List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>(); - String stdOutStr = GFacUtils.readFileToString(jobExecutionContext.getStandardOutput()); - String stdErrStr = GFacUtils.readFileToString(jobExecutionContext.getStandardError()); - Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters(); - OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr, outputArray); - TaskDetails taskDetails = (TaskDetails)registry.get(RegistryModelType.TASK_DETAIL, jobExecutionContext.getTaskData().getTaskID()); - if (taskDetails != null){ - taskDetails.setApplicationOutputs(outputArray); - registry.update(RegistryModelType.TASK_DETAIL, taskDetails, taskDetails.getTaskID()); - } - registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); - TaskIdentifier taskIdentity = new TaskIdentifier(jobExecutionContext.getTaskData().getTaskID(), - jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), - jobExecutionContext.getExperimentID(), - jobExecutionContext.getGatewayID()); - jobExecutionContext.getMonitorPublisher().publish(new TaskOutputChangeEvent(outputArray, taskIdentity)); - } catch (XmlException e) { - throw new GFacProviderException("Cannot read output:" + e.getMessage(), e); - } catch (IOException io) { - throw new GFacProviderException(io.getMessage(), io); - } catch (Exception e){ - throw new GFacProviderException("Error in retrieving results",e); - } - } - - public boolean cancelJob(JobExecutionContext jobExecutionContext) throws GFacException { - throw new NotImplementedException(); - } - - @Override - public void recover(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { - // TODO: Auto generated method body. - } - - @Override - public void monitor(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { - // TODO: Auto generated method body. - } - - - private void buildCommand() { - cmdList.add(jobExecutionContext.getExecutablePath()); - Map<String, Object> inputParameters = jobExecutionContext.getInMessageContext().getParameters(); - - // sort the inputs first and then build the command List - Comparator<InputDataObjectType> inputOrderComparator = new Comparator<InputDataObjectType>() { - @Override - public int compare(InputDataObjectType inputDataObjectType, InputDataObjectType t1) { - return inputDataObjectType.getInputOrder() - t1.getInputOrder(); - } - }; - Set<InputDataObjectType> sortedInputSet = new TreeSet<InputDataObjectType>(inputOrderComparator); - for (Object object : inputParameters.values()) { - if (object instanceof InputDataObjectType) { - InputDataObjectType inputDOT = (InputDataObjectType) object; - sortedInputSet.add(inputDOT); - } - } - for (InputDataObjectType inputDataObjectType : sortedInputSet) { - if (inputDataObjectType.getApplicationArgument() != null - && !inputDataObjectType.getApplicationArgument().equals("")) { - cmdList.add(inputDataObjectType.getApplicationArgument()); - } - - if (inputDataObjectType.getValue() != null - && !inputDataObjectType.getValue().equals("")) { - cmdList.add(inputDataObjectType.getValue()); - } - } - - } - - private void initProcessBuilder(ApplicationDeploymentDescription app){ - builder = new ProcessBuilder(cmdList); - - List<SetEnvPaths> setEnvironment = app.getSetEnvironment(); - if (setEnvironment != null) { - for (SetEnvPaths envPath : setEnvironment) { - Map<String,String> builderEnv = builder.environment(); - builderEnv.put(envPath.getName(), envPath.getValue()); - } - } - } - - public void initProperties(Map<String, String> properties) throws GFacProviderException, GFacException { - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputStreamToFileWriter.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputStreamToFileWriter.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputStreamToFileWriter.java deleted file mode 100644 index 2467ce8..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputStreamToFileWriter.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.gfac.local.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.*; - -public class InputStreamToFileWriter extends Thread{ - protected final Logger log = LoggerFactory.getLogger(this.getClass()); - - private BufferedReader in; - private BufferedWriter out; - - public InputStreamToFileWriter(InputStream in, String out) throws IOException { - this.in = new BufferedReader(new InputStreamReader(in)); - this.out = new BufferedWriter(new FileWriter(out)); - } - - public void run() { - try { - String line = null; - while ((line = in.readLine()) != null) { - if (log.isDebugEnabled()) { - log.debug(line); - } - out.write(line); - out.newLine(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } finally { - if (in != null) { - try { - in.close(); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - if (out != null) { - try { - out.close(); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.java deleted file mode 100644 index 98671fd..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/InputUtils.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.local.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public class InputUtils { - - private static final Logger logger = LoggerFactory.getLogger(InputUtils.class); - - private static final String SPACE = " "; - - private InputUtils() { - } - - public static String buildCommand(List<String> cmdList) { - StringBuffer buff = new StringBuffer(); - for (String string : cmdList) { - logger.debug("Build Command --> " + string); - buff.append(string); - buff.append(SPACE); - } - return buff.toString(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java b/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java deleted file mode 100644 index 2b45df7..0000000 --- a/modules/gfac/gfac-local/src/main/java/org/apache/airavata/gfac/local/utils/LocalProviderUtil.java +++ /dev/null @@ -1,51 +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.local.utils; - -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.provider.GFacProviderException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; - -public class LocalProviderUtil { - private static final Logger log = LoggerFactory.getLogger(LocalProviderUtil.class); - - private void makeFileSystemDir(String dir) throws GFacProviderException { - File f = new File(dir); - if (f.isDirectory() && f.exists()) { - return; - } else if (!new File(dir).mkdir()) { - throw new GFacProviderException("Cannot make directory " + dir); - } - } - - public void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacProviderException { - log.info("working diectroy = " + jobExecutionContext.getWorkingDir()); - log.info("temp directory = " + jobExecutionContext.getScratchLocation()); - makeFileSystemDir(jobExecutionContext.getWorkingDir()); - makeFileSystemDir(jobExecutionContext.getScratchLocation()); - makeFileSystemDir(jobExecutionContext.getInputDir()); - makeFileSystemDir(jobExecutionContext.getOutputDir()); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/resources/errors.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/resources/errors.properties b/modules/gfac/gfac-local/src/main/resources/errors.properties deleted file mode 100644 index 88c41b8..0000000 --- a/modules/gfac/gfac-local/src/main/resources/errors.properties +++ /dev/null @@ -1,197 +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. -# - -# Directly copied from jglobus. Not a good way to manager error properties. -1 = Parameter not supported -2 = The RSL length is greater than the maximum allowed -3 = No resources available -4 = Bad directory specified -5 = The executable does not exist -6 = Insufficient funds -7 = Authentication with the remote server failed -8 = Job cancelled by user -9 = Job cancelled by system - -10 = Data transfer to the server failed -11 = The stdin file does not exist -12 = The connection to the server failed (check host and port) -13 = The provided RSL 'maxtime' value is invalid (not an integer or must be greater than 0) -14 = The provided RSL 'count' value is invalid (not an integer or must be greater than 0) -15 = The job manager received an invalid RSL -16 = Could not connect to job manager -17 = The job failed when the job manager attempted to run it -18 = Paradyn error -19 = The provided RSL 'jobtype' value is invalid - -20 = The provided RSL 'myjob' value is invalid -21 = The job manager failed to locate an internal script argument file -22 = The job manager failed to create an internal script argument file -23 = The job manager detected an invalid job state -24 = The job manager detected an invalid script response -25 = The job manager detected an invalid job state -26 = The provided RSL 'jobtype' value is not supported by this job manager -27 = Unimplemented -28 = The job manager failed to create an internal script submission file -29 = The job manager cannot find the user proxy - -30 = The job manager failed to open the user proxy -31 = The job manager failed to cancel the job as requested -32 = System memory allocation failed -33 = The interprocess job communication initialization failed -34 = The interprocess job communication setup failed -35 = The provided RSL 'host count' value is invalid -36 = One of the provided RSL parameters is unsupported -37 = The provided RSL 'queue' parameter is invalid -38 = The provided RSL 'project' parameter is invalid -39 = The provided RSL string includes variables that could not be identified - -40 = The provided RSL 'environment' parameter is invalid -41 = The provided RSL 'dryrun' parameter is invalid -42 = The provided RSL is invalid (an empty string) -43 = The job manager failed to stage the executable -44 = The job manager failed to stage the stdin file -45 = The requested job manager type is invalid -46 = The provided RSL 'arguments' parameter is invalid -47 = The gatekeeper failed to run the job manager -48 = The provided RSL could not be properly parsed -49 = There is a version mismatch between GRAM components - -50 = The provided RSL 'arguments' parameter is invalid -51 = The provided RSL 'count' parameter is invalid -52 = The provided RSL 'directory' parameter is invalid -53 = The provided RSL 'dryrun' parameter is invalid -54 = The provided RSL 'environment' parameter is invalid -55 = The provided RSL 'executable' parameter is invalid -56 = The provided RSL 'host_count' parameter is invalid -57 = The provided RSL 'jobtype' parameter is invalid -58 = The provided RSL 'maxtime' parameter is invalid -59 = The provided RSL 'myjob' parameter is invalid - -60 = The provided RSL 'paradyn' parameter is invalid -61 = The provided RSL 'project' parameter is invalid -62 = The provided RSL 'queue' parameter is invalid -63 = The provided RSL 'stderr' parameter is invalid -64 = The provided RSL 'stdin' parameter is invalid -65 = The provided RSL 'stdout' parameter is invalid -66 = The job manager failed to locate an internal script -67 = The job manager failed on the system call pipe() -68 = The job manager failed on the system call fcntl() -69 = The job manager failed to create the temporary stdout filename - -70 = The job manager failed to create the temporary stderr filename -71 = The job manager failed on the system call fork() -72 = The executable file permissions do not allow execution -73 = The job manager failed to open stdout -74 = The job manager failed to open stderr -75 = The cache file could not be opened in order to relocate the user proxy -76 = Cannot access cache files in ~/.globus/.gass_cache, check permissions, quota, and disk space -77 = The job manager failed to insert the contact in the client contact list -78 = The contact was not found in the job manager's client contact list -79 = Connecting to the job manager failed. Possible reasons: job terminated, invalid job contact, network problems, ... - -80 = The syntax of the job contact is invalid -81 = The executable parameter in the RSL is undefined -82 = The job manager service is misconfigured. condor arch undefined -83 = The job manager service is misconfigured. condor os undefined -84 = The provided RSL 'min_memory' parameter is invalid -85 = The provided RSL 'max_memory' parameter is invalid -86 = The RSL 'min_memory' value is not zero or greater -87 = The RSL 'max_memory' value is not zero or greater -88 = The creation of a HTTP message failed -89 = Parsing incoming HTTP message failed - -90 = The packing of information into a HTTP message failed -91 = An incoming HTTP message did not contain the expected information -92 = The job manager does not support the service that the client requested -93 = The gatekeeper failed to find the requested service -94 = The jobmanager does not accept any new requests (shutting down) -95 = The client failed to close the listener associated with the callback URL -96 = The gatekeeper contact cannot be parsed -97 = The job manager could not find the 'poe' command -98 = The job manager could not find the 'mpirun' command -99 = The provided RSL 'start_time' parameter is invalid" -100 = The provided RSL 'reservation_handle' parameter is invalid - -101 = The provided RSL 'max_wall_time' parameter is invalid -102 = The RSL 'max_wall_time' value is not zero or greater -103 = The provided RSL 'max_cpu_time' parameter is invalid -104 = The RSL 'max_cpu_time' value is not zero or greater -105 = The job manager is misconfigured, a scheduler script is missing -106 = The job manager is misconfigured, a scheduler script has invalid permissions -107 = The job manager failed to signal the job -108 = The job manager did not recognize/support the signal type -109 = The job manager failed to get the job id from the local scheduler - -110 = The job manager is waiting for a commit signal -111 = The job manager timed out while waiting for a commit signal -112 = The provided RSL 'save_state' parameter is invalid -113 = The provided RSL 'restart' parameter is invalid -114 = The provided RSL 'two_phase' parameter is invalid -115 = The RSL 'two_phase' value is not zero or greater -116 = The provided RSL 'stdout_position' parameter is invalid -117 = The RSL 'stdout_position' value is not zero or greater -118 = The provided RSL 'stderr_position' parameter is invalid -119 = The RSL 'stderr_position' value is not zero or greater - -120 = The job manager restart attempt failed -121 = The job state file doesn't exist -122 = Could not read the job state file -123 = Could not write the job state file -124 = The old job manager is still alive -125 = The job manager state file TTL expired -126 = It is unknown if the job was submitted -127 = The provided RSL 'remote_io_url' parameter is invalid -128 = Could not write the remote io url file -129 = The standard output/error size is different - -130 = The job manager was sent a stop signal (job is still running) -131 = The user proxy expired (job is still running) -132 = The job was not submitted by original jobmanager -133 = The job manager is not waiting for that commit signal -134 = The provided RSL scheduler specific parameter is invalid -135 = The job manager could not stage in a file -136 = The scratch directory could not be created -137 = The provided 'gass_cache' parameter is invalid -138 = The RSL contains attributes which are not valid for job submission -139 = The RSL contains attributes which are not valid for stdio update - -140 = The RSL contains attributes which are not valid for job restart -141 = The provided RSL 'file_stage_in' parameter is invalid -142 = The provided RSL 'file_stage_in_shared' parameter is invalid -143 = The provided RSL 'file_stage_out' parameter is invalid -144 = The provided RSL 'gass_cache' parameter is invalid -145 = The provided RSL 'file_cleanup' parameter is invalid -146 = The provided RSL 'scratch_dir' parameter is invalid -147 = The provided scheduler-specific RSL parameter is invalid -148 = A required RSL attribute was not defined in the RSL spec -149 = The gass_cache attribute points to an invalid cache directory - -150 = The provided RSL 'save_state' parameter has an invalid value -151 = The job manager could not open the RSL attribute validation file -152 = The job manager could not read the RSL attribute validation file -153 = The provided RSL 'proxy_timeout' is invalid -154 = The RSL 'proxy_timeout' value is not greater than zero -155 = The job manager could not stage out a file -156 = The job contact string does not match any which the job manager is handling -157 = Proxy delegation failed -158 = The job manager could not lock the state lock file - -1000 = Failed to start up callback handler -1003 = Job contact not set
