This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GIRAPH-980 Way to disable checkpoints for particular job and on parti…
…cular supersteps Summary: Added CheckpointSupportedChecker, using this interface one can specify whether the job is checkpointable or not. By default all jobs that don't do output during the computation are checkpointable. Test Plan: Run several jobs with output during the computation enabled and disabled. Also wrote custom CheckpointSupportedChecker to test if I can disable checkpoints on particular superstep Reviewers: majakabiljo, pavanka, pavanka.26, maja.kabiljo Reviewed By: maja.kabiljo Differential Revision: https://reviews.facebook.net/D31113
- Loading branch information
Sergey Edunov
committed
Jan 14, 2015
1 parent
5a58a77
commit 8af7670
Showing
13 changed files
with
216 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
giraph-core/src/main/java/org/apache/giraph/bsp/checkpoints/CheckpointSupportedChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.giraph.bsp.checkpoints; | ||
|
||
import org.apache.giraph.conf.GiraphConfiguration; | ||
import org.apache.giraph.master.MasterCompute; | ||
|
||
/** | ||
* To prevent accidental checkpointing of non-checkpointable app | ||
* you may provide implementation of this interface. Most apps are | ||
* checkpointable by default, however some apps are not checkpointable, | ||
* e.g. apps that use static variables to pass data around between supersteps | ||
* or start new threads or use external resources. This interface allows | ||
* you to specify if and when your app is checkpointable. | ||
*/ | ||
public interface CheckpointSupportedChecker { | ||
|
||
/** | ||
* Does the job support checkpoints? | ||
* It is true by default, set it to false if your job uses some | ||
* non-checkpointable features: | ||
* - static variables for storing data between supersteps. | ||
* - starts new threads or uses Timers | ||
* - writes output before job is complete, etc | ||
* This method is called on master and has access to | ||
* job configuration and master compute. | ||
* | ||
* @param conf giraph configuration | ||
* @param masterCompute instance of master compute | ||
* @return true if checkpointing on current superstep is supported | ||
* by this application. | ||
*/ | ||
boolean isCheckpointSupported(GiraphConfiguration conf, | ||
MasterCompute masterCompute); | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...re/src/main/java/org/apache/giraph/bsp/checkpoints/DefaultCheckpointSupportedChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.giraph.bsp.checkpoints; | ||
|
||
import org.apache.giraph.conf.GiraphConfiguration; | ||
import org.apache.giraph.master.MasterCompute; | ||
|
||
/** | ||
* Default checkpoint supported checker. | ||
* Most tasks will support checkpointing by default unless they do output | ||
* during the computation. Some tasks however can use non-checkpointable | ||
* features, e.g.: static variables to pass data around between supersteps | ||
* or new threads started from MasterCompute or external resources. In that | ||
* case to prevent accidental checkpointing you should provide checker | ||
* implementation. | ||
*/ | ||
public class DefaultCheckpointSupportedChecker | ||
implements CheckpointSupportedChecker { | ||
@Override | ||
public boolean isCheckpointSupported(GiraphConfiguration conf, | ||
MasterCompute masterCompute) { | ||
return !conf.doOutputDuringComputation(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...e/src/main/java/org/apache/giraph/bsp/checkpoints/DisabledCheckpointSupportedChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.giraph.bsp.checkpoints; | ||
|
||
import org.apache.giraph.conf.GiraphConfiguration; | ||
import org.apache.giraph.master.MasterCompute; | ||
|
||
/** | ||
* Disable all checkpoints. | ||
*/ | ||
public class DisabledCheckpointSupportedChecker | ||
implements CheckpointSupportedChecker { | ||
|
||
@Override | ||
public boolean isCheckpointSupported(GiraphConfiguration conf, | ||
MasterCompute masterCompute) { | ||
return false; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
giraph-core/src/main/java/org/apache/giraph/bsp/checkpoints/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* Package of generic bulk synchronous processing objects. | ||
*/ | ||
package org.apache.giraph.bsp.checkpoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters