Skip to content

Commit

Permalink
update code style for task type (apache#16343)
Browse files Browse the repository at this point in the history
* update code style for task type

* address the comments
  • Loading branch information
AlbericByte authored Apr 29, 2024
1 parent aa46314 commit 736a2ab
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
public class AppenderatorDriverRealtimeIndexTask extends AbstractTask
implements ChatHandler, PendingSegmentAllocatingTask
{
public static final String TYPE = "index_realtime_appenderator";
private static final String CTX_KEY_LOOKUP_TIER = "lookupTier";

private static final EmittingLogger log = new EmittingLogger(RealtimeIndexTask.class);
Expand Down Expand Up @@ -217,7 +218,7 @@ public int getPriority()
@Override
public String getType()
{
return "index_realtime_appenderator";
return TYPE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

public class ArchiveTask extends AbstractFixedIntervalTask
{
public static final String TYPE = "archive";
private static final Logger log = new Logger(ArchiveTask.class);

public ArchiveTask(
Expand All @@ -60,7 +61,7 @@ public ArchiveTask(
@Override
public String getType()
{
return "archive";
return TYPE;
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
*/
public class CompactionTask extends AbstractBatchIndexTask implements PendingSegmentAllocatingTask
{
public static final String TYPE = "compact";
private static final Logger log = new Logger(CompactionTask.class);
private static final Clock UTC_CLOCK = Clock.systemUTC();

Expand All @@ -145,8 +146,6 @@ public class CompactionTask extends AbstractBatchIndexTask implements PendingSeg
*/
public static final String CTX_KEY_APPENDERATOR_TRACKING_TASK_ID = "appenderatorTrackingTaskId";

private static final String TYPE = "compact";

private static final boolean STORE_COMPACTION_STATE = true;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@

public class HadoopIndexTask extends HadoopTask implements ChatHandler
{
public static final String TYPE = "index_hadoop";
public static final String INPUT_SOURCE_TYPE = "hadoop";
private static final Logger log = new Logger(HadoopIndexTask.class);
private static final String HADOOP_JOB_ID_FILENAME = "mapReduceJobId.json";
private static final String TYPE = "index_hadoop";
private TaskConfig taskConfig = null;

private static String getTheDataSource(HadoopIngestionSpec spec)
Expand Down Expand Up @@ -192,7 +192,7 @@ public HadoopIndexTask(
@Override
public String getType()
{
return "index_hadoop";
return TYPE;
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@

public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, PendingSegmentAllocatingTask
{

public static final HashFunction HASH_FUNCTION = Hashing.murmur3_128();

public static final String TYPE = "index";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

public class MoveTask extends AbstractFixedIntervalTask
{
public static final String TYPE = "move";
private static final Logger log = new Logger(MoveTask.class);

private final Map<String, Object> targetLoadSpec;
Expand Down Expand Up @@ -68,7 +69,7 @@ public MoveTask(
@Override
public String getType()
{
return "move";
return TYPE;
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/
public class NoopTask extends AbstractTask implements PendingSegmentAllocatingTask
{
public static final String TYPE = "noop";
private static final int DEFAULT_RUN_TIME = 2500;

@JsonIgnore
Expand Down Expand Up @@ -70,7 +71,7 @@ public NoopTask(
@Override
public String getType()
{
return "noop";
return TYPE;
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
@Deprecated
public class RealtimeIndexTask extends AbstractTask
{
public static final String TYPE = "index_realtime";
public static final String CTX_KEY_LOOKUP_TIER = "lookupTier";

private static final EmittingLogger log = new EmittingLogger(RealtimeIndexTask.class);
Expand Down Expand Up @@ -180,7 +181,7 @@ public int getPriority()
@Override
public String getType()
{
return "index_realtime";
return TYPE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

public class RestoreTask extends AbstractFixedIntervalTask
{
public static final String TYPE = "restore";
private static final Logger log = new Logger(RestoreTask.class);

public RestoreTask(
Expand All @@ -61,7 +62,7 @@ public RestoreTask(
@Override
public String getType()
{
return "restore";
return TYPE;
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes(value = {
@Type(name = KillUnusedSegmentsTask.TYPE, value = KillUnusedSegmentsTask.class),
@Type(name = "move", value = MoveTask.class),
@Type(name = "archive", value = ArchiveTask.class),
@Type(name = "restore", value = RestoreTask.class),
@Type(name = "index", value = IndexTask.class),
@Type(name = MoveTask.TYPE, value = MoveTask.class),
@Type(name = ArchiveTask.TYPE, value = ArchiveTask.class),
@Type(name = RestoreTask.TYPE, value = RestoreTask.class),
@Type(name = IndexTask.TYPE, value = IndexTask.class),
@Type(name = ParallelIndexSupervisorTask.TYPE, value = ParallelIndexSupervisorTask.class),
@Type(name = SinglePhaseSubTask.TYPE, value = SinglePhaseSubTask.class),
// for backward compatibility
Expand All @@ -80,11 +80,11 @@
@Type(name = PartialRangeSegmentGenerateTask.TYPE, value = PartialRangeSegmentGenerateTask.class),
@Type(name = PartialDimensionDistributionTask.TYPE, value = PartialDimensionDistributionTask.class),
@Type(name = PartialGenericSegmentMergeTask.TYPE, value = PartialGenericSegmentMergeTask.class),
@Type(name = "index_hadoop", value = HadoopIndexTask.class),
@Type(name = "index_realtime", value = RealtimeIndexTask.class),
@Type(name = "index_realtime_appenderator", value = AppenderatorDriverRealtimeIndexTask.class),
@Type(name = "noop", value = NoopTask.class),
@Type(name = "compact", value = CompactionTask.class)
@Type(name = HadoopIndexTask.TYPE, value = HadoopIndexTask.class),
@Type(name = RealtimeIndexTask.TYPE, value = RealtimeIndexTask.class),
@Type(name = AppenderatorDriverRealtimeIndexTask.TYPE, value = AppenderatorDriverRealtimeIndexTask.class),
@Type(name = NoopTask.TYPE, value = NoopTask.class),
@Type(name = CompactionTask.TYPE, value = CompactionTask.class)
})
public interface Task
{
Expand Down

0 comments on commit 736a2ab

Please sign in to comment.