You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by vd...@apache.org on 2016/03/18 01:50:53 UTC
incubator-quarks git commit: Add tracing to Executable
Repository: incubator-quarks
Updated Branches:
refs/heads/master e0726c310 -> 72fb8a6f3
Add tracing to Executable
Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/72fb8a6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/72fb8a6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/72fb8a6f
Branch: refs/heads/master
Commit: 72fb8a6f3f45524629e34836ad5d8d2a99254ee0
Parents: e0726c3
Author: Victor Dogaru <vd...@apache.org>
Authored: Thu Mar 17 16:47:02 2016 -0700
Committer: Victor Dogaru <vd...@apache.org>
Committed: Thu Mar 17 16:47:02 2016 -0700
----------------------------------------------------------------------
providers/iot/.gitignore | 1 +
.../java/quarks/runtime/etiao/Executable.java | 27 +++++++++-----------
2 files changed, 13 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/72fb8a6f/providers/iot/.gitignore
----------------------------------------------------------------------
diff --git a/providers/iot/.gitignore b/providers/iot/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/providers/iot/.gitignore
@@ -0,0 +1 @@
+/bin/
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/72fb8a6f/runtime/etiao/src/main/java/quarks/runtime/etiao/Executable.java
----------------------------------------------------------------------
diff --git a/runtime/etiao/src/main/java/quarks/runtime/etiao/Executable.java b/runtime/etiao/src/main/java/quarks/runtime/etiao/Executable.java
index 3a2c020..51cc612 100644
--- a/runtime/etiao/src/main/java/quarks/runtime/etiao/Executable.java
+++ b/runtime/etiao/src/main/java/quarks/runtime/etiao/Executable.java
@@ -16,6 +16,9 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import quarks.execution.Job;
import quarks.execution.services.RuntimeServices;
import quarks.execution.services.ServiceContainer;
@@ -36,7 +39,8 @@ public class Executable implements RuntimeServices {
private final TrackingScheduledExecutor controlScheduler;
private final TrackingScheduledExecutor userScheduler;
private Throwable lastError;
-
+ private static final Logger logger = LoggerFactory.getLogger(Executable.class);
+
/**
* Services specific to this job.
*/
@@ -63,8 +67,6 @@ public class Executable implements RuntimeServices {
this.job = job;
this.controlThreads = (threads != null) ? threads : Executors.defaultThreadFactory();
this.completionHandler = new BiConsumer<Object, Throwable>() {
- // XXX Use the project's BiConsumer (serializable) implementation to avoid
- // depending on Java 8's functional interfaces.
private static final long serialVersionUID = 1L;
/**
@@ -82,10 +84,9 @@ public class Executable implements RuntimeServices {
cleanup();
}
else if (job.getCurrentState() == Job.State.RUNNING &&
- (source == userScheduler || source == userThreads) &&
+ (source == userScheduler || source == userThreads) &&
!hasActiveTasks()) {
- // TODO trace message, debugging
- // System.err.println("No more active user tasks");
+ logger.info("No more active user tasks");
}
notifyCompleter();
}
@@ -167,8 +168,7 @@ public class Executable implements RuntimeServices {
invocation.close();
}
catch (Throwable t) {
- // TODO log, don't rethrow
- t.printStackTrace();
+ logger.debug("Exception caught while closing invocation {}: {}", invocation.getId(), t);
} finally {
jobServices.cleanOplet(job.getId(), invocation.getId());
job.getContainerServices().cleanOplet(job.getId(), invocation.getId());
@@ -178,8 +178,7 @@ public class Executable implements RuntimeServices {
notifyCompleter();
List<Runnable> unfinished = controlScheduler.shutdownNow();
if (!unfinished.isEmpty()) {
- // TODO log warning if there are unfinished tasks
- System.err.println("Could not finish " + unfinished.size() + " tasks");
+ logger.warn("Scheduler could not finish {} tasks", unfinished.size());
}
}
@@ -197,8 +196,7 @@ public class Executable implements RuntimeServices {
try {
Future<Boolean> completed = completer.poll(10, TimeUnit.SECONDS);
if (completed == null) {
- // TODO logging
- System.err.println("Completer timed out");
+ // TODO during close log exception and wait on the next task to complete
throw new RuntimeException(new TimeoutException());
}
else {
@@ -206,8 +204,7 @@ public class Executable implements RuntimeServices {
completed.get();
}
catch (ExecutionException | InterruptedException | CancellationException e) {
- // TODO logging
- e.printStackTrace();
+ logger.error("Exception caught while invoking action: {}", e);
}
}
} catch (InterruptedException e) {
@@ -215,7 +212,7 @@ public class Executable implements RuntimeServices {
}
remainingTasks--;
}
-
+
job.onActionComplete();
}