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 package org.apache.giraph.bsp.checkpoints;
19
20 import org.apache.giraph.conf.GiraphConfiguration;
21 import org.apache.giraph.master.MasterCompute;
22
23 /**
24 * To prevent accidental checkpointing of non-checkpointable app
25 * you may provide implementation of this interface. Most apps are
26 * checkpointable by default, however some apps are not checkpointable,
27 * e.g. apps that use static variables to pass data around between supersteps
28 * or start new threads or use external resources. This interface allows
29 * you to specify if and when your app is checkpointable.
30 */
31 public interface CheckpointSupportedChecker {
32
33 /**
34 * Does the job support checkpoints?
35 * It is true by default, set it to false if your job uses some
36 * non-checkpointable features:
37 * - static variables for storing data between supersteps.
38 * - starts new threads or uses Timers
39 * - writes output before job is complete, etc
40 * This method is called on master and has access to
41 * job configuration and master compute.
42 *
43 * @param conf giraph configuration
44 * @param masterCompute instance of master compute
45 * @return true if checkpointing on current superstep is supported
46 * by this application.
47 */
48 boolean isCheckpointSupported(GiraphConfiguration conf,
49 MasterCompute masterCompute);
50
51 }