forked from apache-spark-on-k8s/spark
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-25299] Introduce the new shuffle writer API (#5) (apache-spark…
…-on-k8s#520) Introduces the new Shuffle Writer API. Ported from #5.
- Loading branch information
1 parent
ef563da
commit e37f5ac
Showing
5 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
core/src/main/java/org/apache/spark/api/shuffle/ShuffleDataIO.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,31 @@ | ||
/* | ||
* 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.spark.api.shuffle; | ||
|
||
import org.apache.spark.annotation.Experimental; | ||
|
||
/** | ||
* :: Experimental :: | ||
* An interface for launching Shuffle related components | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Experimental | ||
public interface ShuffleDataIO { | ||
ShuffleExecutorComponents executor(); | ||
} |
33 changes: 33 additions & 0 deletions
33
core/src/main/java/org/apache/spark/api/shuffle/ShuffleExecutorComponents.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,33 @@ | ||
/* | ||
* 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.spark.api.shuffle; | ||
|
||
import org.apache.spark.annotation.Experimental; | ||
|
||
/** | ||
* :: Experimental :: | ||
* An interface for building shuffle support for Executors | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Experimental | ||
public interface ShuffleExecutorComponents { | ||
void intitializeExecutor(String appId, String execId); | ||
|
||
ShuffleWriteSupport writes(); | ||
} |
37 changes: 37 additions & 0 deletions
37
core/src/main/java/org/apache/spark/api/shuffle/ShuffleMapOutputWriter.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,37 @@ | ||
/* | ||
* 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.spark.api.shuffle; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.spark.annotation.Experimental; | ||
|
||
/** | ||
* :: Experimental :: | ||
* An interface for creating and managing shuffle partition writers | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Experimental | ||
public interface ShuffleMapOutputWriter { | ||
ShufflePartitionWriter getNextPartitionWriter() throws IOException; | ||
|
||
void commitAllPartitions() throws IOException; | ||
|
||
void abort(Throwable error) throws IOException; | ||
} |
42 changes: 42 additions & 0 deletions
42
core/src/main/java/org/apache/spark/api/shuffle/ShufflePartitionWriter.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,42 @@ | ||
/* | ||
* 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.spark.api.shuffle; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.nio.channels.Channels; | ||
import java.nio.channels.WritableByteChannel; | ||
|
||
import org.apache.http.annotation.Experimental; | ||
|
||
/** | ||
* :: Experimental :: | ||
* An interface for giving streams / channels for shuffle writes | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Experimental | ||
public interface ShufflePartitionWriter { | ||
OutputStream openStream() throws IOException; | ||
|
||
long getLength(); | ||
|
||
default WritableByteChannel openChannel() throws IOException { | ||
return Channels.newChannel(openStream()); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
core/src/main/java/org/apache/spark/api/shuffle/ShuffleWriteSupport.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,37 @@ | ||
/* | ||
* 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.spark.api.shuffle; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.http.annotation.Experimental; | ||
|
||
/** | ||
* :: Experimental :: | ||
* An interface for deploying a shuffle map output writer | ||
* | ||
* @since 3.0.0 | ||
*/ | ||
@Experimental | ||
public interface ShuffleWriteSupport { | ||
ShuffleMapOutputWriter createMapOutputWriter( | ||
String appId, | ||
int shuffleId, | ||
int mapId, | ||
int numPartitions) throws IOException; | ||
} |