Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more debug logs for task action #24

Open
wants to merge 1 commit into
base: 0.8.3-mmx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completed action for task[%s]: %s in [%d]ms might be easier to read

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