Skip to content

Trogdor: Add Task State filter to /coordinator/tasks endpoint#5907

Closed
stanislavkozlovski wants to merge 7 commits intoapache:trunkfrom
stanislavkozlovski:KAFKA-7619-trogdor-task-filter-state
Closed

Trogdor: Add Task State filter to /coordinator/tasks endpoint#5907
stanislavkozlovski wants to merge 7 commits intoapache:trunkfrom
stanislavkozlovski:KAFKA-7619-trogdor-task-filter-state

Conversation

@stanislavkozlovski
Copy link
Copy Markdown
Contributor

Also ensures that the /tasks/{taskId} endpoint returns a semantically-correct 404 status code. It would previously return 500 since the NotFoundException was not handled anywhere.

cc @cmccabe

@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Nov 14, 2018

Can you rebase this change?

@stanislavkozlovski
Copy link
Copy Markdown
Contributor Author

Rebased

@stanislavkozlovski
Copy link
Copy Markdown
Contributor Author

Retest this please

Comment thread tools/src/main/java/org/apache/kafka/trogdor/coordinator/TaskManager.java Outdated
@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Nov 19, 2018

Looks good overall. I left a comment about types.

Removes the old ManagedTaskState enum
this.lastStartMs = Math.max(0, lastStartMs);
this.firstEndMs = Math.max(0, firstEndMs);
this.lastEndMs = Math.max(0, lastEndMs);
this.state = state;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Check for state == null and set this to Optional.None in that case

Comment thread tools/src/main/java/org/apache/kafka/trogdor/rest/TaskStateType.java Outdated
@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Nov 21, 2018

It looks like there is a findbugs warning that needs to be fixed. Also there is a null check that needs to be added. LGTM after that is done

System.out.println("Got coordinator tasks: " +
JsonUtil.toPrettyJsonString(client.tasks(
new TasksRequest(null, 0, 0, 0, 0))));
new TasksRequest(null, 0, 0, 0, 0, Optional.empty()))));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you file a follow-on JIRA for adding support for specifying the task state to show_tasks?

Then the user could run something like:

./bin/trogdor.sh client --show-tasks --state DONE

Alternately, we could add support in this pull request if you want.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I decided we should open a JIRA since it would be good if we supported every argument for --show-tasks (taskids, start/end ms)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.kafka.trogdor.coordinator.TaskManager;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unused import

@cmccabe cmccabe closed this Nov 27, 2018
@cmccabe
Copy link
Copy Markdown
Contributor

cmccabe commented Nov 27, 2018

I merged this to trunk, after adding the missing suppression for an NPathComplexity warning in in checkstyle.xml. Please run ./gradlew check -x test or similar in the future so that you see these warnings before Jenkins does.

asfgit pushed a commit that referenced this pull request Nov 27, 2018
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants