epistemyscott
2010-12-07 11:51:00 UTC
Dear all,
I'm trying to use the Java DRMAA bindings to run jobs, and I'm running into problems when trying to redirect output.
For instance, when using the code below results in the following message in the qmaster messages file:
12/07/2010 11:19:28|worker|host123|W|job 71.1 failed on host host123.epistemy.com general opening input/output file because: 12/07/2010 11:19:27 [1024:14650]: error: can't open output file "$HOME/SGE-test/./SGE-test.log": No such file or directory
Touching the output files beforehand makes no difference.
If I comment out the setOutputPath and setErrorPath lines, I get the following:
12/07/2010 11:32:58|worker|host123|W|job 72.1 failed on host host123.epistemy.com general opening input/output file because: 12/07/2010 11:32:57 [1024:14705]: error: can't open output file "$HOME/SGE-test": No such file or directory
If I comment out the setWorkingDirectory line as well, it runs fine, but, of course, it puts all its output into my home directory with the wrong file names.
Should I be concerned at the apparent failure to expand $HOME, or is that just for logging purposes? Why does the second version seem to be trying to write its output directly onto the working directory? Does anyone have any suggestions on how to debug this? I'm running this using Java 1.6.0_17 on CentOS 5.5 and SGE 6.2u5.
Your help would be most appreciated.
Regards,
Scott
public static void submitJob(){
File runFolder = new File(System.getProperty("user.home"), "SGE-test");
runFolder.mkdir();
System.out.println("Folder created");
SessionFactory factory = SessionFactory.getFactory();
Session session = factory.getSession();
try{
session.init("");
JobTemplate job = session.createJobTemplate();
job.setRemoteCommand("pwd");
job.setJobName("SGE-test");
job.setBlockEmail(true);
job.setWorkingDirectory(JobTemplate.HOME_DIRECTORY+"SGE-test");
System.out.println("Working directory is: " + job.getWorkingDirectory());
job.setOutputPath(":"+JobTemplate.WORKING_DIRECTORY+"SGE-test.log");
job.setErrorPath(":"+JobTemplate.WORKING_DIRECTORY+"SGE-test.err.log");
String identifier = session.runJob(job);
System.out.println("Job submitted with identifier '" + identifier + "'.");
session.deleteJobTemplate(job);
}
catch(DrmaaException e){
System.out.println(e);
e.printStackTrace();
throw e;
}
finally{
try {
session.exit();
}
catch(DrmaaException e) {
System.out.println("Closing DRMAA session failed. " + e);
e.printStackTrace();
}
}
}
Scott Wilson
Developer
Epistemy
Energy Academy
Riccarton
EH14 4AS
tel: +44 131 564 0232
***@Epistemy.com
http://www.Epistemy.com/
Epistemy Limited is a company registered in Scotland, number SC365481.
Registered office: Epistemy Limited c/o Technology and Research Services, Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS
------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=302730
To unsubscribe from this discussion, e-mail: [users-***@gridengine.sunsource.net].
I'm trying to use the Java DRMAA bindings to run jobs, and I'm running into problems when trying to redirect output.
For instance, when using the code below results in the following message in the qmaster messages file:
12/07/2010 11:19:28|worker|host123|W|job 71.1 failed on host host123.epistemy.com general opening input/output file because: 12/07/2010 11:19:27 [1024:14650]: error: can't open output file "$HOME/SGE-test/./SGE-test.log": No such file or directory
Touching the output files beforehand makes no difference.
If I comment out the setOutputPath and setErrorPath lines, I get the following:
12/07/2010 11:32:58|worker|host123|W|job 72.1 failed on host host123.epistemy.com general opening input/output file because: 12/07/2010 11:32:57 [1024:14705]: error: can't open output file "$HOME/SGE-test": No such file or directory
If I comment out the setWorkingDirectory line as well, it runs fine, but, of course, it puts all its output into my home directory with the wrong file names.
Should I be concerned at the apparent failure to expand $HOME, or is that just for logging purposes? Why does the second version seem to be trying to write its output directly onto the working directory? Does anyone have any suggestions on how to debug this? I'm running this using Java 1.6.0_17 on CentOS 5.5 and SGE 6.2u5.
Your help would be most appreciated.
Regards,
Scott
public static void submitJob(){
File runFolder = new File(System.getProperty("user.home"), "SGE-test");
runFolder.mkdir();
System.out.println("Folder created");
SessionFactory factory = SessionFactory.getFactory();
Session session = factory.getSession();
try{
session.init("");
JobTemplate job = session.createJobTemplate();
job.setRemoteCommand("pwd");
job.setJobName("SGE-test");
job.setBlockEmail(true);
job.setWorkingDirectory(JobTemplate.HOME_DIRECTORY+"SGE-test");
System.out.println("Working directory is: " + job.getWorkingDirectory());
job.setOutputPath(":"+JobTemplate.WORKING_DIRECTORY+"SGE-test.log");
job.setErrorPath(":"+JobTemplate.WORKING_DIRECTORY+"SGE-test.err.log");
String identifier = session.runJob(job);
System.out.println("Job submitted with identifier '" + identifier + "'.");
session.deleteJobTemplate(job);
}
catch(DrmaaException e){
System.out.println(e);
e.printStackTrace();
throw e;
}
finally{
try {
session.exit();
}
catch(DrmaaException e) {
System.out.println("Closing DRMAA session failed. " + e);
e.printStackTrace();
}
}
}
Scott Wilson
Developer
Epistemy
Energy Academy
Riccarton
EH14 4AS
tel: +44 131 564 0232
***@Epistemy.com
http://www.Epistemy.com/
Epistemy Limited is a company registered in Scotland, number SC365481.
Registered office: Epistemy Limited c/o Technology and Research Services, Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS
------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=302730
To unsubscribe from this discussion, e-mail: [users-***@gridengine.sunsource.net].