use of org.gridlab.gat.Preferences in project compss by bsc-wdc.
the class FileOutputStreamAdaptorTest method run.
private void run(String host, String script) {
Preferences preferences = new Preferences();
preferences.put("resourcebroker.adaptor.name", "commandlinessh,sshtrilead,local");
preferences.put("file.adaptor.name", "commandlinessh,sshtrilead,local");
SoftwareDescription sd = new SoftwareDescription();
sd.setExecutable("/bin/bash");
sd.setArguments(script);
try {
sd.addPreStagedFile(GAT.createFile(preferences, "tests" + java.io.File.separator + "src" + java.io.File.separator + "benchmarks" + java.io.File.separator + script));
} catch (GATObjectCreationException e) {
e.printStackTrace();
System.exit(1);
}
ResourceBroker broker = null;
try {
broker = GAT.createResourceBroker(preferences, new URI("any://" + host));
} catch (GATObjectCreationException e) {
e.printStackTrace();
System.exit(1);
} catch (URISyntaxException e) {
e.printStackTrace();
System.exit(1);
}
Job job = null;
try {
job = broker.submitJob(new JobDescription(sd));
} catch (GATInvocationException e) {
e.printStackTrace();
System.exit(1);
}
while (job.getState() != Job.JobState.STOPPED && job.getState() != Job.JobState.SUBMISSION_ERROR) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// ignored
}
}
}
use of org.gridlab.gat.Preferences in project compss by bsc-wdc.
the class RandomAccessFileAdaptorTest method test.
public AdaptorTestResult test(String adaptor, String host) {
AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
GATContext gatContext = new GATContext();
Preferences preferences = new Preferences();
preferences.put("randomaccessfile.adaptor.name", adaptor);
RandomAccessFile randomAccessFile = null;
try {
randomAccessFile = GAT.createRandomAccessFile(gatContext, preferences, "any://" + host + "/JavaGAT-random-accessfile", "rw");
} catch (GATObjectCreationException e) {
e.printStackTrace();
GAT.end();
System.exit(1);
}
adaptorTestResult.put("length ", lengthTest(gatContext, preferences, randomAccessFile, 0));
adaptorTestResult.put("write 'lorem ipsum'", writeTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
adaptorTestResult.put("length after write", lengthTest(gatContext, preferences, randomAccessFile, 13));
adaptorTestResult.put("seek ", seekTest(gatContext, preferences, randomAccessFile, 0));
adaptorTestResult.put("read ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
adaptorTestResult.put("write 'lorem ipsum' 2", writeTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
adaptorTestResult.put("length after write 2", lengthTest(gatContext, preferences, randomAccessFile, 26));
adaptorTestResult.put("seek 2 ", seekTest(gatContext, preferences, randomAccessFile, 0));
adaptorTestResult.put("read 2 ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
adaptorTestResult.put("read 3 ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
return adaptorTestResult;
}
use of org.gridlab.gat.Preferences in project compss by bsc-wdc.
the class SubmitRemoteJob method main.
public static void main(String[] args) throws Exception {
SoftwareDescription sd = new SoftwareDescription();
sd.setExecutable("/bin/hostname");
File stdout = GAT.createFile("hostname.txt");
sd.setStdout(stdout);
JobDescription jd = new JobDescription(sd);
Preferences prefs = new Preferences();
/*
prefs.put("VirtualOrganisation", "pvier");
prefs.put("vomsServerURL", "voms.grid.sara.nl");
prefs.put("vomsServerPort", "30000");
prefs.put("vomsHostDN", "/O=dutchgrid/O=hosts/OU=sara.nl/CN=voms.grid.sara.nl");
*/
CertificateSecurityContext ctxt = new CertificateSecurityContext(new URI(System.getProperty("user.home") + "/.globus/userkey.pem"), new URI(System.getProperty("user.home") + "/.globus/usercert.pem"), getPassphrase());
GATContext context = new GATContext();
context.addPreferences(prefs);
context.addSecurityContext(ctxt);
ResourceBroker broker = GAT.createResourceBroker(context, new URI(args[0]));
Job job = broker.submitJob(jd);
while ((job.getState() != JobState.STOPPED) && (job.getState() != JobState.SUBMISSION_ERROR)) {
System.out.println("State: " + job.getState());
Thread.sleep(1000);
}
}
Aggregations