|
From: <ha...@us...> - 2008-09-08 21:17:59
|
Revision: 2138
http://cogkit.svn.sourceforge.net/cogkit/?rev=2138&view=rev
Author: hategan
Date: 2008-09-08 21:17:56 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
reformatting and make sure we die if there is an Error
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java
trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/WorkerManager.java
Modified: trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java
===================================================================
--- trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java 2008-09-08 21:16:21 UTC (rev 2137)
+++ trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java 2008-09-08 21:17:56 UTC (rev 2138)
@@ -29,7 +29,9 @@
public static final Logger logger = Logger
.getLogger(CoasterService.class);
- public static final int IDLE_TIMEOUT = 600 * 1000;
+ public static final int IDLE_TIMEOUT = 120 * 1000;
+
+ public static final RequestManager COASTER_REQUEST_MANAGER = new CoasterRequestManager();
private String registrationURL, id;
private JobQueue jobQueue;
@@ -67,7 +69,7 @@
else {
try {
ConnectionHandler handler = new ConnectionHandler(this, sock,
- new CoasterRequestManager());
+ COASTER_REQUEST_MANAGER);
handler.start();
}
catch (Exception e) {
@@ -90,7 +92,8 @@
try {
logger.info("Reserving channel for registration");
KarajanChannel channel = ChannelManager.getManager()
- .reserveChannel(registrationURL, null);
+ .reserveChannel(registrationURL, null, COASTER_REQUEST_MANAGER);
+ channel.getChannelContext().setService(this);
logger.info("Sending registration");
RegistrationCommand reg = new RegistrationCommand(id,
"https://" + getHost() + ":" + getPort());
@@ -121,7 +124,7 @@
public void waitFor() throws Exception {
synchronized (this) {
while (!done) {
- wait(1000);
+ wait(10000);
checkIdleTime();
}
if (e != null) {
@@ -133,6 +136,7 @@
private synchronized void checkIdleTime() {
// the notification manager should probably not be a singleton
long idleTime = NotificationManager.getDefault().getIdleTime();
+ logger.info("Idle time: " + idleTime);
if (idleTime > IDLE_TIMEOUT) {
suspend();
if (NotificationManager.getDefault().getIdleTime() < IDLE_TIMEOUT) {
Modified: trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/WorkerManager.java
===================================================================
--- trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/WorkerManager.java 2008-09-08 21:16:21 UTC (rev 2137)
+++ trunk/current/src/cog/modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/job/manager/WorkerManager.java 2008-09-08 21:17:56 UTC (rev 2138)
@@ -36,6 +36,7 @@
import org.globus.cog.abstraction.impl.common.task.JobSpecificationImpl;
import org.globus.cog.abstraction.impl.common.task.TaskImpl;
import org.globus.cog.abstraction.interfaces.ExecutionService;
+import org.globus.cog.abstraction.interfaces.FileLocation;
import org.globus.cog.abstraction.interfaces.JobSpecification;
import org.globus.cog.abstraction.interfaces.Status;
import org.globus.cog.abstraction.interfaces.Task;
@@ -62,9 +63,8 @@
public static final int MAX_WORKERS = 256;
public static final int MAX_STARTING_WORKERS = 32;
- public static final List coasterAttributes = Arrays.asList(new String[]{
- "coasterspernode"
- });
+ public static final List coasterAttributes = Arrays
+ .asList(new String[] { "coasterspernode" });
private SortedMap ready;
private Map ids;
@@ -148,19 +148,27 @@
catch (InterruptedException e) {
e.printStackTrace();
}
+ catch (Error e) {
+ e.printStackTrace();
+ System.exit(126);
+ }
}
private void startWorker(int maxWallTime, Task prototype)
throws InvalidServiceContactException {
- String numWorkersString = (String)((JobSpecification) prototype.getSpecification()).getAttribute("coastersPerNode");
+ String numWorkersString = (String) ((JobSpecification) prototype
+ .getSpecification()).getAttribute("coastersPerNode");
int numWorkers;
- if(numWorkersString==null) {
+ if (numWorkersString == null) {
numWorkers = 1;
- } else {
+ }
+ else {
numWorkers = Integer.parseInt(numWorkersString);
}
- logger.info("Starting new worker set with "+numWorkers+" workers");
+ logger
+ .info("Starting new worker set with " + numWorkers
+ + " workers");
Task t = new TaskImpl();
t.setType(Task.JOB_SUBMISSION);
@@ -170,31 +178,35 @@
t.setService(0, buildService(prototype));
Map newlyRequested = new HashMap();
- for(int n = 0; n<numWorkers; n++) {
+ for (int n = 0; n < numWorkers; n++) {
int id = sr.nextInt();
if (logger.isInfoEnabled()) {
- logger.info("Starting worker with id=" + id + " and maxwalltime=" + maxWallTime + "s");
- }
+ logger.info("Starting worker with id=" + id
+ + " and maxwalltime=" + maxWallTime + "s");
+ }
String sid = String.valueOf(id);
- ((JobSpecification)t.getSpecification()).addArgument(sid);
+ ((JobSpecification) t.getSpecification()).addArgument(sid);
try {
Worker wr = new Worker(this, sid, maxWallTime, t, prototype);
newlyRequested.put(sid, wr);
}
- catch (Exception e) {
- prototype.setStatus(new StatusImpl(Status.FAILED, e.getMessage(),
- e));
+ catch (Exception e) {
+ prototype.setStatus(new StatusImpl(Status.FAILED, e
+ .getMessage(), e));
}
}
+ System.err.println(t.getSpecification());
try {
handler.submit(t);
- } catch(Exception e) {
- prototype.setStatus(new StatusImpl(Status.FAILED, e.getMessage(), e));
}
- synchronized(requested) {
+ catch (Exception e) {
+ prototype.setStatus(new StatusImpl(Status.FAILED, e.getMessage(),
+ e));
+ }
+ synchronized (requested) {
requested.putAll(newlyRequested);
}
}
@@ -206,7 +218,6 @@
js.addArgument(script.getAbsolutePath());
js.addArgument(callbackURI.toString());
// js.addArgument(id);
-
return js;
}
@@ -233,12 +244,13 @@
}
private void copyAttributes(Task t, Task prototype, int maxWallTime) {
- JobSpecification pspec = (JobSpecification) prototype.getSpecification();
+ JobSpecification pspec = (JobSpecification) prototype
+ .getSpecification();
JobSpecification tspec = (JobSpecification) t.getSpecification();
Iterator i = pspec.getAttributeNames().iterator();
while (i.hasNext()) {
String name = (String) i.next();
- if(!coasterAttributes.contains(name)) {
+ if (!coasterAttributes.contains(name)) {
tspec.setAttribute(name, pspec.getAttribute(name));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|