code: private TaskRecord waitForTaskStatus(Tenant tenant, Task task, Predicate<TaskStatus> pred) {
          TaskRecord taskRecord = null;
          while (true) {
              Iterator<DColumn> colIter =
                  DBService.instance(tenant).getAllColumns(TaskManagerService.TASKS_STORE_NAME, task.getTaskID()).iterator();
              if (!colIter.hasNext()) {
                  taskRecord = storeTaskRecord(tenant, task);
              } else {
                  taskRecord = buildTaskRecord(task.getTaskID(), colIter);
              }
              if (pred.test(taskRecord.getStatus())) {
                  break;
              }
              try { Thread.sleep(TASK_CHECK_MILLIS); } catch (InterruptedException e) { }
          };
          return taskRecord;
      }
docs: latest status record. If it has never run, a never-run task record is stored.