private void registerTasks(StateMachineEngine engine, List<AmbryStatsReport> statsReports,
      AccountStatsStore accountStatsStore, Callback<AggregatedAccountStorageStats> callback) {
    //Register MySqlReportAggregatorTask
    Map<String, TaskFactory> taskFactoryMap = new HashMap<>();
    for (final AmbryStatsReport statsReport : statsReports) {
      taskFactoryMap.put(
          String.format("%s_%s", MySqlReportAggregatorTask.TASK_COMMAND_PREFIX, statsReport.getReportName()),
          context -> new MySqlReportAggregatorTask(context.getManager(), statsReport.getAggregateIntervalInMinutes(),
              statsReport.getStatsReportType(), accountStatsStore, callback, clusterMapConfig, metricRegistry));
    }

    //Register PropertyStoreTask
    if(clusterMapConfig.clustermapEnablePropertyStoreCleanUpTask) {
      logger.info("Registering PropertyStoreCleanUpTask");
      taskFactoryMap.put(PropertyStoreCleanUpTask.COMMAND,
          context -> new PropertyStoreCleanUpTask(context.getManager(), dataNodeConfigSource, clusterMapConfig,
              metricRegistry));
    }

    //Register tasks
    if (!taskFactoryMap.isEmpty()) {
      engine.registerStateModelFactory(TaskConstants.STATE_MODEL_NAME,
          new TaskStateModelFactory(manager, taskFactoryMap));
    }
  }
This method will register Helix Tasks
Register aggregation tasks for appropriate {@link AmbryStatsReport}s and {@link PropertyStoreCleanUpTask}.
@param engine the {@link StateMachineEngine} to register the task state model.
@param statsReports the {@link List} of {@link AmbryStatsReport}s that may require the registration of
corresponding {@link MySqlReportAggregatorTask}s.
@param accountStatsStore the {@link AccountStatsStore} to retrieve and store container stats.
@param callback a callback which will be invoked when the aggregation report has been generated successfully.
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixParticipant.java