[Swift-commit] r2379 - provider-wonky/src/org/globus/cog/abstraction/impl/execution/wonky
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Fri Dec 19 13:48:05 CST 2008
Author: benc
Date: 2008-12-19 13:48:03 -0600 (Fri, 19 Dec 2008)
New Revision: 2379
Modified:
provider-wonky/src/org/globus/cog/abstraction/impl/execution/wonky/JobSubmissionTaskHandler.java
Log:
tidy up source a bit
Modified: provider-wonky/src/org/globus/cog/abstraction/impl/execution/wonky/JobSubmissionTaskHandler.java
===================================================================
--- provider-wonky/src/org/globus/cog/abstraction/impl/execution/wonky/JobSubmissionTaskHandler.java 2008-12-19 16:33:30 UTC (rev 2378)
+++ provider-wonky/src/org/globus/cog/abstraction/impl/execution/wonky/JobSubmissionTaskHandler.java 2008-12-19 19:48:03 UTC (rev 2379)
@@ -74,7 +74,7 @@
throw new TaskSubmissionException("Task is not in unsubmitted state");
}
else {
-logger.info("Submitting wonky job "+jobNumber);
+ logger.info("Submitting wonky job "+jobNumber);
this.task = task;
@@ -82,7 +82,7 @@
.getServiceContact();
String server = serviceContact.getContact();
-logger.debug("Contact is: "+server);
+ logger.debug("Contact is: "+server);
String[] splitServer = server.split("/");
siteName = splitServer[0];
siteOptions = Arrays.asList(splitServer);
@@ -146,17 +146,17 @@
public void suspend() throws InvalidSecurityContextException,
TaskSubmissionException {
-logger.info("Suspend called on wonky job "+jobNumber);
+ logger.info("Suspend called on wonky job "+jobNumber);
}
public void resume() throws InvalidSecurityContextException,
TaskSubmissionException {
-logger.info("Resume called on wonky job "+jobNumber);
+ logger.info("Resume called on wonky job "+jobNumber);
}
public void cancel() throws InvalidSecurityContextException,
TaskSubmissionException {
-logger.info("Cancel called on wonky job "+jobNumber);
+ logger.info("Cancel called on wonky job "+jobNumber);
synchronized(this) {
killed = true;
process.destroy();
@@ -176,41 +176,39 @@
if (spec.getDirectory() != null) {
dir = new File(spec.getDirectory());
}
-logger.info("Wonky job in queue, job number "+jobNumber);
-String[] cmdarray = buildCmdArray(spec, jobNumber);
-try {
-logger.info("wonky site is "+siteName);
- if(siteOptions.contains("firstfast") && !firstJobList.contains(siteName)) {
-logger.info("not sleeping - this is the first job on site "+siteName+", "+jobNumber);
-firstJobList.add(siteName);
-} else
-{
-double qmean=0;
-double qstddev=0;
+ logger.info("Wonky job in queue, job number "+jobNumber);
+ String[] cmdarray = buildCmdArray(spec, jobNumber);
+ try {
+ logger.info("wonky site is "+siteName);
+ if(siteOptions.contains("firstfast") && !firstJobList.contains(siteName)) {
+ logger.info("not sleeping - this is the first job on site "+siteName+", "+jobNumber);
+ firstJobList.add(siteName);
+ } else {
+ double qmean=0;
+ double qstddev=0;
-Iterator it = siteOptions.iterator();
-while(it.hasNext()) {
-String op = (String) it.next();
-logger.debug("Checking: "+op);
-if(op.startsWith("qmean=")) {
-qmean = Double.parseDouble(op.substring(6));
-logger.debug("qmean = "+qmean);
-} else if(op.startsWith("qstddev=")) {
-qstddev = Double.parseDouble(op.substring(8));
-logger.debug("qstddev = "+qstddev);
-}
-}
+ Iterator it = siteOptions.iterator();
+ while(it.hasNext()) {
+ String op = (String) it.next();
+ logger.debug("Checking: "+op);
+ if(op.startsWith("qmean=")) {
+ qmean = Double.parseDouble(op.substring(6));
+ logger.debug("qmean = "+qmean);
+ } else if(op.startsWith("qstddev=")) {
+ qstddev = Double.parseDouble(op.substring(8));
+ logger.debug("qstddev = "+qstddev);
+ }
+ }
-double qdelay = qmean + qstddev * r.nextGaussian();
+ double qdelay = qmean + qstddev * r.nextGaussian();
-Thread.sleep((long)(qdelay*1000));
-}
-} catch(InterruptedException ie) {
-System.out.println("fake queue delay interrupted for job "+jobNumber);
-}
-System.out.println("Wonky job running now");
- process = Runtime.getRuntime().exec(cmdarray,
- buildEnvp(spec), dir);
+ Thread.sleep((long)(qdelay*1000));
+ }
+ } catch(InterruptedException ie) {
+ logger.warn("fake queue delay interrupted for job "+jobNumber);
+ }
+ logger.info("Wonky job running now");
+ process = Runtime.getRuntime().exec(cmdarray, buildEnvp(spec), dir);
if(!failDelay("active")) {
this.task.setStatus(Status.FAILED);
return;
@@ -389,7 +387,7 @@
double failFirstCount = getWonkyParam(name+"failfirstcount");
if(failFirstCount > 0) {
- System.out.println("State "+name+" will fail first "+failFirstCount+" times");
+ logger.info("State "+name+" will fail first "+failFirstCount+" times");
String key = getSiteName() + ":" + name + "failfirstcountsofar";
Integer iObj = (Integer)siteStates.get(key);
if(iObj == null) {
@@ -400,19 +398,19 @@
int i = iObj.intValue();
i++;
siteStates.put(key,new Integer(i));
- System.out.println("new value is "+i);
+ logger.info("new value is "+i);
if(i<=failFirstCount) { // not failed enough
- System.out.println("Failing because early job");
+ logger.info("Failing because early job");
return false;
}
}
- System.out.print("State "+name+" with probability of failure "+failRate+": ");
+ logger.info("State "+name+" with probability of failure "+failRate+": ");
if(Math.random()<failRate) {
- System.out.println("Fail.");
+ logger.info("Fail.");
return false;
} else {
- System.out.println("Success.");
+ logger.info("Success.");
try { Thread.sleep((long)(delayTime * 1000)); }
catch(InterruptedException ie) {
logger.warn("Warning: wonky delay was interrupted");
@@ -438,7 +436,7 @@
String getSiteName() {
String siteName = (String) siteOptions.get(0);
- System.out.println("Site name is "+siteName);
+ logger.info("Site name is "+siteName);
return siteName;
}
}
More information about the Swift-commit
mailing list