You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(39) |
May
(165) |
Jun
(164) |
Jul
(127) |
Aug
(81) |
Sep
(146) |
Oct
(375) |
Nov
(241) |
Dec
(77) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(42) |
Feb
(38) |
Mar
(30) |
Apr
(6) |
May
(17) |
Jun
|
Jul
(15) |
Aug
(59) |
Sep
(31) |
Oct
(44) |
Nov
(30) |
Dec
(12) |
| 2008 |
Jan
(9) |
Feb
(63) |
Mar
(18) |
Apr
(43) |
May
(28) |
Jun
(32) |
Jul
(61) |
Aug
(5) |
Sep
(72) |
Oct
(48) |
Nov
(6) |
Dec
|
|
From: <ha...@us...> - 2007-09-06 22:16:04
|
Revision: 1732
http://cogkit.svn.sourceforge.net/cogkit/?rev=1732&view=rev
Author: hategan
Date: 2007-09-06 15:15:49 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
updated changes
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/CHANGES.txt
Modified: trunk/current/src/cog/modules/karajan/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-09-06 22:09:54 UTC (rev 1731)
+++ trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-09-06 22:15:49 UTC (rev 1732)
@@ -1,3 +1,8 @@
+(09/06/2007)
+
+*** Partial ability to have a CWD for each separate execution,
+ if done from the same JVM.
+
(08/28/2007)
*** "off" is now a valid value for throttling parameters
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-09-06 22:09:57
|
Revision: 1731
http://cogkit.svn.sourceforge.net/cogkit/?rev=1731&view=rev
Author: hategan
Date: 2007-09-06 15:09:54 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
configurable workdir
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/ExecutionContext.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/ExecutionContext.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/ExecutionContext.java 2007-08-28 16:49:37 UTC (rev 1730)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/ExecutionContext.java 2007-09-06 22:09:54 UTC (rev 1731)
@@ -9,6 +9,7 @@
*/
package org.globus.cog.karajan.workflow;
+import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -77,6 +78,7 @@
private transient VariableArguments stdout, stderr;
private int id;
private long startTime, endTime;
+ private String cwd;
public ExecutionContext(ElementTree tree) {
this(tree, KarajanProperties.getDefault());
@@ -90,6 +92,7 @@
this.tree = tree;
eventListeners = new LinkedList();
this.properties = properties;
+ cwd = new File(".").getAbsolutePath();
}
public boolean isMonitoringEnabled() {
@@ -395,5 +398,16 @@
protected void setStartTime(long startTime) {
this.startTime = startTime;
- }
+ }
+
+ public String getCwd() {
+ return cwd;
+ }
+
+ public void setCwd(String cwd) {
+ if (cwd == null) {
+ throw new IllegalArgumentException("CWD cannot be null");
+ }
+ this.cwd = cwd;
+ }
}
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java 2007-08-28 16:49:37 UTC (rev 1730)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AbstractFileOperation.java 2007-09-06 22:09:54 UTC (rev 1731)
@@ -51,6 +51,9 @@
String provider = TypeUtil.toString(OA_PROVIDER.getValue(stack));
Contact host = getHost(stack, OA_HOST, scheduler, provider);
+ if (host.equals(BoundContact.LOCALHOST)) {
+ spec.setAttribute("cwd", stack.getExecutionContext().getCwd());
+ }
if (scheduler == null) {
task.setService(0, getService((BoundContact) host, provider));
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java 2007-08-28 16:49:37 UTC (rev 1730)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/GridTransfer.java 2007-09-06 22:09:54 UTC (rev 1731)
@@ -133,12 +133,12 @@
}
if (sourceContact.equals(BoundContact.LOCALHOST) && fs.getSourceDirectory().equals("")) {
- fs.setSourceDirectory(new File(".").getAbsolutePath());
+ fs.setSourceDirectory(stack.getExecutionContext().getCwd());
}
if (destinationContact.equals(BoundContact.LOCALHOST)
&& fs.getDestinationDirectory().equals("")) {
- fs.setDestinationDirectory(new File(".").getAbsolutePath());
+ fs.setDestinationDirectory(stack.getExecutionContext().getCwd());
}
task.setType(Task.FILE_TRANSFER);
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java 2007-08-28 16:49:37 UTC (rev 1730)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/restartLog/RestartLog.java 2007-09-06 22:09:54 UTC (rev 1731)
@@ -12,10 +12,8 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
-import java.nio.channels.FileLock;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
@@ -37,7 +35,7 @@
public static final Arg A_RESUME = new Arg.Optional("resume");
public static final Arg A_NAME = new Arg.Optional("name", null);
public static final Arg.Channel LOG_CHANNEL = new Arg.Channel("restartlog");
-
+
static {
setArguments(RestartLog.class, new Arg[] { A_RESUME, A_NAME });
}
@@ -116,7 +114,8 @@
}
for (int i = 0; i < Integer.MAX_VALUE; i++) {
String index = "." + String.valueOf(i);
- File f = new File(name + index + ".rlog");
+ File f = new File(stack.getExecutionContext().getCwd() + File.separator + name + index
+ + ".rlog");
if (f.exists()) {
continue;
}
@@ -151,15 +150,6 @@
startRest(stack);
}
- private FileLock getLock(File f) throws IOException {
- FileOutputStream fos = new FileOutputStream(f);
- FileLock lock = fos.getChannel().tryLock();
- if (lock == null) {
- fos.close();
- }
- return lock;
- }
-
protected void post(VariableStack stack) throws ExecutionException {
deleteLog(stack);
super.post(stack);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-28 16:49:40
|
Revision: 1730
http://cogkit.svn.sourceforge.net/cogkit/?rev=1730&view=rev
Author: hategan
Date: 2007-08-28 09:49:37 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
fixed broken dependency
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-dcache/CHANGES.txt
trunk/current/src/cog/modules/provider-dcache/dependencies.xml
Modified: trunk/current/src/cog/modules/provider-dcache/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/CHANGES.txt 2007-08-28 16:40:07 UTC (rev 1729)
+++ trunk/current/src/cog/modules/provider-dcache/CHANGES.txt 2007-08-28 16:49:37 UTC (rev 1730)
@@ -1,3 +1,8 @@
+(08/28/07)
+
+*** Fixed broken dependency (abstraction-local instead of
+ provider-local)
+
(08/23/07)
*** Initial commit
\ No newline at end of file
Modified: trunk/current/src/cog/modules/provider-dcache/dependencies.xml
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/dependencies.xml 2007-08-28 16:40:07 UTC (rev 1729)
+++ trunk/current/src/cog/modules/provider-dcache/dependencies.xml 2007-08-28 16:49:37 UTC (rev 1730)
@@ -5,7 +5,7 @@
<property name="module" value="abstraction-common"/>
</ant>
<ant antfile="${main.buildfile}" target="dep">
- <property name="module" value="abstraction-local"/>
+ <property name="module" value="provider-local"/>
</ant>
</target>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-28 16:40:10
|
Revision: 1729
http://cogkit.svn.sourceforge.net/cogkit/?rev=1729&view=rev
Author: hategan
Date: 2007-08-28 09:40:07 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
updated changes
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/CHANGES.txt
Modified: trunk/current/src/cog/modules/karajan/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-08-28 16:38:34 UTC (rev 1728)
+++ trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-08-28 16:40:07 UTC (rev 1729)
@@ -1,3 +1,7 @@
+(08/28/2007)
+
+*** "off" is now a valid value for throttling parameters
+
(08/23/2007)
*** Added task:availableHandlers(*type). In case people don't
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-28 16:38:47
|
Revision: 1728
http://cogkit.svn.sourceforge.net/cogkit/?rev=1728&view=rev
Author: hategan
Date: 2007-08-28 09:38:34 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
off as a valid throttle value
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/AbstractScheduler.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/AbstractScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/AbstractScheduler.java 2007-08-24 02:55:34 UTC (rev 1727)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/AbstractScheduler.java 2007-08-28 16:38:34 UTC (rev 1728)
@@ -32,6 +32,8 @@
public abstract class AbstractScheduler extends Thread implements Scheduler {
private static final Logger logger = Logger.getLogger(AbstractScheduler.class);
+
+ public static final int THROTTLE_OFF = 100000000;
private List taskHandlers;
@@ -185,13 +187,22 @@
public void setProperty(String name, Object value) {
if (name.equalsIgnoreCase("maxSimultaneousJobs")) {
logger.debug("Scheduler: setting maxSimultaneousJobs to " + value);
- setMaxSimultaneousJobs(TypeUtil.toInt(value));
+ setMaxSimultaneousJobs(throttleValue(value));
}
else {
throw new IllegalArgumentException("Unsupported property: " + name
+ ". Supported properties are: " + Arrays.asList(this.getPropertyNames()));
}
}
+
+ protected int throttleValue(Object value) {
+ if ("off".equalsIgnoreCase(value.toString())) {
+ return THROTTLE_OFF;
+ }
+ else {
+ return TypeUtil.toInt(value);
+ }
+ }
public Object getProperty(String name) {
return properties.get(name);
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java 2007-08-24 02:55:34 UTC (rev 1727)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java 2007-08-28 16:38:34 UTC (rev 1728)
@@ -538,22 +538,22 @@
public void setProperty(String name, Object value) {
if (name.equalsIgnoreCase(JOBS_PER_CPU)) {
logger.debug("Scheduler: setting jobsPerCpu to " + value);
- jobsPerCPU = TypeUtil.toInt(value);
+ jobsPerCPU = throttleValue(value);
}
else if (name.equalsIgnoreCase(SUBMIT_THROTTLE)) {
- submitQueue.setThrottle(TypeUtil.toInt(value));
+ submitQueue.setThrottle(throttleValue(value));
}
else if (name.equalsIgnoreCase(HOST_SUBMIT_THROTTLE)) {
- submitQueue.setHostThrottle(TypeUtil.toInt(value));
+ submitQueue.setHostThrottle(throttleValue(value));
}
else if (name.equalsIgnoreCase(MAX_TRANSFERS)) {
- maxTransfers = TypeUtil.toInt(value);
+ maxTransfers = throttleValue(value);
}
else if (name.equalsIgnoreCase(SSH_INITIAL_RATE)) {
sshInitialRate = TypeUtil.toInt(value);
}
else if (name.equalsIgnoreCase(MAX_FILE_OPERATIONS)) {
- maxFileOperations = TypeUtil.toInt(value);
+ maxFileOperations = throttleValue(value);
}
else {
super.setProperty(name, value);
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2007-08-24 02:55:34 UTC (rev 1727)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2007-08-28 16:38:34 UTC (rev 1728)
@@ -298,7 +298,7 @@
}
}
else if (JOB_THROTTLE.equals(name)) {
- jobThrottle = TypeUtil.toInt(value);
+ jobThrottle = throttleValue(value);
}
else {
double val = TypeUtil.toDouble(value);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 02:55:35
|
Revision: 1727
http://cogkit.svn.sourceforge.net/cogkit/?rev=1727&view=rev
Author: hategan
Date: 2007-08-23 19:55:34 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
hmm
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java 2007-08-24 02:53:18 UTC (rev 1726)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java 2007-08-24 02:55:34 UTC (rev 1727)
@@ -527,16 +527,16 @@
gridFile.setLastModified(fileInfo.getDate());
- if (fileInfo.isFile() == true) {
+ if (fileInfo.isFile()) {
gridFile.setFileType(GridFile.FILE);
}
- if (fileInfo.isDirectory() == true) {
+ if (fileInfo.isDirectory()) {
gridFile.setFileType(GridFile.DIRECTORY);
}
- if (fileInfo.isDevice() == true) {
+ if (fileInfo.isDevice()) {
gridFile.setFileType(GridFile.DEVICE);
}
- if (fileInfo.isSoftLink() == true) {
+ if (fileInfo.isSoftLink()) {
gridFile.setFileType(GridFile.SOFTLINK);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 02:53:19
|
Revision: 1726
http://cogkit.svn.sourceforge.net/cogkit/?rev=1726&view=rev
Author: hategan
Date: 2007-08-23 19:53:18 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
trying again...
Removed Paths:
-------------
trunk/current/src/cog/modules/abstraction-examples/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 02:49:45
|
Revision: 1725
http://cogkit.svn.sourceforge.net/cogkit/?rev=1725&view=rev
Author: hategan
Date: 2007-08-23 19:49:44 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
cleaned up
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java 2007-08-24 01:52:54 UTC (rev 1724)
+++ trunk/current/src/cog/modules/provider-local/src/org/globus/cog/abstraction/impl/file/local/FileResourceImpl.java 2007-08-24 02:49:44 UTC (rev 1725)
@@ -14,6 +14,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
+import java.util.List;
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.task.IllegalSpecException;
@@ -37,12 +38,11 @@
* Supports absolute and relative path names
*/
public class FileResourceImpl extends AbstractFileResource {
- private File resource = null;
public static final Logger logger = Logger
- .getLogger(FileResourceImpl.class.getName());
+ .getLogger(FileResourceImpl.class);
+
+ private File cwd;
- public int ltoken;
-
public FileResourceImpl() {
super();
}
@@ -54,69 +54,83 @@
/** set user's home directory as the current directory */
public void start() throws IllegalHostException,
InvalidSecurityContextException, FileResourceException {
- setCurrentDirectory(new File(".").getAbsoluteFile().toURI().getPath());
+ setCurrentDirectory(new File(".").getAbsoluteFile());
setStarted(true);
}
/** close the file */
public void stop() {
- resource = null;
setStarted(false);
}
/** equivalent to cd */
public void setCurrentDirectory(String directory)
throws FileResourceException {
- if (this.isDirectory(resolveName(directory))) {
- resource = new File(resolveName(directory));
- } else {
- throw new DirectoryNotFoundException("Directory does not exist: "
- + directory);
+ setCurrentDirectory(new File(directory));
+ }
+
+ private void setCurrentDirectory(File f) throws FileResourceException {
+ f = resolve(f);
+ if (!f.exists()) {
+ throw new DirectoryNotFoundException("Directory does not exist: " + f.getAbsolutePath());
}
+ if (!f.isDirectory()) {
+ throw new DirectoryNotFoundException("Not a directory: " + f.getAbsolutePath());
+ }
+ if (!f.isAbsolute()) {
+ throw new Error("Only absolute paths allowed beyond this point.");
+ }
+ cwd = f;
}
/** return current path */
public String getCurrentDirectory() {
- return resource.toURI().getPath();
+ return cwd.getAbsolutePath();
}
/**
* This method checks to see if the given name is an absolute or a relative
* path name. If its relative appends current path to it.
*/
- private String resolveName(String fileName) {
- File newFile = new File(fileName);
- if (newFile.isAbsolute() == true) {
- return fileName;
- } else {
- return (getCurrentDirectory() + File.separator + fileName);
+ protected File resolve(File f) {
+ if (f.isAbsolute()) {
+ return f;
}
+ else {
+ return new File(cwd.getAbsolutePath() + File.separatorChar + f.getPath());
+ }
}
+ protected File resolve(String sf) {
+ File f = new File(sf);
+ if (f.isAbsolute()) {
+ return f;
+ }
+ else {
+ return new File(cwd.getAbsolutePath() + File.separatorChar + f.getPath());
+ }
+ }
/** list the contents of the current directory */
public Collection list() {
- ArrayList files = new ArrayList();
- String fileArray[] = null;
-
- fileArray = resource.list();
- for (int i = 0; i < fileArray.length; i++) {
- files.add(createGridFile(fileArray[i]));
+ List files = new ArrayList();
+ File[] f = cwd.listFiles();
+ for (int i = 0; i < f.length; i++) {
+ files.add(createGridFile(f[i]));
}
-
return files;
}
/** list contents of the given directory */
public Collection list(String directory) throws FileResourceException {
- if (!this.isDirectory(resolveName(directory))) {
- throw new DirectoryNotFoundException("Could not find directory: "
- + directory);
+ File tcwd = cwd;
+ try {
+ setCurrentDirectory(new File(directory));
+ Collection list = list();
+ return list;
}
- String currentPath = getCurrentDirectory();
- resource = new File(resolveName(directory));
- Collection list = list();
- setCurrentDirectory(currentPath);
- return list;
+ finally {
+ setCurrentDirectory(tcwd);
+ }
}
/**
@@ -126,10 +140,10 @@
*/
public void createDirectory(String directory)
throws FileResourceException {
- String currentPath = getCurrentDirectory();
- this.resource = new File(resolveName(directory));
- resource.mkdir();
- setCurrentDirectory(currentPath);// [m] ???
+ File f = resolve(directory);
+ if (!f.mkdir() && !f.exists()) {
+ throw new FileResourceException("Failed to create directory: " + directory);
+ }
}
public void createDirectories(String directory)
@@ -137,47 +151,56 @@
if (directory == null || directory.equals("")) {
return;
}
- File f = new File(directory);
+ File f = resolve(directory);
if (!f.mkdirs() && !f.exists()) {
- throw new FileResourceException("Failed to create directory: "
- + directory);
+ throw new FileResourceException("Failed to create directory: " + directory);
}
}
- /** delete the given directory. If force == true, recursive delete */
- public void deleteDirectory(String directory, boolean force)
- throws FileResourceException {
-
- String currentPath = getCurrentDirectory();
- setCurrentDirectory(directory);
- Iterator fileNames = list().iterator();
-
- while ((fileNames != null) && (fileNames.hasNext()) && (force = true)) {
- File newFile = new File(((GridFile) fileNames.next())
- .getAbsolutePathName());
- if (newFile.isFile() == true) {
- newFile.delete();
- } else {
- deleteDirectory(newFile.getAbsolutePath(), force);
+ public void deleteDirectory(String dir, boolean force) throws FileResourceException {
+ deleteDirectory(resolve(dir), force);
+ }
+
+ private void deleteDirectory(File f, boolean force) throws FileResourceException {
+ File[] fs = f.listFiles();
+ if (force) {
+ for (int i = 0; i < fs.length; i++) {
+ if (fs[i].isFile()) {
+ if (!fs[i].delete()) {
+ throw new FileResourceException("Could not delete directory: "
+ + f.getAbsolutePath() + ". Failed to delete file: " + fs[i].getAbsolutePath());
+ }
+ }
+ else {
+ deleteDirectory(fs[i], true);
+ }
}
+ fs = f.listFiles();
}
-
- resource.delete();
- setCurrentDirectory(currentPath);
+ if (fs.length != 0) {
+ throw new FileResourceException("Could not delete directory: "
+ + f.getAbsolutePath() + ". Directory not empty.");
+ }
+ else {
+ if (f.delete()) {
+ throw new FileResourceException("Could not delete directory: "
+ + f.getAbsolutePath());
+ }
+ }
}
-
+
/** remove a file */
public void deleteFile(String fileName) throws FileResourceException {
- File localFile = new File(resolveName(fileName));
+ File localFile = resolve(fileName);
if (!localFile.exists()) {
throw new FileNotFoundException(fileName + " not found.");
}
-
if (isDirectory(fileName) == true) {
throw new FileResourceException("File is a directory ");
}
-
- localFile.delete();
+ if (!localFile.delete()) {
+ throw new FileResourceException("Could not delete file " + fileName);
+ }
}
public void getFile(String remoteFileName, String localFileName)
@@ -190,20 +213,20 @@
ProgressMonitor progressMonitor) throws FileResourceException {
try {
- File remote = new File(resolveName(remoteFileName));
- if (!remote.exists()) {
+ File src = resolve(remoteFileName);
+ if (!src.exists()) {
throw new FileNotFoundException("File not found: "
- + remote.getAbsolutePath());
+ + src.getAbsolutePath());
}
- File local = new File(resolveName(localFileName));
+ File dst = resolve(localFileName);
// silently ignore requests for which source == destination
- if (remote.getCanonicalPath().equals(local.getCanonicalPath())) {
+ if (dst.getCanonicalPath().equals(src.getCanonicalPath())) {
return;
}
- FileInputStream remoteStream = new FileInputStream(remote);
- FileOutputStream localStream = new FileOutputStream(local);
+ FileInputStream remoteStream = new FileInputStream(src);
+ FileOutputStream localStream = new FileOutputStream(dst);
long crt = 0;
- long total = remote.length();
+ long total = src.length();
byte[] buf = new byte[16384];
int read;
while ((read = remoteStream.read(buf)) != -1) {
@@ -322,19 +345,17 @@
/** get file information */
public GridFile getGridFile(String fileName) throws FileResourceException {
- return createGridFile(fileName);
+ return createGridFile(resolve(fileName));
}
/** return true of file exists */
public boolean exists(String filename) throws FileResourceException {
- File tempFile = new File(resolveName(filename));
- return tempFile.exists();
+ return resolve(filename).exists();
}
/** return true if input is a directory */
public boolean isDirectory(String dirName) throws FileResourceException {
- File isDir = new File(resolveName(dirName));
- return isDir.isDirectory();
+ return resolve(dirName).isDirectory();
}
/** submit a workflow to local resource. not implemented */
@@ -343,24 +364,22 @@
}
/** obtain file information in the form of a gridfile */
- private GridFile createGridFile(Object obj) {
- String fileName = (String) obj;
+ private GridFile createGridFile(File f) {
GridFile gridFile = new GridFileImpl();
- File fileInfo = new File(resolveName(fileName));
- gridFile.setAbsolutePathName(fileInfo.getAbsolutePath());
- gridFile.setLastModified(String.valueOf(new Date(fileInfo
+ gridFile.setAbsolutePathName(f.getAbsolutePath());
+ gridFile.setLastModified(String.valueOf(new Date(f
.lastModified())));
- if (fileInfo.isFile() == true) {
+ if (f.isFile() == true) {
gridFile.setFileType(GridFile.FILE);
}
- if (fileInfo.isDirectory() == true) {
+ if (f.isDirectory() == true) {
gridFile.setFileType(GridFile.DIRECTORY);
}
- gridFile.setName(fileInfo.getName());
- gridFile.setSize(fileInfo.length());
+ gridFile.setName(f.getName());
+ gridFile.setSize(f.length());
Permissions userPermissions = new PermissionsImpl();
Permissions groupPermissions = new PermissionsImpl();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 01:52:56
|
Revision: 1724
http://cogkit.svn.sourceforge.net/cogkit/?rev=1724&view=rev
Author: hategan
Date: 2007-08-23 18:52:54 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
nicer pretty print; "String" can be used instead of "java.lang.String"
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/JavaMethodInvocationNode.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/JavaMethodInvocationNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/JavaMethodInvocationNode.java 2007-08-24 00:51:42 UTC (rev 1723)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/JavaMethodInvocationNode.java 2007-08-24 01:52:54 UTC (rev 1724)
@@ -41,6 +41,7 @@
TYPES.put("double", double.class);
TYPES.put("char", char.class);
TYPES.put("long", long.class);
+ TYPES.put("String", String.class);
}
static {
@@ -247,7 +248,14 @@
if (i != 0) {
sb.append(", ");
}
- sb.append(array[i]);
+ if (array[i] instanceof String) {
+ sb.append('"');
+ sb.append(array[i]);
+ sb.append('"');
+ }
+ else {
+ sb.append(array[i]);
+ }
}
sb.append(']');
return sb.toString();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 00:51:43
|
Revision: 1723
http://cogkit.svn.sourceforge.net/cogkit/?rev=1723&view=rev
Author: hategan
Date: 2007-08-23 17:51:42 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
some failures didn't properly clean up
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java 2007-08-24 00:50:52 UTC (rev 1722)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/LateBindingScheduler.java 2007-08-24 00:51:42 UTC (rev 1723)
@@ -9,8 +9,10 @@
*/
package org.globus.cog.karajan.scheduler;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
@@ -297,6 +299,9 @@
}
protected void failTask(Task t, String message, Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failing task " + t + " because of " + message, e);
+ }
Status s = new StatusImpl();
s.setPrevStatusCode(t.getStatus().getStatusCode());
s.setStatusCode(Status.FAILED);
@@ -305,6 +310,8 @@
t.setStatus(s);
fireJobStatusChangeEvent(t, s);
}
+
+ private List contactTran = new ArrayList();
void submitUnbound(Task t) throws NoFreeResourceException {
try {
@@ -312,6 +319,7 @@
return;
}
checkTaskLoadConditions(t);
+ contactTran.clear();
Service[] services = new Service[t.getRequiredServices()];
Contact[] contacts;
Object constraints = getConstraints(t);
@@ -319,6 +327,7 @@
contacts = (Contact[]) constraints;
if (contacts == null) {
contacts = new Contact[] { this.getNextContact(t) };
+ contactTran.add(contacts[0]);
}
}
else {
@@ -326,13 +335,15 @@
for (int i = 0; i < t.getRequiredServices(); i++) {
if (t.getService(i) == null) {
contacts[i] = this.getNextContact(t);
+ contactTran.add(contacts[i]);
}
}
}
-
+
for (int i = 0; i < services.length; i++) {
if (contacts[i] != null && contacts[i].isVirtual()) {
contacts[i] = resolveContact(t, contacts[i]);
+ contactTran.add(contacts[i]);
}
try {
services[i] = t.getService(i);
@@ -357,11 +368,15 @@
((JobSpecification) t.getSpecification()).setAttribute("project", project);
}
}
-
+
submitBoundToServices(t, contacts, services);
logger.debug("No host specified");
}
catch (NoFreeResourceException e) {
+ Iterator i = contactTran.iterator();
+ while (i.hasNext()) {
+ releaseContact((Contact) i.next());
+ }
throw e;
}
catch (Exception e) {
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2007-08-24 00:50:52 UTC (rev 1722)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2007-08-24 00:51:42 UTC (rev 1723)
@@ -109,7 +109,7 @@
wh.setDelayedDelta(wh.getDelayedDelta() + factor);
}
- protected double factor(double score, double factor) {
+ protected final double factor(double score, double factor) {
return score + factor;
}
@@ -186,10 +186,13 @@
if (logger.isDebugEnabled()) {
logger.debug("Next contact: " + selected);
}
+
sorted.changeLoad(selected, 1);
selected.setDelayedDelta(successFactor);
return selected.getHost();
}
+
+
public synchronized void releaseContact(Contact contact) {
if (logger.isDebugEnabled()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 00:50:53
|
Revision: 1722
http://cogkit.svn.sourceforge.net/cogkit/?rev=1722&view=rev
Author: hategan
Date: 2007-08-23 17:50:52 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
more fixes
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java 2007-08-24 00:50:02 UTC (rev 1721)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java 2007-08-24 00:50:52 UTC (rev 1722)
@@ -12,6 +12,7 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.AbstractionProperties;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
@@ -21,9 +22,14 @@
import org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction;
public class AvailableTaskHandlers extends AbstractFunction {
+ public static final Logger logger = Logger.getLogger(AvailableTaskHandlers.class);
public static final Arg A_TYPE = new Arg.Optional("type");
+ static {
+ setArguments(AvailableTaskHandlers.class, new Arg[] { A_TYPE });
+ }
+
public Object function(VariableStack stack) throws ExecutionException {
List providers;
if (A_TYPE.isPresent(stack)) {
@@ -44,7 +50,11 @@
List providers = AbstractionProperties.getProviders(atype);
Iterator i = providers.iterator();
while (i.hasNext()) {
- TaskHandlerNode.HANDLERS_CHANNEL.ret(stack, new TaskHandlerWrapper((String) i.next(),
+ String provider = (String) i.next();
+ if (logger.isDebugEnabled()) {
+ logger.debug("Available task handler: " + type + ", " + provider);
+ }
+ TaskHandlerNode.HANDLERS_CHANNEL.ret(stack, new TaskHandlerWrapper(provider,
itype));
}
}
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java 2007-08-24 00:50:02 UTC (rev 1721)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java 2007-08-24 00:50:52 UTC (rev 1722)
@@ -6,15 +6,18 @@
package org.globus.cog.karajan.workflow.nodes.grid;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.AbstractionFactory;
+import org.globus.cog.abstraction.impl.common.AbstractionProperties;
import org.globus.cog.abstraction.impl.common.task.ExecutionServiceImpl;
import org.globus.cog.abstraction.impl.common.task.ServiceContactImpl;
import org.globus.cog.abstraction.impl.common.task.ServiceImpl;
import org.globus.cog.abstraction.interfaces.ExecutionService;
import org.globus.cog.abstraction.interfaces.SecurityContext;
import org.globus.cog.abstraction.interfaces.Service;
-import org.globus.cog.abstraction.interfaces.TaskHandler;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableNotFoundException;
import org.globus.cog.karajan.stack.VariableStack;
@@ -24,7 +27,33 @@
public class ServiceNode extends AbstractFunction {
private static final Logger logger = Logger.getLogger(ServiceNode.class);
+
+ private static final Map stypes;
+
+ static {
+ stypes = new HashMap();
+ stypes.put(AbstractionProperties.TYPE_EXECUTION_TASK_HANDLER, new Integer(
+ Service.EXECUTION));
+ stypes.put(AbstractionProperties.TYPE_FILE_TRANSFER_TASK_HANDLER, new Integer(
+ Service.FILE_TRANSFER));
+ stypes.put(AbstractionProperties.TYPE_FILE_OPERATION_TASK_HANDLER, new Integer(
+ Service.FILE_OPERATION));
+ }
+
+ public static int abstractionToServiceType(String type) {
+ try {
+ return ((Integer) stypes.get(type)).intValue();
+ }
+ catch (NullPointerException e) {
+ throw new IllegalArgumentException("Invalid abstraction handler type: " + type);
+ }
+ }
+
+ public static int karajanToServiceType(String type) {
+ return abstractionToServiceType(TaskHandlerNode.karajanToAbstractionType(type));
+ }
+
public static final Arg A_TYPE = new Arg.Positional("type");
public static final Arg A_PROVIDER = new Arg.Positional("provider");
public static final Arg A_URI = new Arg.Optional("uri", null);
@@ -41,8 +70,8 @@
public Object function(VariableStack stack) throws ExecutionException {
Service service = null;
String type = TypeUtil.toString(A_TYPE.getValue(stack));
- int itype = TaskHandlerNode.karajanToHandlerType(type);
- if (itype == TaskHandler.EXECUTION) {
+ int itype = karajanToServiceType(type);
+ if (itype == Service.EXECUTION) {
itype = Service.EXECUTION;
service = new ExecutionServiceImpl();
if (A_JOB_MANAGER.isPresent(stack)) {
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java 2007-08-24 00:50:02 UTC (rev 1721)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java 2007-08-24 00:50:52 UTC (rev 1722)
@@ -58,11 +58,11 @@
throw new IllegalArgumentException("Invalid abstraction handler type: " + type);
}
}
-
+
public static int karajanToHandlerType(String type) {
return abstractionToHandlerType(karajanToAbstractionType(type));
}
-
+
public static final Arg A_TYPE = new Arg.Positional("type");
public static final Arg A_PROVIDER = new Arg.Positional("provider");
public static final Arg.Channel HANDLERS_CHANNEL = new Arg.Channel("handlers");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 00:50:06
|
Revision: 1721
http://cogkit.svn.sourceforge.net/cogkit/?rev=1721&view=rev
Author: hategan
Date: 2007-08-23 17:50:02 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
debug check
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java 2007-08-24 00:49:23 UTC (rev 1720)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/RestartOnErrorNode.java 2007-08-24 00:50:02 UTC (rev 1721)
@@ -53,16 +53,19 @@
super.notificationEvent(e);
return;
}
-
int itimes = stack.currentFrame().preDecrementAtomic("#restartTimes");
if (itimes >= 0) {
- logger.debug("Restarting. " + itimes + " times left.");
- logger.debug("Stack size: " + stack.frameCount());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Restarting. " + itimes + " times left.");
+ logger.debug("Stack size: " + stack.frameCount());
+ }
this.startRest(stack);
return;
}
else {
- logger.debug("Failed too many times.");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed too many times.");
+ }
}
}
super.notificationEvent(e);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 00:49:24
|
Revision: 1720
http://cogkit.svn.sourceforge.net/cogkit/?rev=1720&view=rev
Author: hategan
Date: 2007-08-23 17:49:23 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
a few fixes
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java 2007-08-24 00:48:54 UTC (rev 1719)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/BoundContact.java 2007-08-24 00:49:23 UTC (rev 1720)
@@ -85,7 +85,7 @@
public static int getServiceType(int handlerType) {
if (handlerType == TaskHandler.EXECUTION) {
- return Service.JOB_SUBMISSION;
+ return Service.EXECUTION;
}
else if (handlerType == TaskHandler.FILE_TRANSFER) {
return Service.FILE_OPERATION;
@@ -100,15 +100,15 @@
public static int getServiceType(String type) {
if (type == null) {
- return Service.JOB_SUBMISSION;
+ return Service.EXECUTION;
}
if (type.equalsIgnoreCase("execution") || type.equalsIgnoreCase("job-submission")) {
- return Service.JOB_SUBMISSION;
+ return Service.EXECUTION;
}
if (type.equalsIgnoreCase("file")) {
return Service.FILE_OPERATION;
}
- return Service.JOB_SUBMISSION;
+ return Service.EXECUTION;
}
public Map getServices() {
@@ -172,9 +172,11 @@
public boolean equals(Object obj) {
if (obj instanceof TypeProviderPair) {
TypeProviderPair other = (TypeProviderPair) obj;
+
if (type != other.type) {
return false;
}
+
if (provider == null) {
return other.provider == null;
}
@@ -184,7 +186,7 @@
}
public int hashCode() {
- return type + (provider == null ? 0 : provider.hashCode());
+ return (provider == null ? 0 : provider.hashCode());
}
public String toString() {
@@ -205,14 +207,16 @@
public Localhost() {
fileService.setType(Service.FILE_OPERATION);
transferService.setType(Service.FILE_TRANSFER);
+ executionService.setType(Service.EXECUTION);
addService(fileService);
addService(transferService);
+ addService(executionService);
setHost("localhost");
}
public Service getService(int type, String provider) {
if (type == Service.FILE_OPERATION || type == Service.FILE_TRANSFER
- || type == Service.JOB_SUBMISSION) {
+ || type == Service.EXECUTION) {
return new ServiceImpl(provider, LOCALHOST, null);
}
else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-24 00:48:55
|
Revision: 1719
http://cogkit.svn.sourceforge.net/cogkit/?rev=1719&view=rev
Author: hategan
Date: 2007-08-23 17:48:54 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
toString()
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java 2007-08-23 23:31:40 UTC (rev 1718)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java 2007-08-24 00:48:54 UTC (rev 1719)
@@ -38,4 +38,8 @@
public void setProvider(String provider) {
this.provider = provider;
}
+
+ public String toString() {
+ return type + ":" + provider;
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 23:31:42
|
Revision: 1718
http://cogkit.svn.sourceforge.net/cogkit/?rev=1718&view=rev
Author: hategan
Date: 2007-08-23 16:31:40 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
always LC
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java 2007-08-23 21:10:52 UTC (rev 1717)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java 2007-08-23 23:31:40 UTC (rev 1718)
@@ -65,6 +65,7 @@
*/
public static List getProviders(String type) {
loadProviderProperties();
+ type = type.toLowerCase();
List l = new LinkedList();
Iterator i = providerProperties.entrySet().iterator();
while (i.hasNext()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 21:10:54
|
Revision: 1717
http://cogkit.svn.sourceforge.net/cogkit/?rev=1717&view=rev
Author: hategan
Date: 2007-08-23 14:10:52 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
updated changes
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/CHANGES.txt
Modified: trunk/current/src/cog/modules/karajan/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-08-23 21:10:33 UTC (rev 1716)
+++ trunk/current/src/cog/modules/karajan/CHANGES.txt 2007-08-23 21:10:52 UTC (rev 1717)
@@ -1,3 +1,8 @@
+(08/23/2007)
+
+*** Added task:availableHandlers(*type). In case people don't
+ have to manually add handlers.
+
(08/22/2007)
*** failOnJobError=false would not make task:execute() return
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 21:10:34
|
Revision: 1716
http://cogkit.svn.sourceforge.net/cogkit/?rev=1716&view=rev
Author: hategan
Date: 2007-08-23 14:10:33 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
added availableHandlers()
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/resources/task.xml
Modified: trunk/current/src/cog/modules/karajan/resources/task.xml
===================================================================
--- trunk/current/src/cog/modules/karajan/resources/task.xml 2007-08-23 21:09:49 UTC (rev 1715)
+++ trunk/current/src/cog/modules/karajan/resources/task.xml 2007-08-23 21:10:33 UTC (rev 1716)
@@ -2,6 +2,7 @@
<cache>
<namespace prefix="task">
<export name="handler"><elementDef className="org.globus.cog.karajan.workflow.nodes.grid.TaskHandlerNode"/></export>
+ <export name="availableHandlers"><elementDef className="org.globus.cog.karajan.workflow.nodes.grid.AvailableTaskHandlers"/></export>
<export name="scheduler"><elementDef className="org.globus.cog.karajan.workflow.nodes.grid.SchedulerNode"/></export>
<export name="securityContext"><elementDef className="org.globus.cog.karajan.workflow.nodes.grid.SecurityContextNode"/></export>
<export name="resources"><elementDef className="org.globus.cog.karajan.workflow.nodes.grid.GridNode"/></export>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 21:09:53
|
Revision: 1715
http://cogkit.svn.sourceforge.net/cogkit/?rev=1715&view=rev
Author: hategan
Date: 2007-08-23 14:09:49 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
removed some code duplication; added availableHandlers()
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java
Added Paths:
-----------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java
Added: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java (rev 0)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/AvailableTaskHandlers.java 2007-08-23 21:09:49 UTC (rev 1715)
@@ -0,0 +1,51 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Aug 23, 2007
+ */
+package org.globus.cog.karajan.workflow.nodes.grid;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.globus.cog.abstraction.impl.common.AbstractionProperties;
+import org.globus.cog.karajan.arguments.Arg;
+import org.globus.cog.karajan.stack.VariableStack;
+import org.globus.cog.karajan.util.TaskHandlerWrapper;
+import org.globus.cog.karajan.util.TypeUtil;
+import org.globus.cog.karajan.workflow.ExecutionException;
+import org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction;
+
+public class AvailableTaskHandlers extends AbstractFunction {
+
+ public static final Arg A_TYPE = new Arg.Optional("type");
+
+ public Object function(VariableStack stack) throws ExecutionException {
+ List providers;
+ if (A_TYPE.isPresent(stack)) {
+ getHandlers(stack, TypeUtil.toString(A_TYPE.getValue(stack)));
+ }
+ else {
+ getHandlers(stack, "execution");
+ getHandlers(stack, "file");
+ getHandlers(stack, "file-transfer");
+ }
+ return null;
+ }
+
+ protected void getHandlers(VariableStack stack, String type) throws ExecutionException {
+ String atype = TaskHandlerNode.karajanToAbstractionType(type);
+ int itype = TaskHandlerNode.abstractionToHandlerType(atype);
+
+ List providers = AbstractionProperties.getProviders(atype);
+ Iterator i = providers.iterator();
+ while (i.hasNext()) {
+ TaskHandlerNode.HANDLERS_CHANNEL.ret(stack, new TaskHandlerWrapper((String) i.next(),
+ itype));
+ }
+ }
+}
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java 2007-08-23 21:08:23 UTC (rev 1714)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/ServiceNode.java 2007-08-23 21:09:49 UTC (rev 1715)
@@ -14,6 +14,7 @@
import org.globus.cog.abstraction.interfaces.ExecutionService;
import org.globus.cog.abstraction.interfaces.SecurityContext;
import org.globus.cog.abstraction.interfaces.Service;
+import org.globus.cog.abstraction.interfaces.TaskHandler;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableNotFoundException;
import org.globus.cog.karajan.stack.VariableStack;
@@ -40,23 +41,14 @@
public Object function(VariableStack stack) throws ExecutionException {
Service service = null;
String type = TypeUtil.toString(A_TYPE.getValue(stack));
- int itype = 0;
- if (type.equals("execution") || type.equals("job-submission")) {
- itype = Service.JOB_SUBMISSION;
+ int itype = TaskHandlerNode.karajanToHandlerType(type);
+ if (itype == TaskHandler.EXECUTION) {
+ itype = Service.EXECUTION;
service = new ExecutionServiceImpl();
if (A_JOB_MANAGER.isPresent(stack)) {
((ExecutionService) service).setJobManager(TypeUtil.toString(A_JOB_MANAGER.getValue(stack)));
}
}
- else if (type.equals("file-transfer")) {
- itype = Service.FILE_TRANSFER;
- }
- else if (type.equals("file-operation") || type.equals("file")) {
- itype = Service.FILE_OPERATION;
- }
- else {
- throw new ExecutionException("Invalid service type: " + type);
- }
if (service == null) {
service = new ServiceImpl();
@@ -75,7 +67,9 @@
sc = (SecurityContext) stack.getVar(scName);
}
catch (VariableNotFoundException e) {
- logger.debug("No default security context defined for provider " + provider);
+ if (logger.isDebugEnabled()) {
+ logger.debug("No default security context defined for provider " + provider);
+ }
if (sc == null) {
try {
sc = AbstractionFactory.newSecurityContext(provider);
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java 2007-08-23 21:08:23 UTC (rev 1714)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/grid/TaskHandlerNode.java 2007-08-23 21:09:49 UTC (rev 1715)
@@ -6,6 +6,10 @@
package org.globus.cog.karajan.workflow.nodes.grid;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.globus.cog.abstraction.impl.common.AbstractionProperties;
import org.globus.cog.abstraction.interfaces.TaskHandler;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
@@ -15,34 +19,64 @@
import org.globus.cog.karajan.workflow.nodes.functions.AbstractFunction;
public class TaskHandlerNode extends AbstractFunction {
+
+ private static final Map ptypes, wtypes;
+
+ static {
+ ptypes = new HashMap();
+ ptypes.put("execution", AbstractionProperties.TYPE_EXECUTION_TASK_HANDLER);
+ ptypes.put("job-submission", AbstractionProperties.TYPE_EXECUTION_TASK_HANDLER);
+ ptypes.put("file-transfer", AbstractionProperties.TYPE_FILE_TRANSFER_TASK_HANDLER);
+ ptypes.put("file", AbstractionProperties.TYPE_FILE_OPERATION_TASK_HANDLER);
+ ptypes.put("file-operation", AbstractionProperties.TYPE_FILE_OPERATION_TASK_HANDLER);
+
+ wtypes = new HashMap();
+ wtypes.put(AbstractionProperties.TYPE_EXECUTION_TASK_HANDLER, new Integer(
+ TaskHandler.EXECUTION));
+ wtypes.put(AbstractionProperties.TYPE_FILE_TRANSFER_TASK_HANDLER, new Integer(
+ TaskHandler.FILE_TRANSFER));
+ wtypes.put(AbstractionProperties.TYPE_FILE_OPERATION_TASK_HANDLER, new Integer(
+ TaskHandler.FILE_OPERATION));
+ }
+
+ public static String karajanToAbstractionType(String type) {
+ String atype = (String) ptypes.get(type);
+ if (atype == null) {
+ throw new IllegalArgumentException("Unsupported type: " + type
+ + ". Supported types are: \"execution\", \"file\", and \"file-transfer\"");
+ }
+ else {
+ return atype;
+ }
+ }
+
+ public static int abstractionToHandlerType(String type) {
+ try {
+ return ((Integer) wtypes.get(type)).intValue();
+ }
+ catch (NullPointerException e) {
+ throw new IllegalArgumentException("Invalid abstraction handler type: " + type);
+ }
+ }
+
+ public static int karajanToHandlerType(String type) {
+ return abstractionToHandlerType(karajanToAbstractionType(type));
+ }
+
public static final Arg A_TYPE = new Arg.Positional("type");
public static final Arg A_PROVIDER = new Arg.Positional("provider");
public static final Arg.Channel HANDLERS_CHANNEL = new Arg.Channel("handlers");
static {
- setArguments(TaskHandlerNode.class,
- new Arg[] { A_TYPE, A_PROVIDER });
+ setArguments(TaskHandlerNode.class, new Arg[] { A_TYPE, A_PROVIDER });
}
public Object function(VariableStack stack) throws ExecutionException {
TaskHandlerWrapper th = new TaskHandlerWrapper();
- String type = TypeUtil.toString(A_TYPE.getValue(stack));
+ String type = TypeUtil.toString(A_TYPE.getValue(stack)).toLowerCase();
String provider = TypeUtil.toString(A_PROVIDER.getValue(stack));
-
- if (type.equals("execution") || type.equals("job-submission")) {
- th.setType(TaskHandler.EXECUTION);
- }
- else if (type.equals("file") || type.equals("file-operation")) {
- th.setType(TaskHandler.FILE_OPERATION);
- }
- else if (type.equals("file-transfer")) {
- th.setType(TaskHandler.FILE_TRANSFER);
- }
- else {
- throw new ExecutionException("Unsupported type: " + type
- + ". Must be either 'execution' or 'file'");
- }
-
+
+ th.setType(karajanToHandlerType(type));
th.setProvider(provider);
HANDLERS_CHANNEL.ret(stack, th);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 21:08:30
|
Revision: 1714
http://cogkit.svn.sourceforge.net/cogkit/?rev=1714&view=rev
Author: hategan
Date: 2007-08-23 14:08:23 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
a more reasonable constructor
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java 2007-08-23 20:54:14 UTC (rev 1713)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/util/TaskHandlerWrapper.java 2007-08-23 21:08:23 UTC (rev 1714)
@@ -17,6 +17,11 @@
public TaskHandlerWrapper() {
}
+
+ public TaskHandlerWrapper(String provider, int type) {
+ this.provider = provider;
+ this.type = type;
+ }
public int getType() {
return type;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 20:54:18
|
Revision: 1713
http://cogkit.svn.sourceforge.net/cogkit/?rev=1713&view=rev
Author: hategan
Date: 2007-08-23 13:54:14 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
query for specific types of handlers
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/CHANGES.txt
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionFactory.java
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/Service.java
Modified: trunk/current/src/cog/modules/abstraction-common/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/CHANGES.txt 2007-08-23 18:59:36 UTC (rev 1712)
+++ trunk/current/src/cog/modules/abstraction-common/CHANGES.txt 2007-08-23 20:54:14 UTC (rev 1713)
@@ -1,3 +1,10 @@
+(08/23/2007)
+
+*** Added ability to query for a list of providers supporting
+ a certain type of task handler.
+
+*** Deprecated Service.JOB_SUBMISSION. Use Service.EXECUTION.
+
(08/20/2007)
*** Made the way redirection works more consistent. As it was, a flag
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionFactory.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionFactory.java 2007-08-23 18:59:36 UTC (rev 1712)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionFactory.java 2007-08-23 20:54:14 UTC (rev 1713)
@@ -55,7 +55,8 @@
public static TaskHandler newExecutionTaskHandler(String provider)
throws InvalidProviderException, ProviderMethodException {
- return newTaskHandler(provider, "executionTaskHandler");
+ return newTaskHandler(provider,
+ AbstractionProperties.TYPE_EXECUTION_TASK_HANDLER);
}
public static TaskHandler newFileTransferTaskHandler()
@@ -65,7 +66,8 @@
public static TaskHandler newFileTransferTaskHandler(String provider)
throws InvalidProviderException, ProviderMethodException {
- return newTaskHandler(provider, "fileTransferTaskHandler");
+ return newTaskHandler(provider,
+ AbstractionProperties.TYPE_FILE_TRANSFER_TASK_HANDLER);
}
public static TaskHandler newFileOperationTaskHandler()
@@ -75,7 +77,8 @@
public static TaskHandler newFileOperationTaskHandler(String provider)
throws InvalidProviderException, ProviderMethodException {
- return newTaskHandler(provider, "fileOperationTaskHandler");
+ return newTaskHandler(provider,
+ AbstractionProperties.TYPE_FILE_OPERATION_TASK_HANDLER);
}
public static TaskHandler newTaskHandler(String provider, String type)
@@ -87,7 +90,8 @@
if (sandbox) {
return new SandboxingTaskHandler(getSandbox(provider),
(TaskHandler) newObject(provider, type));
- } else {
+ }
+ else {
return (TaskHandler) newObject(provider, type);
}
}
@@ -104,12 +108,14 @@
public static FileResource newFileResource(String provider)
throws InvalidProviderException, ProviderMethodException {
- return (FileResource) newObject(provider, "fileResource");
+ return (FileResource) newObject(provider,
+ AbstractionProperties.TYPE_FILE_RESOURCE);
}
public static SecurityContext newSecurityContext(String provider)
throws InvalidProviderException, ProviderMethodException {
- return (SecurityContext) newObject(provider, "securityContext");
+ return (SecurityContext) newObject(provider,
+ AbstractionProperties.TYPE_SECURITY_CONTEXT);
}
public static boolean hasObject(String provider, String role) {
@@ -118,7 +124,8 @@
.getProperties(provider);
String className = providerProps.getProperty(role);
return className != null;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
return false;
}
}
@@ -136,11 +143,11 @@
}
try {
return newInstance(provider, className, sandbox);
- } catch (InvalidClassException e) {
+ }
+ catch (InvalidClassException e) {
throw new ProviderMethodException("Provider " + provider
+ " does not provide a valid " + role, e);
}
-
}
protected static Object newInstance(String provider, String className,
@@ -154,15 +161,18 @@
Sandbox sandbox = getSandbox(provider);
try {
return sandbox.newObject(className, null, null);
- } catch (Throwable e) {
+ }
+ catch (Throwable e) {
throw new InvalidClassException("Cannot instantiate "
+ className, e);
}
- } else {
+ }
+ else {
ClassLoader cl = getLoader(provider);
try {
return cl.loadClass(className).newInstance();
- } catch (Exception e) {
+ }
+ catch (Exception e) {
throw new InvalidClassException(e);
}
}
@@ -182,15 +192,18 @@
.indexOf('!'));
surl = surl.substring(0, surl.lastIndexOf('/'));
path = surl;
- } catch (Exception e) {
}
+ catch (Exception e) {
+ }
if (path == null) {
throw new InvalidProviderException(INVALID_CLASSPATH_ERROR);
- } else {
+ }
+ else {
throw new InvalidProviderException(INVALID_CLASSPATH_ERROR
+ "\nOffending directory: " + path);
}
- } else {
+ }
+ else {
trapChecked = true;
}
}
@@ -205,7 +218,8 @@
if (bootClass != null) {
try {
sandbox.boot(bootClass);
- } catch (Throwable e) {
+ }
+ catch (Throwable e) {
logger.error("Cannot boot sandbox for " + provider
+ ". Some things may not work as expected.", e);
}
@@ -239,7 +253,8 @@
if (doBoot) {
AbstractionClassLoader.initializeLoader(loader, props, boot,
system);
- } else {
+ }
+ else {
AbstractionClassLoader.initializeLoader(loader, props, null,
system);
}
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java 2007-08-23 18:59:36 UTC (rev 1712)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/AbstractionProperties.java 2007-08-23 20:54:14 UTC (rev 1713)
@@ -27,291 +27,335 @@
public class AbstractionProperties extends java.util.Properties {
- private static Logger logger = Logger.getLogger(AbstractionProperties.class);
- public static final String PROVIDER_PROPERTY_FILE = "cog-provider.properties";
- public static final String CLASS_LOADER_NAME = "classloader.name";
- public static final String CLASS_LOADER_PROPERTIES = "classloader.properties";
- public static final String CLASS_LOADER_BOOTCLASS = "classloader.boot";
- public static final String CLASS_LOADER_USESYSTEM = "classloader.usesystem";
- public static final String SANDBOX = "sandbox";
- public static final String SANDBOX_BOOTCLASS = "sandbox.boot";
- public static final String ALIAS = "alias";
+ private static Logger logger = Logger
+ .getLogger(AbstractionProperties.class);
+ public static final String PROVIDER_PROPERTY_FILE = "cog-provider.properties";
+ public static final String CLASS_LOADER_NAME = "classloader.name";
+ public static final String CLASS_LOADER_PROPERTIES = "classloader.properties";
+ public static final String CLASS_LOADER_BOOTCLASS = "classloader.boot";
+ public static final String CLASS_LOADER_USESYSTEM = "classloader.usesystem";
+ public static final String SANDBOX = "sandbox";
+ public static final String SANDBOX_BOOTCLASS = "sandbox.boot";
+ public static final String ALIAS = "alias";
- private static Map providerProperties;
+ public static final String TYPE_FILE_RESOURCE = "fileResource";
+ public static final String TYPE_EXECUTION_TASK_HANDLER = "executionTaskHandler";
+ public static final String TYPE_FILE_TRANSFER_TASK_HANDLER = "fileTransferTaskHandler";
+ public static final String TYPE_FILE_OPERATION_TASK_HANDLER = "fileOperationTaskHandler";
+ public static final String TYPE_SECURITY_CONTEXT = "securityContext";
- private static Map aliases;
+ private static Map providerProperties;
- public static List getProviders() {
- loadProviderProperties();
- return new LinkedList(providerProperties.keySet());
- }
-
- public static String getAliasesAsString() {
- if (aliases == null || aliases.size() == 0) {
- return "none";
- }
- else {
- Map m = new Hashtable();
- Iterator i = aliases.entrySet().iterator();
- while(i.hasNext()) {
- Map.Entry e = (Map.Entry) i.next();
- if (!m.containsKey(e.getValue())) {
- m.put(e.getValue(), new LinkedList());
- }
- ((List) m.get(e.getValue())).add(e.getKey());
- }
- StringBuffer sb = new StringBuffer();
- i = m.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry e = (Map.Entry) i.next();
- sb.append(e.getKey());
- sb.append(" <-> ");
- Iterator j = ((List) e.getValue()).iterator();
- while (j.hasNext()) {
- sb.append(j.next());
- if (j.hasNext()) {
- sb.append(", ");
- }
- else {
- sb.append("; ");
- }
- }
- }
- return sb.toString();
- }
- }
+ private static Map aliases;
- public static AbstractionProperties getProperties(String provider)
- throws InvalidProviderException {
- loadProviderProperties();
- provider = provider.toLowerCase();
- if (aliases.containsKey(provider)) {
- provider = (String) aliases.get(provider);
- }
- if (providerProperties.containsKey(provider)) {
- return (AbstractionProperties) providerProperties.get(provider);
- }
- else {
- logger.info("No properties for provider " + provider + ". Using empty properties");
- if (logger.isDebugEnabled()) {
- logJars();
- }
- throw new InvalidProviderException("No '" + provider
- + "' provider or alias found. Available providers: " + getProviders()
- + ". Aliases: " + getAliasesAsString());
- }
- }
+ /**
+ * Returns a list with the names of all the providers known in this JVM
+ * instance.
+ */
+ public static List getProviders() {
+ loadProviderProperties();
+ return new LinkedList(providerProperties.keySet());
+ }
- private static void logJars() {
- URL[] urls = ((URLClassLoader) AbstractionProperties.class.getClassLoader()).getURLs();
- logger.debug("================ Jars found on classpath =================");
- for (int i = 0; i < urls.length; i++) {
- logger.debug(urls[i]);
- }
- logger.debug("==========================================================");
- }
+ /**
+ * Returns a list with the names of all providers known to have the
+ * specified property. For example, you can use
+ * <code>getProviders({@link TYPE_EXECUTION_TASK_HANDLER})</code> to
+ * retrieve a list of a all providers that have an excution task handler.
+ */
+ public static List getProviders(String type) {
+ loadProviderProperties();
+ List l = new LinkedList();
+ Iterator i = providerProperties.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ String name = (String) e.getKey();
+ AbstractionProperties props = (AbstractionProperties) e.getValue();
+ if (props.containsKey(type)) {
+ l.add(name);
+ }
+ }
+ return l;
+ }
- protected synchronized static void loadProviderProperties() {
- if (providerProperties != null) {
- return;
- }
- try {
- providerProperties = new Hashtable();
- aliases = new Hashtable();
- Enumeration e = AbstractionFactory.class.getClassLoader().getResources(
- PROVIDER_PROPERTY_FILE);
- while (e.hasMoreElements()) {
- try {
- loadProviderProperties(((URL) e.nextElement()).openStream());
- }
- catch (Exception ee) {
- logger.debug("Error reading from provider properties", ee);
- }
- }
- }
- catch (Exception e) {
- logger.warn("No " + PROVIDER_PROPERTY_FILE
- + " resource found. You should have at least one provider.");
- }
- }
+ public static String getAliasesAsString() {
+ if (aliases == null || aliases.size() == 0) {
+ return "none";
+ }
+ else {
+ Map m = new Hashtable();
+ Iterator i = aliases.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ if (!m.containsKey(e.getValue())) {
+ m.put(e.getValue(), new LinkedList());
+ }
+ ((List) m.get(e.getValue())).add(e.getKey());
+ }
+ StringBuffer sb = new StringBuffer();
+ i = m.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ sb.append(e.getKey());
+ sb.append(" <-> ");
+ Iterator j = ((List) e.getValue()).iterator();
+ while (j.hasNext()) {
+ sb.append(j.next());
+ if (j.hasNext()) {
+ sb.append(", ");
+ }
+ else {
+ sb.append("; ");
+ }
+ }
+ }
+ return sb.toString();
+ }
+ }
- private static void loadProviderProperties(InputStream is) {
- Properties props = new Properties();
- try {
- props.load(is);
- AbstractionProperties map = null;
- AbstractionProperties common = new AbstractionProperties();
- String classLoader = null;
- String classLoaderProps = null;
- String classLoaderBoot = null;
- boolean nameFound = false;
- Iterator i = props.iterator();
- while (i.hasNext()) {
- Property prop = (Property) i.next();
+ public static AbstractionProperties getProperties(String provider)
+ throws InvalidProviderException {
+ loadProviderProperties();
+ provider = provider.toLowerCase();
+ if (aliases.containsKey(provider)) {
+ provider = (String) aliases.get(provider);
+ }
+ if (providerProperties.containsKey(provider)) {
+ return (AbstractionProperties) providerProperties.get(provider);
+ }
+ else {
+ logger.info("No properties for provider " + provider
+ + ". Using empty properties");
+ if (logger.isDebugEnabled()) {
+ logJars();
+ }
+ throw new InvalidProviderException("No '" + provider
+ + "' provider or alias found. Available providers: "
+ + getProviders() + ". Aliases: " + getAliasesAsString());
+ }
+ }
- if (prop.name.equalsIgnoreCase("provider")) {
- map = new AbstractionProperties();
- map.putAll(common);
- providerProperties.put(prop.value.trim().toLowerCase(), map);
- nameFound = true;
- }
- else if (prop.name.equalsIgnoreCase("alias")) {
- String[] alias = prop.value.split(":");
- if (alias.length != 2) {
- logger.warn("Invalid alias line: " + prop.name + "=" + prop.value);
- }
- else {
- aliases.put(alias[0], alias[1]);
- }
- }
- else {
- if (map == null) {
- common.put(prop.name.trim().toLowerCase(), prop.value.trim());
- }
- else {
- map.put(prop.name.trim().toLowerCase(), prop.value.trim());
- }
- }
- }
- if (!nameFound) {
- logger.warn("Provider name missing from provider properties file");
- }
- }
- catch (Exception e) {
- logger.warn("Could not load properties", e);
- }
- }
+ private static void logJars() {
+ URL[] urls = ((URLClassLoader) AbstractionProperties.class
+ .getClassLoader()).getURLs();
+ logger
+ .debug("================ Jars found on classpath =================");
+ for (int i = 0; i < urls.length; i++) {
+ logger.debug(urls[i]);
+ }
+ logger
+ .debug("==========================================================");
+ }
- public AbstractionProperties() {
- }
+ protected synchronized static void loadProviderProperties() {
+ if (providerProperties != null) {
+ return;
+ }
+ try {
+ providerProperties = new Hashtable();
+ aliases = new Hashtable();
+ Enumeration e = AbstractionFactory.class.getClassLoader()
+ .getResources(PROVIDER_PROPERTY_FILE);
+ while (e.hasMoreElements()) {
+ try {
+ loadProviderProperties(((URL) e.nextElement()).openStream());
+ }
+ catch (Exception ee) {
+ logger.debug("Error reading from provider properties", ee);
+ }
+ }
+ }
+ catch (Exception e) {
+ logger
+ .warn("No "
+ + PROVIDER_PROPERTY_FILE
+ + " resource found. You should have at least one provider.");
+ }
+ }
- public AbstractionProperties(String file) throws IOException {
- load(file);
- }
+ private static void loadProviderProperties(InputStream is) {
+ Properties props = new Properties();
+ try {
+ props.load(is);
+ AbstractionProperties map = null;
+ AbstractionProperties common = new AbstractionProperties();
+ String classLoader = null;
+ String classLoaderProps = null;
+ String classLoaderBoot = null;
+ boolean nameFound = false;
+ Iterator i = props.iterator();
+ while (i.hasNext()) {
+ Property prop = (Property) i.next();
- public void load(String file) throws IOException {
- FileInputStream in = null;
- try {
- File f = new File(file);
- if (f.exists()) {
- in = new FileInputStream(f);
- load(in);
- }
- }
- catch (IOException e) {
- logger.warn("Could not load properties from file: " + file);
- if (in != null) {
- try {
- in.close();
- }
- catch (Exception ee) {
- }
- }
- throw e;
- }
- }
+ if (prop.name.equalsIgnoreCase("provider")) {
+ map = new AbstractionProperties();
+ map.putAll(common);
+ providerProperties
+ .put(prop.value.trim().toLowerCase(), map);
+ nameFound = true;
+ }
+ else if (prop.name.equalsIgnoreCase("alias")) {
+ String[] alias = prop.value.split(":");
+ if (alias.length != 2) {
+ logger.warn("Invalid alias line: " + prop.name + "="
+ + prop.value);
+ }
+ else {
+ aliases.put(alias[0], alias[1]);
+ }
+ }
+ else {
+ if (map == null) {
+ common.put(prop.name.trim().toLowerCase(), prop.value
+ .trim());
+ }
+ else {
+ map.put(prop.name.trim().toLowerCase(), prop.value
+ .trim());
+ }
+ }
+ }
+ if (!nameFound) {
+ logger
+ .warn("Provider name missing from provider properties file");
+ }
+ }
+ catch (Exception e) {
+ logger.warn("Could not load properties", e);
+ }
+ }
- public String getProperty(String key) {
- return (String) get(key.toLowerCase());
- }
+ public AbstractionProperties() {
+ }
- public boolean getBooleanProperty(String key) {
- return Boolean.valueOf(getProperty(key)).booleanValue();
- }
+ public AbstractionProperties(String file) throws IOException {
+ load(file);
+ }
- public boolean getBooleanProperty(String name, boolean defaultValue) {
- try {
- return getBooleanProperty(name);
- }
- catch (Exception e) {
- return defaultValue;
- }
- }
+ public void load(String file) throws IOException {
+ FileInputStream in = null;
+ try {
+ File f = new File(file);
+ if (f.exists()) {
+ in = new FileInputStream(f);
+ load(in);
+ }
+ }
+ catch (IOException e) {
+ logger.warn("Could not load properties from file: " + file);
+ if (in != null) {
+ try {
+ in.close();
+ }
+ catch (Exception ee) {
+ }
+ }
+ throw e;
+ }
+ }
- public void put(String key, String value) {
- if (value == null) {
- return;
- }
- super.put(key.toLowerCase(), value);
- }
+ public String getProperty(String key) {
+ return (String) get(key.toLowerCase());
+ }
- public void load(InputStream is) throws IOException {
- Properties props = new Properties();
- props.load(is);
- Iterator i = props.iterator();
- while (i.hasNext()) {
- Property prop = (Property) i.next();
- put(prop.name, prop.value);
- }
- }
+ public boolean getBooleanProperty(String key) {
+ return Boolean.valueOf(getProperty(key)).booleanValue();
+ }
- public static class Properties extends LinkedList {
+ public boolean getBooleanProperty(String name, boolean defaultValue) {
+ try {
+ return getBooleanProperty(name);
+ }
+ catch (Exception e) {
+ return defaultValue;
+ }
+ }
- public void load(InputStream is) throws IOException {
- BufferedReader isr = new BufferedReader(new InputStreamReader(is));
- String line = isr.readLine();
- while (line != null) {
- if (!line.trim().equals("") && !line.startsWith("#")) {
- add(new Property(line));
- }
- line = isr.readLine();
- }
- }
- }
+ public void put(String key, String value) {
+ if (value == null) {
+ return;
+ }
+ super.put(key.toLowerCase(), value);
+ }
- public static class Property {
+ public void load(InputStream is) throws IOException {
+ Properties props = new Properties();
+ props.load(is);
+ Iterator i = props.iterator();
+ while (i.hasNext()) {
+ Property prop = (Property) i.next();
+ put(prop.name, prop.value);
+ }
+ }
- public String name;
- public String value;
+ public static class Properties extends LinkedList {
- public Property(String line) {
- String[] prop = splitProperty(line);
- name = prop[0];
- value = prop[1];
- }
+ public void load(InputStream is) throws IOException {
+ BufferedReader isr = new BufferedReader(new InputStreamReader(is));
+ String line = isr.readLine();
+ while (line != null) {
+ if (!line.trim().equals("") && !line.startsWith("#")) {
+ add(new Property(line));
+ }
+ line = isr.readLine();
+ }
+ }
+ }
- public static String[] splitProperty(String property) {
- StringTokenizer st = new StringTokenizer(property, "=");
- String name = null;
- String value = null;
- if (st.hasMoreTokens()) {
- name = st.nextToken();
- }
- if (st.hasMoreTokens()) {
- value = st.nextToken();
- while (st.hasMoreTokens()) {
- value = value + "=" + st.nextToken();
- }
- }
- if (name == null) {
- return new String[] { "", "" };
- }
- if (value == null) {
- value = "";
- }
- value = replaceProperties(value);
- return new String[] { name.trim().toLowerCase(), value.trim() };
- }
+ public static class Property {
- protected static String replaceProperties(String value) {
- if (value == null) {
- return null;
- }
- int bi = -1;
- do {
- bi = value.indexOf("${", bi + 1);
- if (bi != -1) {
- int ei = value.indexOf("}", bi);
- if (ei > bi) {
- String name = value.substring(bi + 2, ei);
- String prop = System.getProperty(name, "${" + name + "}");
- value = value.substring(0, bi) + prop + value.substring(ei + 1);
- continue;
- }
- }
- }
- while (bi >= 0);
- return value;
- }
- }
+ public String name;
+ public String value;
+
+ public Property(String line) {
+ String[] prop = splitProperty(line);
+ name = prop[0];
+ value = prop[1];
+ }
+
+ public static String[] splitProperty(String property) {
+ StringTokenizer st = new StringTokenizer(property, "=");
+ String name = null;
+ String value = null;
+ if (st.hasMoreTokens()) {
+ name = st.nextToken();
+ }
+ if (st.hasMoreTokens()) {
+ value = st.nextToken();
+ while (st.hasMoreTokens()) {
+ value = value + "=" + st.nextToken();
+ }
+ }
+ if (name == null) {
+ return new String[] { "", "" };
+ }
+ if (value == null) {
+ value = "";
+ }
+ value = replaceProperties(value);
+ return new String[] { name.trim().toLowerCase(), value.trim() };
+ }
+
+ protected static String replaceProperties(String value) {
+ if (value == null) {
+ return null;
+ }
+ int bi = -1;
+ do {
+ bi = value.indexOf("${", bi + 1);
+ if (bi != -1) {
+ int ei = value.indexOf("}", bi);
+ if (ei > bi) {
+ String name = value.substring(bi + 2, ei);
+ String prop = System.getProperty(name, "${" + name
+ + "}");
+ value = value.substring(0, bi) + prop
+ + value.substring(ei + 1);
+ continue;
+ }
+ }
+ } while (bi >= 0);
+ return value;
+ }
+ }
}
\ No newline at end of file
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/Service.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/Service.java 2007-08-23 18:59:36 UTC (rev 1712)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/interfaces/Service.java 2007-08-23 20:54:14 UTC (rev 1713)
@@ -15,9 +15,16 @@
*/
public interface Service {
/**
- * Represents a job submission service
+ * Represents a job submission service.
+ *
+ * @deprecated For consistency use {@link EXECUTION}
*/
public static final int JOB_SUBMISSION = 1;
+
+ /**
+ * Represents an execution service.
+ */
+ public static final int EXECUTION = 1;
/**
* Represents a file transfer service
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 18:59:37
|
Revision: 1712
http://cogkit.svn.sourceforge.net/cogkit/?rev=1712&view=rev
Author: hategan
Date: 2007-08-23 11:59:36 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
reformatted
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java 2007-08-23 18:56:23 UTC (rev 1711)
+++ trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java 2007-08-23 18:59:36 UTC (rev 1712)
@@ -36,7 +36,8 @@
if (res != null) {
try {
properties.load(res.openStream());
- } catch (IOException e) {
+ }
+ catch (IOException e) {
logger.warn("Failed to load dcache provider properties",
e);
}
@@ -85,9 +86,11 @@
+ "\". dccp failed with an exit code of " + exitcode
+ ": " + stderr);
}
- } catch (FileResourceException e) {
+ }
+ catch (FileResourceException e) {
throw e;
- } catch (Exception e) {
+ }
+ catch (Exception e) {
throw new FileResourceException(e);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 18:56:24
|
Revision: 1711
http://cogkit.svn.sourceforge.net/cogkit/?rev=1711&view=rev
Author: hategan
Date: 2007-08-23 11:56:23 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
and its first bug fixes
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java 2007-08-23 18:52:45 UTC (rev 1710)
+++ trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java 2007-08-23 18:56:23 UTC (rev 1711)
@@ -16,92 +16,98 @@
* enables access to local file system through the file resource interface
* Supports absolute and relative path names
*/
-public class FileResourceImpl extends org.globus.cog.abstraction.impl.file.local.FileResourceImpl {
- public static final Logger logger = Logger.getLogger(FileResourceImpl.class);
+public class FileResourceImpl extends
+ org.globus.cog.abstraction.impl.file.local.FileResourceImpl {
+ public static final Logger logger = Logger
+ .getLogger(FileResourceImpl.class);
- public static final String PROPERTIES = "provider-dcache.properties";
- public static final String DCCP = "dccp";
- public static final String OPTIONS = "dccp.options";
- private static Properties properties;
+ public static final String PROPERTIES = "provider-dcache.properties";
+ public static final String DCCP = "dccp";
+ public static final String OPTIONS = "dccp.options";
+ private static Properties properties;
- protected synchronized static Properties getProperties() {
- if (properties == null) {
- properties = new Properties();
- properties.put(DCCP, "dccp");
- properties.put(OPTIONS, "-d 1");
- URL res = FileResourceImpl.class.getClassLoader().getResource(PROPERTIES);
- if (res != null) {
- try {
- properties.load(res.openStream());
- }
- catch (IOException e) {
- logger.warn("Failed to load dcache provider properties", e);
- }
- }
- }
- return properties;
- }
+ protected synchronized static Properties getProperties() {
+ if (properties == null) {
+ properties = new Properties();
+ properties.put(DCCP, "dccp");
+ properties.put(OPTIONS, "-d 1");
+ URL res = FileResourceImpl.class.getClassLoader().getResource(
+ PROPERTIES);
+ if (res != null) {
+ try {
+ properties.load(res.openStream());
+ } catch (IOException e) {
+ logger.warn("Failed to load dcache provider properties",
+ e);
+ }
+ }
+ }
+ return properties;
+ }
- private static String[] dccpCmd;
+ private static String[] dccpCmd;
- protected synchronized static String[] getDCCPCmd() {
- if (dccpCmd == null) {
- StringTokenizer st = new StringTokenizer(getProperties().getProperty(OPTIONS));
- dccpCmd = new String[st.countTokens() + 1];
- dccpCmd[0] = getProperties().getProperty(DCCP);
- for (int i = 0; i < dccpCmd.length; i++) {
- dccpCmd[i + 1] = st.nextToken();
- }
- }
- return dccpCmd;
- }
+ protected synchronized static String[] getDCCPCmd() {
+ if (dccpCmd == null) {
+ StringTokenizer st = new StringTokenizer(getProperties()
+ .getProperty(OPTIONS));
+ dccpCmd = new String[st.countTokens() + 1];
+ dccpCmd[0] = getProperties().getProperty(DCCP);
+ for (int i = 0; i < dccpCmd.length; i++) {
+ dccpCmd[i + 1] = st.nextToken();
+ }
+ }
+ return dccpCmd;
+ }
- public FileResourceImpl() {
- this("dcache");
- }
+ public FileResourceImpl() {
+ this("dcache");
+ }
- public FileResourceImpl(String name) {
- super(name);
- }
+ public FileResourceImpl(String name) {
+ super(name);
+ }
- public void getFile(String remoteFileName, String localFileName, ProgressMonitor progressMonitor)
- throws FileResourceException {
- try {
- String[] opts = getDCCPCmd();
- String[] cmd = new String[opts.length + 2];
- System.arraycopy(opts, 0, cmd, 0, opts.length);
- cmd[cmd.length - 2] = resolve(remoteFileName).getAbsolutePath();
- cmd[cmd.length - 1] = resolve(localFileName).getAbsolutePath();
- Process p = Runtime.getRuntime().exec(cmd);
- consumeOutput(p);
- int exitcode = p.waitFor();
- if (exitcode != 0) {
- throw new FileResourceException("Failed to copy \"" + remoteFileName + "\" to \""
- + localFileName + "\". dccp failed with an exit code of " + exitcode);
- }
- }
- catch (FileResourceException e) {
- throw e;
- }
- catch (Exception e) {
- throw new FileResourceException(e);
- }
- }
+ public void getFile(String remoteFileName, String localFileName,
+ ProgressMonitor progressMonitor) throws FileResourceException {
+ try {
+ String[] opts = getDCCPCmd();
+ String[] cmd = new String[opts.length + 2];
+ System.arraycopy(opts, 0, cmd, 0, opts.length);
+ cmd[cmd.length - 2] = resolve(remoteFileName).getAbsolutePath();
+ cmd[cmd.length - 1] = resolve(localFileName).getAbsolutePath();
+ Process p = Runtime.getRuntime().exec(cmd);
+ String stderr = consumeOutput(p);
+ int exitcode = p.waitFor();
+ if (exitcode != 0) {
+ throw new FileResourceException("Failed to copy \""
+ + remoteFileName + "\" to \"" + localFileName
+ + "\". dccp failed with an exit code of " + exitcode
+ + ": " + stderr);
+ }
+ } catch (FileResourceException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new FileResourceException(e);
+ }
+ }
- private String consumeOutput(Process p) throws IOException {
- StringBuffer errstr = new StringBuffer();
- Reader out = new InputStreamReader(p.getInputStream());
- BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+ private String consumeOutput(Process p) throws IOException {
+ StringBuffer errstr = new StringBuffer();
+ Reader out = new InputStreamReader(p.getInputStream());
+ BufferedReader err = new BufferedReader(new InputStreamReader(p
+ .getErrorStream()));
- while (out.read() != -1) {
- // keep reading
- }
+ while (out.read() != -1) {
+ // keep reading
+ }
- String line = err.readLine();
- while (line != null) {
- errstr.append(line);
- errstr.append('\n');
- }
- return errstr.toString();
- }
+ String line = err.readLine();
+ while (line != null) {
+ errstr.append(line);
+ errstr.append('\n');
+ line = err.readLine();
+ }
+ return errstr.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-23 18:52:50
|
Revision: 1710
http://cogkit.svn.sourceforge.net/cogkit/?rev=1710&view=rev
Author: hategan
Date: 2007-08-23 11:52:45 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
added initial version of dcache provider
Added Paths:
-----------
trunk/current/src/cog/modules/provider-dcache/
trunk/current/src/cog/modules/provider-dcache/CHANGES.txt
trunk/current/src/cog/modules/provider-dcache/build.xml
trunk/current/src/cog/modules/provider-dcache/dependencies.xml
trunk/current/src/cog/modules/provider-dcache/etc/
trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.head
trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.tail
trunk/current/src/cog/modules/provider-dcache/etc/log4j.properties.module
trunk/current/src/cog/modules/provider-dcache/etc/provider-dcache.properties
trunk/current/src/cog/modules/provider-dcache/launchers.xml
trunk/current/src/cog/modules/provider-dcache/lib/
trunk/current/src/cog/modules/provider-dcache/meta/
trunk/current/src/cog/modules/provider-dcache/meta/description.txt
trunk/current/src/cog/modules/provider-dcache/project.properties
trunk/current/src/cog/modules/provider-dcache/resources/
trunk/current/src/cog/modules/provider-dcache/resources/cog-provider.properties
trunk/current/src/cog/modules/provider-dcache/src/
trunk/current/src/cog/modules/provider-dcache/src/org/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/TaskHandlerImpl.java
Added: trunk/current/src/cog/modules/provider-dcache/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/CHANGES.txt (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/CHANGES.txt 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,3 @@
+(08/23/07)
+
+*** Initial commit
\ No newline at end of file
Added: trunk/current/src/cog/modules/provider-dcache/build.xml
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/build.xml (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/build.xml 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,152 @@
+<project name="Java CoG Kit" default="dist" basedir=".">
+
+ <property file="project.properties"/>
+ <property name="cog.dir" value="${basedir}/../../"/>
+ <property name="main.buildfile" value="${cog.dir}/mbuild.xml"/>
+ <property name="dist.dir" value="${cog.dir}/modules/${module.name}/dist/${module.name}-${version}"/>
+ <property name="build.dir" value="${cog.dir}/modules/${module.name}/build"/>
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Help | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="help">
+ <echo>
+ Available targets:
+ help:
+ prints out this help message
+
+ dist:
+ creates a distribution directory of the
+ ${project} ${long.name}
+
+ jar:
+ creates a jar file for the ${project} ${long.name}
+ named ${jar.filename}
+
+ javadoc:
+ creates the documentation
+
+ clean:
+ removes the compiled classes
+
+ distclean:
+ deletes the distribution directory
+
+ all:
+ dist and javadoc
+
+ deploy.webstart:
+ deploys the module as a webstart application
+
+ dist.joint:
+ builds everything into one jar file. Should only
+ be used globally (from all)
+
+ fixeol:
+ change newlines to the unix standard
+ </echo>
+ </target>
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Dist | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="dist">
+ <ant antfile="${main.buildfile}" target="dist"/>
+ </target>
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Compile | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="compile">
+ <ant antfile="${main.buildfile}" target="compile"/>
+ </target>
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Clean | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="clean">
+ <ant antfile="${main.buildfile}" target="clean"/>
+ </target>
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Distclean | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="distclean">
+ <ant antfile="${main.buildfile}" target="distclean"/>
+ </target>
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Jar | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="jar">
+ <ant antfile="${main.buildfile}" target="jar"/>
+ </target>
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | Javadoc | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="javadoc">
+ <ant antfile="${main.buildfile}" target="javadoc"/>
+ </target>
+
+
+
+ <!-- _________________________________________________________________ -->
+ <!-- / \ -->
+ <!-- | PMD | -->
+ <!-- \_________________________________________________________________/ -->
+
+ <target name="pmd">
+ <ant antfile="${main.buildfile}" target="pmd"/>
+ </target>
+
+ <target name="deploy.webstart">
+ <ant antfile="${main.buildfile}" target="deploy.webstart"/>
+ </target>
+
+ <target name="replacelibs">
+ <ant antfile="${main.buildfile}" target="replacelibs"/>
+ </target>
+
+ <target name="webstart.launchers">
+ <ant antfile="${main.buildfile}" target="webstart.launchers"/>
+ </target>
+
+ <target name="dist.joint">
+ <ant antfile="${main.buildfile}" target="dist.all"/>
+ </target>
+
+ <target name="module.package">
+ <ant antfile="${main.buildfile}" target="module.package"/>
+ </target>
+
+ <!-- ================================================ -->
+ <!-- fixeol -->
+ <!-- ================================================ -->
+
+ <target name="fixeol">
+ <ant antfile="${main.buildfile}" target="fixeol"/>
+ </target>
+
+</project>
+
+
Added: trunk/current/src/cog/modules/provider-dcache/dependencies.xml
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/dependencies.xml (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/dependencies.xml 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,11 @@
+<project name="Project dependencies" default="deps" basedir=".">
+ <!-- project dependencies -->
+ <target name="deps">
+ <ant antfile="${main.buildfile}" target="dep">
+ <property name="module" value="abstraction-common"/>
+ </ant>
+ <ant antfile="${main.buildfile}" target="dep">
+ <property name="module" value="abstraction-local"/>
+ </ant>
+ </target>
+</project>
Added: trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.head
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.head (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.head 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1 @@
+Manifest-Version: 1.0
Added: trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.tail
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.tail (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/etc/MANIFEST.MF.tail 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1 @@
+
Added: trunk/current/src/cog/modules/provider-dcache/etc/log4j.properties.module
===================================================================
Added: trunk/current/src/cog/modules/provider-dcache/etc/provider-dcache.properties
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/etc/provider-dcache.properties (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/etc/provider-dcache.properties 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,11 @@
+#
+# the location of dccp
+#
+
+dccp=dccp
+
+#
+# various command line options to dccp
+#
+
+dccp.options=-v
\ No newline at end of file
Added: trunk/current/src/cog/modules/provider-dcache/launchers.xml
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/launchers.xml (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/launchers.xml 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,6 @@
+<project name="Launchers" default="create" basedir=".">
+ <target name="create">
+ </target>
+ <target name="webstart">
+ </target>
+</project>
Added: trunk/current/src/cog/modules/provider-dcache/meta/description.txt
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/meta/description.txt (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/meta/description.txt 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,3 @@
+The provider-dcache module is a component of the abstractions framework.
+It provides the implementation for transfering files to and from dCache
+using dccp.
\ No newline at end of file
Added: trunk/current/src/cog/modules/provider-dcache/project.properties
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/project.properties (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/project.properties 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,6 @@
+module.name = provider-dcache
+long.name = dCache provider for abstractions
+version = 0.1
+project = Java CoG Kit
+lib.deps = -
+debug = true
Added: trunk/current/src/cog/modules/provider-dcache/resources/cog-provider.properties
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/resources/cog-provider.properties (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/resources/cog-provider.properties 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,5 @@
+provider=dcache
+sandbox=false
+fileOperationTaskHandler=org.globus.cog.abstraction.impl.file.dcache.TaskHandlerImpl
+securityContext=org.globus.cog.abstraction.impl.common.task.SecurityContextImpl
+fileResource=org.globus.cog.abstraction.impl.file.dcache.FileResourceImpl
Added: trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/FileResourceImpl.java 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,107 @@
+package org.globus.cog.abstraction.impl.file.dcache;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.log4j.Logger;
+import org.globus.cog.abstraction.impl.file.FileResourceException;
+import org.globus.cog.abstraction.interfaces.ProgressMonitor;
+
+/**
+ * enables access to local file system through the file resource interface
+ * Supports absolute and relative path names
+ */
+public class FileResourceImpl extends org.globus.cog.abstraction.impl.file.local.FileResourceImpl {
+ public static final Logger logger = Logger.getLogger(FileResourceImpl.class);
+
+ public static final String PROPERTIES = "provider-dcache.properties";
+ public static final String DCCP = "dccp";
+ public static final String OPTIONS = "dccp.options";
+ private static Properties properties;
+
+ protected synchronized static Properties getProperties() {
+ if (properties == null) {
+ properties = new Properties();
+ properties.put(DCCP, "dccp");
+ properties.put(OPTIONS, "-d 1");
+ URL res = FileResourceImpl.class.getClassLoader().getResource(PROPERTIES);
+ if (res != null) {
+ try {
+ properties.load(res.openStream());
+ }
+ catch (IOException e) {
+ logger.warn("Failed to load dcache provider properties", e);
+ }
+ }
+ }
+ return properties;
+ }
+
+ private static String[] dccpCmd;
+
+ protected synchronized static String[] getDCCPCmd() {
+ if (dccpCmd == null) {
+ StringTokenizer st = new StringTokenizer(getProperties().getProperty(OPTIONS));
+ dccpCmd = new String[st.countTokens() + 1];
+ dccpCmd[0] = getProperties().getProperty(DCCP);
+ for (int i = 0; i < dccpCmd.length; i++) {
+ dccpCmd[i + 1] = st.nextToken();
+ }
+ }
+ return dccpCmd;
+ }
+
+ public FileResourceImpl() {
+ this("dcache");
+ }
+
+ public FileResourceImpl(String name) {
+ super(name);
+ }
+
+ public void getFile(String remoteFileName, String localFileName, ProgressMonitor progressMonitor)
+ throws FileResourceException {
+ try {
+ String[] opts = getDCCPCmd();
+ String[] cmd = new String[opts.length + 2];
+ System.arraycopy(opts, 0, cmd, 0, opts.length);
+ cmd[cmd.length - 2] = resolve(remoteFileName).getAbsolutePath();
+ cmd[cmd.length - 1] = resolve(localFileName).getAbsolutePath();
+ Process p = Runtime.getRuntime().exec(cmd);
+ consumeOutput(p);
+ int exitcode = p.waitFor();
+ if (exitcode != 0) {
+ throw new FileResourceException("Failed to copy \"" + remoteFileName + "\" to \""
+ + localFileName + "\". dccp failed with an exit code of " + exitcode);
+ }
+ }
+ catch (FileResourceException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ throw new FileResourceException(e);
+ }
+ }
+
+ private String consumeOutput(Process p) throws IOException {
+ StringBuffer errstr = new StringBuffer();
+ Reader out = new InputStreamReader(p.getInputStream());
+ BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+
+ while (out.read() != -1) {
+ // keep reading
+ }
+
+ String line = err.readLine();
+ while (line != null) {
+ errstr.append(line);
+ errstr.append('\n');
+ }
+ return errstr.toString();
+ }
+}
Added: trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/TaskHandlerImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/TaskHandlerImpl.java (rev 0)
+++ trunk/current/src/cog/modules/provider-dcache/src/org/globus/cog/abstraction/impl/file/dcache/TaskHandlerImpl.java 2007-08-23 18:52:45 UTC (rev 1710)
@@ -0,0 +1,8 @@
+package org.globus.cog.abstraction.impl.file.dcache;
+
+/**
+ * Extends the base class TaskHandlerImpl in org.globus.cog.core.impl.file
+ */
+public class TaskHandlerImpl
+ extends org.globus.cog.abstraction.impl.file.TaskHandlerImpl {
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-22 22:53:56
|
Revision: 1709
http://cogkit.svn.sourceforge.net/cogkit/?rev=1709&view=rev
Author: hategan
Date: 2007-08-22 15:53:55 -0700 (Wed, 22 Aug 2007)
Log Message:
-----------
multiple alternatives are more than one
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties
Modified: trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties 2007-08-22 22:46:53 UTC (rev 1708)
+++ trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties 2007-08-22 22:53:55 UTC (rev 1709)
@@ -18,7 +18,7 @@
#
# A regular expression to fetch the exit code from stderr. The
# exit code itself should be in a capturing group (any group).
-# Use non-caputuring groups (?:X) for or-ing multiple alternatives. E.g.
+# Use non-caputuring groups (?:X) for or-ing alternatives. E.g.
# (?:stuff ([0-9]*))|(?:some other stuff ([0-9]*))
#
# Backslashes need to be escaped. A literal . (dot; period) would be specified
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ha...@us...> - 2007-08-22 22:46:56
|
Revision: 1708
http://cogkit.svn.sourceforge.net/cogkit/?rev=1708&view=rev
Author: hategan
Date: 2007-08-22 15:46:53 -0700 (Wed, 22 Aug 2007)
Log Message:
-----------
exit code regexp
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-localscheduler/CHANGES.txt
trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties
trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java
trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltJob.java
trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/Properties.java
Modified: trunk/current/src/cog/modules/provider-localscheduler/CHANGES.txt
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/CHANGES.txt 2007-08-22 21:40:26 UTC (rev 1707)
+++ trunk/current/src/cog/modules/provider-localscheduler/CHANGES.txt 2007-08-22 22:46:53 UTC (rev 1708)
@@ -5,6 +5,10 @@
*** Added -k <kernel profile> option for cobalt. The spec attribute
is "kernelprofile".
+
+*** Configurable exit code extraction regexps (Kevin Harms points
+ out that looking for a string containing "BG/L job exit status"
+ is likely to not work on a BG/P). D'oh!
(08/20/07)
Modified: trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties 2007-08-22 21:40:26 UTC (rev 1707)
+++ trunk/current/src/cog/modules/provider-localscheduler/etc/provider-cobalt.properties 2007-08-22 22:46:53 UTC (rev 1708)
@@ -14,3 +14,15 @@
# The path to cqstat. The default assumes that cqstat is in PATH
#
cqstat=cqstat
+
+#
+# A regular expression to fetch the exit code from stderr. The
+# exit code itself should be in a capturing group (any group).
+# Use non-caputuring groups (?:X) for or-ing multiple alternatives. E.g.
+# (?:stuff ([0-9]*))|(?:some other stuff ([0-9]*))
+#
+# Backslashes need to be escaped. A literal . (dot; period) would be specified
+# as \\.
+#
+
+exitcode.regexp=(?:.*BG/. job exit status =\\s*([0-9]+))|(?:.*exit status = \\(([0-9]+)\\))
\ No newline at end of file
Modified: trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java 2007-08-22 21:40:26 UTC (rev 1707)
+++ trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltExecutor.java 2007-08-22 22:46:53 UTC (rev 1708)
@@ -18,6 +18,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.scheduler.common.ProcessException;
@@ -36,6 +37,7 @@
private ProcessListener listener;
private String stdout, stderr;
private String cqsub;
+ private Pattern exitcodeRegexp;
private static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -44,6 +46,7 @@
this.spec = (JobSpecification) task.getSpecification();
this.listener = listener;
this.cqsub = Properties.getProperties().getCQSub();
+ this.exitcodeRegexp = Pattern.compile(Properties.getProperties().getExitcodeRegexp());
}
private static synchronized QueuePoller getProcessPoller() {
@@ -111,7 +114,7 @@
getProcessPoller().addJob(
new CobaltJob(jobid, stdout, stderr, spec.getStdOutput(), spec
.getStdOutputLocation(), spec.getStdError(), spec
- .getStdErrorLocation(), this));
+ .getStdErrorLocation(), exitcodeRegexp, this));
}
private void error(String message) {
Modified: trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltJob.java
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltJob.java 2007-08-22 21:40:26 UTC (rev 1707)
+++ trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/CobaltJob.java 2007-08-22 22:46:53 UTC (rev 1708)
@@ -14,8 +14,9 @@
import java.io.CharArrayWriter;
import java.io.FileReader;
import java.io.FileWriter;
-import java.io.IOException;
import java.io.Writer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.globus.cog.abstraction.impl.common.util.NullWriter;
@@ -31,9 +32,11 @@
private String stdout, stderr, tstdout, tstderr;
private FileLocation outLoc, errLoc;
private int exitcode;
+ private Pattern exitcodeRegexp;
- public CobaltJob(String jobID, String stdout,
- String stderr, String tstdout, FileLocation outLoc, String tstderr, FileLocation errLoc,
+ public CobaltJob(String jobID, String stdout, String stderr,
+ String tstdout, FileLocation outLoc, String tstderr,
+ FileLocation errLoc, Pattern exitcodeRegexp,
ProcessListener listener) {
super(jobID, null, null, null, null, null, listener);
this.stdout = stdout;
@@ -42,6 +45,7 @@
this.outLoc = outLoc;
this.tstderr = tstderr;
this.errLoc = errLoc;
+ this.exitcodeRegexp = exitcodeRegexp;
int exitcode = Integer.MIN_VALUE;
}
@@ -66,7 +70,8 @@
wr = caw;
}
if (tstdout != null && LOCAL_AND_REMOTE.overlaps(outLoc)) {
- wr = WriterMultiplexer.multiplex(wr, new BufferedWriter(new FileWriter(tstdout)));
+ wr = WriterMultiplexer.multiplex(wr, new BufferedWriter(
+ new FileWriter(tstdout)));
}
if (wr == null) {
wr = new NullWriter();
@@ -96,9 +101,10 @@
return false;
}
}
-
- private static final FileLocation LOCAL_AND_REMOTE = FileLocation.LOCAL.and(FileLocation.REMOTE);
+ private static final FileLocation LOCAL_AND_REMOTE = FileLocation.LOCAL
+ .and(FileLocation.REMOTE);
+
protected boolean processStderr() {
try {
Writer wr = null;
@@ -108,7 +114,8 @@
wr = caw;
}
if (tstdout != null && LOCAL_AND_REMOTE.overlaps(errLoc)) {
- wr = WriterMultiplexer.multiplex(wr, new BufferedWriter(new FileWriter(tstderr)));
+ wr = WriterMultiplexer.multiplex(wr, new BufferedWriter(
+ new FileWriter(tstderr)));
}
if (wr == null) {
wr = new NullWriter();
@@ -116,7 +123,7 @@
BufferedReader br = new BufferedReader(new FileReader(stderr));
String line;
boolean started = false;
-
+
do {
line = br.readLine();
if (line != null) {
@@ -131,22 +138,31 @@
wr.write('\n');
}
else {
- int index = line.indexOf("BG/L job exit status =");
- if (index != -1) {
- String es = line.substring(index +
- "BG/L job exit status =".length()).trim();
- if (!es.startsWith("(") && !es.endsWith(")")) {
- throw new IOException(
- "Could not parse job exit status. Invalid exit status line: "
- + line);
+ Matcher m = exitcodeRegexp.matcher(line);
+ if (m.matches()) {
+ for (int i = 0; i < m.groupCount(); i++) {
+ String group = m.group(i + 1);
+ if (group != null) {
+ group = group.trim();
+ if (!group.equals("")) {
+ try {
+ exitcode = Integer
+ .parseInt(group);
+ break;
+ }
+ catch (NumberFormatException e) {
+ throw new NumberFormatException(
+ "Invalid exit status line: "
+ + line
+ + ". Could not parse job exit status: "
+ + group);
+ }
+ }
+ }
}
- else {
- exitcode = Integer.parseInt(es.substring(1, es.length() - 1));
- }
}
}
}
-
}
} while (line != null);
br.close();
@@ -154,7 +170,7 @@
if (caw != null) {
listener.stderrUpdated(caw.toString());
}
-
+
return true;
}
catch (Exception e) {
Modified: trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/Properties.java
===================================================================
--- trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/Properties.java 2007-08-22 21:40:26 UTC (rev 1707)
+++ trunk/current/src/cog/modules/provider-localscheduler/src/org/globus/cog/abstraction/impl/scheduler/cobalt/Properties.java 2007-08-22 22:46:53 UTC (rev 1708)
@@ -21,7 +21,8 @@
public static final String POLL_INTERVAL = "poll.interval";
public static final String CQSUB = "cqsub";
- public static final String CQSTAT = "cqstat";
+ public static final String CQSTAT = "cqstat";
+ public static final String EXITCODE_REGEXP = "exitcode.regexp";
private static Properties properties;
@@ -52,6 +53,7 @@
setPollInterval(5);
setCQSub("cqsub");
setCQStat("cqstat");
+ setExitcodeRegexp("(?BG/L job exit status = ([0-9]+))|(?exit status = \\(([0-9]+)\\))");
}
public void setPollInterval(int value) {
@@ -77,4 +79,12 @@
public String getCQStat() {
return getProperty(CQSTAT);
}
+
+ public String getExitcodeRegexp() {
+ return getProperty(EXITCODE_REGEXP);
+ }
+
+ public void setExitcodeRegexp(String value) {
+ setProperty(EXITCODE_REGEXP, value);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|