update code style for task type (#16343)

* update code style for task type

* address the comments
This commit is contained in:
Alberic Liu 2024-04-29 14:42:55 -07:00 committed by GitHub
parent aa46314971
commit 736a2ab7c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 24 additions and 20 deletions

View File

@ -122,6 +122,7 @@ import java.util.concurrent.TimeoutException;
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);
@ -217,7 +218,7 @@ public class AppenderatorDriverRealtimeIndexTask extends AbstractTask
@Override
public String getType()
{
return "index_realtime_appenderator";
return TYPE;
}
@Override

View File

@ -40,6 +40,7 @@ import java.util.Set;
public class ArchiveTask extends AbstractFixedIntervalTask
{
public static final String TYPE = "archive";
private static final Logger log = new Logger(ArchiveTask.class);
public ArchiveTask(
@ -60,7 +61,7 @@ public class ArchiveTask extends AbstractFixedIntervalTask
@Override
public String getType()
{
return "archive";
return TYPE;
}
@Nonnull

View File

@ -129,6 +129,7 @@ import java.util.stream.IntStream;
*/
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();
@ -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 {

View File

@ -94,10 +94,10 @@ import java.util.stream.Collectors;
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)
@ -192,7 +192,7 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler
@Override
public String getType()
{
return "index_hadoop";
return TYPE;
}
@Nonnull

View File

@ -141,7 +141,6 @@ import java.util.stream.Collectors;
public class IndexTask extends AbstractBatchIndexTask implements ChatHandler, PendingSegmentAllocatingTask
{
public static final HashFunction HASH_FUNCTION = Hashing.murmur3_128();
public static final String TYPE = "index";

View File

@ -41,6 +41,7 @@ import java.util.Set;
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;
@ -68,7 +69,7 @@ public class MoveTask extends AbstractFixedIntervalTask
@Override
public String getType()
{
return "move";
return TYPE;
}
@Nonnull

View File

@ -41,6 +41,7 @@ import java.util.UUID;
*/
public class NoopTask extends AbstractTask implements PendingSegmentAllocatingTask
{
public static final String TYPE = "noop";
private static final int DEFAULT_RUN_TIME = 2500;
@JsonIgnore
@ -70,7 +71,7 @@ public class NoopTask extends AbstractTask implements PendingSegmentAllocatingTa
@Override
public String getType()
{
return "noop";
return TYPE;
}
@Nonnull

View File

@ -85,6 +85,7 @@ import java.util.concurrent.ThreadLocalRandom;
@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);
@ -180,7 +181,7 @@ public class RealtimeIndexTask extends AbstractTask
@Override
public String getType()
{
return "index_realtime";
return TYPE;
}
@Override

View File

@ -41,6 +41,7 @@ import java.util.Set;
public class RestoreTask extends AbstractFixedIntervalTask
{
public static final String TYPE = "restore";
private static final Logger log = new Logger(RestoreTask.class);
public RestoreTask(
@ -61,7 +62,7 @@ public class RestoreTask extends AbstractFixedIntervalTask
@Override
public String getType()
{
return "restore";
return TYPE;
}
@Nonnull

View File

@ -67,10 +67,10 @@ import java.util.Set;
@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
@ -80,11 +80,11 @@ import java.util.Set;
@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
{