odps-console-basic/src/main/java/com/aliyun/openservices/odps/console/commands/FreezeCommand.java [58:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected void run() throws OdpsException, ODPSConsoleException {
    ExecutionContext context = getContext();
    DefaultOutputWriter writer = context.getOutputWriter();

    // do retry
    int retryTime = context.getRetryTimes();
    retryTime = retryTime > 0 ? retryTime : 1;
    while (true) {
      try {
        MergeTask task;
        String taskName = "console_cold_storage_freeze_task_"
            + Calendar.getInstance().getTimeInMillis();
        task = new MergeTask(taskName, getCommandText());

        HashMap<String, String> taskConfig = QueryUtil.getTaskConfig();
        addSetting(taskConfig, Collections.singletonMap("odps.merge.cold.storage.mode", "backup"));

        for (Entry<String, String> property : taskConfig.entrySet()) {
          task.setProperty(property.getKey(), property.getValue());
        }

        runJob(task);
        // on success
        writer.writeError("OK");
        break;
      } catch (UserInterruptException e) {
        throw e;
      } catch (Exception e) {
        if (--retryTime <= 0) {
          throw new ODPSConsoleException(e.getMessage());
        }
        writer.writeError("retry " + retryTime);
        writer.writeDebug(StringUtils.stringifyException(e));
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



odps-console-basic/src/main/java/com/aliyun/openservices/odps/console/commands/RestoreCommand.java [58:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  protected void run() throws OdpsException, ODPSConsoleException {
    ExecutionContext context = getContext();
    DefaultOutputWriter writer = context.getOutputWriter();

    // do retry
    int retryTime = context.getRetryTimes();
    retryTime = retryTime > 0 ? retryTime : 1;
    while (true) {
      try {
        MergeTask task;
        String taskName = "console_cold_storage_restore_task_"
            + Calendar.getInstance().getTimeInMillis();
        task = new MergeTask(taskName, getCommandText());

        HashMap<String, String> taskConfig = QueryUtil.getTaskConfig();
        addSetting(taskConfig, Collections.singletonMap("odps.merge.cold.storage.mode", "restore"));

        for (Entry<String, String> property : taskConfig.entrySet()) {
          task.setProperty(property.getKey(), property.getValue());
        }

        runJob(task);
        // on success
        writer.writeError("OK");
        break;
      } catch (UserInterruptException e) {
        throw e;
      } catch (Exception e) {
        if (--retryTime <= 0) {
          throw new ODPSConsoleException(e.getMessage());
        }
        writer.writeError("retry " + retryTime);
        writer.writeDebug(StringUtils.stringifyException(e));
      }
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



