Instances implements Iterable<Instance> { Instances(Odps odps) { this.odps = odps; this.client = odps.getRestClient(); } Instances(Odps odps); String getDefaultRunningCluster(); void setDefaultRunningCluster(String defaultRunningCluster); Instance create(Job job); Instance create(Task task); Instance create(Task task, int priority); Instance create(Task task, int priority, String runningCluster); Instance get(String id); Instance get(String projectName, String id); boolean exists(String id); boolean exists(String projectName, String id); Instance create(String projectName, Task task); Instance create(String projectName, Task task, int priority); Instance create(String projectName, Task task, int priority, String runningCluster); Instance create(String projectName, Task task, Integer priority, String runningCluster); Instance create(String projectName, Task task, Integer priority, String runningCluster,
                         String jobName); Iterator<Instance> iterator(); Iterator<Instance> iterator(final String project); Iterator<Instance> iterator(final InstanceFilter filter); Iterator<Instance> iterator(final String project,
                                     final InstanceFilter filter); Iterable<Instance> iterable(); Iterable<Instance> iterable(final String project); Iterable<Instance> iterable(final InstanceFilter filter); Iterable<Instance> iterable(final String project,
                                     final InstanceFilter filter); Iterator<Instance.InstanceQueueingInfo> iteratorQueueing(); Iterator<Instance.InstanceQueueingInfo> iteratorQueueing(String project); Iterator<Instance.InstanceQueueingInfo> iteratorQueueing(InstanceFilter filter); Iterator<Instance.InstanceQueueingInfo> iteratorQueueing(String project, InstanceFilter filter); Iterator<Instance.InstanceQueueingInfo> iteratorQueueing(
      String project, InstanceFilter filter, Integer maxItemsPerRequest);  }
@Test public void testList() throws OdpsException { int max = 50; for (Instance i : odps.instances()) { i.getId(); i.getOwner(); i.getStartTime(); i.getProject(); i.getTaskStatus(); i.getTaskResults(); --max; if (max < 0) { break; } } }
@Test public void testTaskResultsWithFormat() throws OdpsException { int max = 50; for (Instance i : odps.instances()) { Map<String, Result> results = new HashMap<String, Result>(); try { results = i.getTaskResultsWithFormat(); } catch (Exception e) { e.printStackTrace(); } for (Result result : results.values()) { System.out.println(result.getFormat()); } --max; if (max < 0) { break; } } }