You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kfaraz (via GitHub)" <gi...@apache.org> on 2023/09/04 06:28:25 UTC
[PR] Refactor: Cleanup NoopTask (druid)
kfaraz opened a new pull request, #14938:
URL: https://github.com/apache/druid/pull/14938
### Changes
- Simplify static `create` methods for `NoopTask`
- Remove usage of `Firehose` from `NoopTask` as it was not being used anywhere
- Update tests
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314623912
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -159,17 +143,8 @@ public void stopGracefully(TaskConfig taskConfig)
@Override
public TaskStatus runTask(TaskToolbox toolbox) throws Exception
{
- if (firehoseFactory != null) {
- log.info("Connecting firehose");
- }
- try (Firehose firehose = firehoseFactory != null ? firehoseFactory.connect(null, null) : null) {
-
- log.info("Running noop task[%s]", getId());
- log.info("Sleeping for %,d millis.", runTime);
Review Comment:
No, I don't see it adding much value. These logs fill up the logs and make it difficult to find important things such as warnings and errors.
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -159,17 +143,8 @@ public void stopGracefully(TaskConfig taskConfig)
@Override
public TaskStatus runTask(TaskToolbox toolbox) throws Exception
{
- if (firehoseFactory != null) {
- log.info("Connecting firehose");
- }
- try (Firehose firehose = firehoseFactory != null ? firehoseFactory.connect(null, null) : null) {
-
- log.info("Running noop task[%s]", getId());
- log.info("Sleeping for %,d millis.", runTime);
Review Comment:
No, I don't see it adding much value. Such messages only fill up the logs and make it difficult to find important things such as warnings and errors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314657919
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -67,18 +62,14 @@ enum IsReadyResult
@JsonIgnore
private final IsReadyResult isReadyResult;
- @JsonIgnore
- private final FirehoseFactory firehoseFactory;
-
@JsonCreator
public NoopTask(
@JsonProperty("id") String id,
@JsonProperty("groupId") String groupId,
@JsonProperty("dataSource") String dataSource,
- @JsonProperty("runTime") long runTime,
+ @JsonProperty("runTime") long runTimeMillis,
@JsonProperty("isReadyTime") long isReadyTime,
@JsonProperty("isReadyResult") String isReadyResult,
Review Comment:
Not really. I guess we should remove this too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314610228
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -159,17 +143,8 @@ public void stopGracefully(TaskConfig taskConfig)
@Override
public TaskStatus runTask(TaskToolbox toolbox) throws Exception
{
- if (firehoseFactory != null) {
- log.info("Connecting firehose");
- }
- try (Firehose firehose = firehoseFactory != null ? firehoseFactory.connect(null, null) : null) {
-
- log.info("Running noop task[%s]", getId());
- log.info("Sleeping for %,d millis.", runTime);
Review Comment:
Could this logging be useful for understanding test runs better?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314609406
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -180,33 +155,18 @@ public int getPriority()
public static NoopTask create()
{
- return new NoopTask(null, null, null, 0, 0, null, null, null);
+ return forDatasource(null);
}
- public static NoopTask withGroupId(String groupId)
+ public static NoopTask forDatasource(String datasource)
{
- return new NoopTask(null, groupId, null, 0, 0, null, null, null);
- }
-
- @VisibleForTesting
- public static NoopTask create(String dataSource)
- {
- return new NoopTask(null, null, dataSource, 0, 0, null, null, null);
- }
-
- @VisibleForTesting
- public static NoopTask create(int priority)
- {
- final Map<String, Object> context = new HashMap<>();
- context.put(Tasks.PRIORITY_KEY, priority);
- return new NoopTask(null, null, null, 0, 0, null, null, context);
+ return new NoopTask(null, null, datasource, 0, 0, null, null);
}
- @VisibleForTesting
- public static NoopTask create(String id, int priority)
+ public static NoopTask withPriority(int priority)
Review Comment:
withPriority seems a bit misleading as one may think that the other fields' values would be retained
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "AmatyaAvadhanula (via GitHub)" <gi...@apache.org>.
AmatyaAvadhanula commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314619429
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -67,18 +62,14 @@ enum IsReadyResult
@JsonIgnore
private final IsReadyResult isReadyResult;
- @JsonIgnore
- private final FirehoseFactory firehoseFactory;
-
@JsonCreator
public NoopTask(
@JsonProperty("id") String id,
@JsonProperty("groupId") String groupId,
@JsonProperty("dataSource") String dataSource,
- @JsonProperty("runTime") long runTime,
+ @JsonProperty("runTime") long runTimeMillis,
@JsonProperty("isReadyTime") long isReadyTime,
@JsonProperty("isReadyResult") String isReadyResult,
Review Comment:
Is a non-null value being passed for `isReadyResult`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #14938:
URL: https://github.com/apache/druid/pull/14938#discussion_r1314622946
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/NoopTask.java:
##########
@@ -180,33 +155,18 @@ public int getPriority()
public static NoopTask create()
{
- return new NoopTask(null, null, null, 0, 0, null, null, null);
+ return forDatasource(null);
}
- public static NoopTask withGroupId(String groupId)
+ public static NoopTask forDatasource(String datasource)
{
- return new NoopTask(null, groupId, null, 0, 0, null, null, null);
- }
-
- @VisibleForTesting
- public static NoopTask create(String dataSource)
- {
- return new NoopTask(null, null, dataSource, 0, 0, null, null, null);
- }
-
- @VisibleForTesting
- public static NoopTask create(int priority)
- {
- final Map<String, Object> context = new HashMap<>();
- context.put(Tasks.PRIORITY_KEY, priority);
- return new NoopTask(null, null, null, 0, 0, null, null, context);
+ return new NoopTask(null, null, datasource, 0, 0, null, null);
}
- @VisibleForTesting
- public static NoopTask create(String id, int priority)
+ public static NoopTask withPriority(int priority)
Review Comment:
We could rename it to `ofPriority`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] Refactor: Cleanup NoopTask (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz merged PR #14938:
URL: https://github.com/apache/druid/pull/14938
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org