use of org.gridlab.gat.resources.JavaSoftwareDescription in project compss by bsc-wdc.
the class ResourceBrokerJavaJobExample method start.
public void start(String brokerURI) {
ResourceBroker broker = null;
try {
broker = GAT.createResourceBroker(new URI(brokerURI));
} catch (GATObjectCreationException e) {
System.err.println("Failed to create resource broker at location '" + brokerURI + "': " + e);
return;
} catch (URISyntaxException e) {
System.err.println("Wrong uri '" + brokerURI + "': " + e);
return;
}
JavaSoftwareDescription sd = new JavaSoftwareDescription();
sd.setExecutable("/usr/bin/java");
sd.setJavaMain("my.package.HelloWorld");
sd.setJavaArguments("hello", "world");
sd.setJavaClassPath("myJar1:myDir");
sd.setJavaOptions("-version");
sd.addJavaSystemProperty("key", "value");
try {
sd.setStdout(GAT.createFile("javajob.txt"));
} catch (GATObjectCreationException e) {
System.err.println("Failed to create the stdout file 'javajob.txt': " + e);
return;
}
JobDescription jd = new JobDescription(sd);
Job job = null;
try {
job = broker.submitJob(jd);
} catch (GATInvocationException e) {
System.err.println("Failed to submit the job: " + e);
return;
}
while (job.getState() != JobState.STOPPED) {
System.out.println("job is in state: " + job.getState());
try {
Thread.sleep(200);
} catch (InterruptedException e) {
// ignore
}
}
}
Aggregations