public StepInstance getStepInstanceView(
      String workflowId, long workflowInstanceId, String stepId) {
    StepInstance ret =
        withMetricLogError(
            () ->
                withRetryableQuery(
                    GET_STEP_INSTANCE_VIEW_QUERY,
                    stmt -> {
                      int idx = 0;
                      stmt.setString(++idx, workflowId);
                      stmt.setLong(++idx, workflowInstanceId);
                      stmt.setString(++idx, stepId);
                    },
                    result -> {
                      if (result.next()) {
                        return maestroStepFromResult(result);
                      }
                      return null;
                    }),
            "getStepInstanceView",
            "Failed to get the step instance view for [{}][{}][{}]",
            workflowId,
            workflowInstanceId,
            stepId);
    if (ret == null) {
      throw new MaestroNotFoundException(
          "step instance view for [%s][%s][%s] not found (either not created or deleted)",
          workflowId, workflowInstanceId, stepId);
    }
    return ret;
  }
@Test
  public void testGetStepInstanceView() throws Exception {
    si = loadObject("fixtures/instances/sample-step-instance-finishing.json", StepInstance.class);
    stepDao.insertOrUpsertStepInstance(si, true);
    si = loadObject("fixtures/instances/sample-step-instance-failed.json", StepInstance.class);
    stepDao.insertOrUpsertStepInstance(si, true);
    StepInstance instance = stepDao.getStepInstanceView("sample-dag-test-3", 1L, "job1");
    assertEquals(2L, instance.getWorkflowRunId());
    assertEquals(2L, instance.getStepAttemptId());
    assertEquals(StepInstance.Status.FINISHING, instance.getRuntimeState().getStatus());
  }