Skip to content

Commit

Permalink
Add more debug logs for task action
Browse files Browse the repository at this point in the history
review comment

review comments
  • Loading branch information
nishantmonu51 committed Mar 9, 2016
1 parent 9e82ed8 commit 6195e79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public LocalTaskActionClient(Task task, TaskStorage storage, TaskActionToolbox t
public <RetType> RetType submit(TaskAction<RetType> taskAction) throws IOException
{
log.info("Performing action for task[%s]: %s", task.getId(), taskAction);

long startTime = System.currentTimeMillis();
if (taskAction.isAudited()) {
// Add audit log
try {
Expand All @@ -59,6 +59,13 @@ public <RetType> RetType submit(TaskAction<RetType> taskAction) throws IOExcepti
}
}

return taskAction.perform(task, toolbox);
RetType rv = taskAction.perform(task, toolbox);
log.debug(
"Completed action for task[%s]: %s. Took [%d]ms",
task.getId(),
taskAction,
System.currentTimeMillis() - startTime
);
return rv;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ public Response getWorkerConfigHistory(
@Produces(MediaType.APPLICATION_JSON)
public <T> Response doAction(final TaskActionHolder<T> holder)
{
log.debug("Received action for task[%s]: %s", holder.getTask(), holder.getAction());

return asLeaderWith(
taskMaster.getTaskActionClient(holder.getTask()),
new Function<TaskActionClient, Response>()
Expand All @@ -256,8 +258,8 @@ public Response apply(TaskActionClient taskActionClient)
retMap = Maps.newHashMap();
retMap.put("result", ret);
}
catch (IOException e) {
log.warn(e, "Failed to perform task action");
catch (Exception e) {
log.warn(e, "Failed to perform action for task[%s]: %s", holder.getTask(), holder.getAction());
return Response.serverError().build();
}

Expand Down

0 comments on commit 6195e79

Please sign in to comment.