This project has retired. For details please refer to its Attic page.
CentralizedService xref
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.conf.ImmutableClassesGiraphConfiguration;
24  import org.apache.giraph.job.JobProgressTracker;
25  import org.apache.giraph.master.MasterInfo;
26  import org.apache.giraph.worker.WorkerInfo;
27  import org.apache.hadoop.io.Writable;
28  import org.apache.hadoop.io.WritableComparable;
29  
30  /**
31   * Basic service interface shared by both {@link CentralizedServiceMaster} and
32   * {@link CentralizedServiceWorker}.
33   *
34   * @param <I> Vertex id
35   * @param <V> Vertex value
36   * @param <E> Edge value
37   */
38  @SuppressWarnings("rawtypes")
39  public interface CentralizedService<I extends WritableComparable,
40      V extends Writable, E extends Writable> {
41    /**
42     * Get the current global superstep of the application to work on.
43     *
44     * @return global superstep (begins at INPUT_SUPERSTEP)
45     */
46    long getSuperstep();
47  
48    /**
49     * Get the restarted superstep
50     *
51     * @return -1 if not manually restarted, otherwise the superstep id
52     */
53    long getRestartedSuperstep();
54  
55    /**
56     * Get list of workers
57     *
58     * @return List of workers
59     */
60    List<WorkerInfo> getWorkerInfoList();
61  
62    /**
63     * Get master info
64     *
65     * @return Master info
66     */
67    MasterInfo getMasterInfo();
68  
69    /**
70     * Get JobProgressTracker to report progress to
71     *
72     * @return JobProgressTrackerClient
73     */
74    JobProgressTracker getJobProgressTracker();
75  
76    /**
77     * Get configuration
78     * @return configuration
79     */
80    ImmutableClassesGiraphConfiguration<I, V, E> getConfiguration();
81  }