View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.giraph.bsp;
20  
21  import java.util.List;
22  
23  import org.apache.giraph.job.JobProgressTracker;
24  import org.apache.giraph.master.MasterInfo;
25  import org.apache.giraph.worker.WorkerInfo;
26  import org.apache.hadoop.io.Writable;
27  import org.apache.hadoop.io.WritableComparable;
28  
29  /**
30   * Basic service interface shared by both {@link CentralizedServiceMaster} and
31   * {@link CentralizedServiceWorker}.
32   *
33   * @param <I> Vertex id
34   * @param <V> Vertex value
35   * @param <E> Edge value
36   */
37  @SuppressWarnings("rawtypes")
38  public interface CentralizedService<I extends WritableComparable,
39      V extends Writable, E extends Writable> {
40  
41  
42    /**
43     * Get the current global superstep of the application to work on.
44     *
45     * @return global superstep (begins at INPUT_SUPERSTEP)
46     */
47    long getSuperstep();
48  
49    /**
50     * Get the restarted superstep
51     *
52     * @return -1 if not manually restarted, otherwise the superstep id
53     */
54    long getRestartedSuperstep();
55  
56    /**
57     * Get list of workers
58     *
59     * @return List of workers
60     */
61    List<WorkerInfo> getWorkerInfoList();
62  
63    /**
64     * Get master info
65     *
66     * @return Master info
67     */
68    MasterInfo getMasterInfo();
69  
70    /**
71     * Get JobProgressTracker to report progress to
72     *
73     * @return JobProgressTrackerClient
74     */
75    JobProgressTracker getJobProgressTracker();
76  }