zwangsheng commented on code in PR #1830: URL: https://github.com/apache/incubator-celeborn/pull/1830#discussion_r1319314479
########## client-mr/mr/src/main/java/org/apache/celeborn/mapreduce/v2/app/MRAppMasterWithCeleborn.java: ########## @@ -0,0 +1,172 @@ +/* + * 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.celeborn.mapreduce.v2.app; + +import java.io.IOException; + +import org.apache.hadoop.fs.FSDataOutputStream; +import org.apache.hadoop.fs.FileStatus; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.ipc.CallerContext; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapreduce.JobSubmissionFiles; +import org.apache.hadoop.mapreduce.MRJobConfig; +import org.apache.hadoop.mapreduce.v2.app.MRAppMaster; +import org.apache.hadoop.mapreduce.v2.util.MRApps; +import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil; +import org.apache.hadoop.util.ExitUtil; +import org.apache.hadoop.util.ShutdownHookManager; +import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler; +import org.apache.hadoop.yarn.api.ApplicationConstants; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +import org.apache.hadoop.yarn.api.records.ContainerId; +import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.celeborn.client.LifecycleManager; +import org.apache.celeborn.common.CelebornConf; +import org.apache.celeborn.common.exception.CelebornIOException; +import org.apache.celeborn.util.HadoopUtils; + +public class MRAppMasterWithCeleborn extends MRAppMaster { + private static final Logger logger = LoggerFactory.getLogger(MRAppMasterWithCeleborn.class); + + public MRAppMasterWithCeleborn( + ApplicationAttemptId applicationAttemptId, + ContainerId containerId, + String nmHost, + int nmPort, + int nmHttpPort, + long appSubmitTime, + JobConf jobConf) + throws CelebornIOException { + super(applicationAttemptId, containerId, nmHost, nmPort, nmHttpPort, appSubmitTime); + + int numReducers = jobConf.getInt(MRJobConfig.NUM_REDUCES, 0); + if (numReducers > 0) { + CelebornConf conf = HadoopUtils.fromYarnConf(jobConf); + LifecycleManager lifecycleManager = + new LifecycleManager(applicationAttemptId.toString(), conf); + String lmHost = lifecycleManager.getHost(); + int lmPort = lifecycleManager.getPort(); + logger.info("RMAppMaster initialized with {} {} {}", lmHost, lmPort, applicationAttemptId); + JobConf lmConf = new JobConf(); + lmConf.clear(); + lmConf.set(HadoopUtils.MR_CELEBORN_LM_HOST, lmHost); + lmConf.set(HadoopUtils.MR_CELEBORN_LM_PORT, lmPort + ""); + lmConf.set(HadoopUtils.MR_CELEBORN_APPLICATION_ID, applicationAttemptId.toString()); + writeLifecycleManagerConfToTask(jobConf, lmConf); + } + } + + void writeLifecycleManagerConfToTask(JobConf conf, JobConf lmConf) throws CelebornIOException { Review Comment: If there is no need for external exposure, you should use `private` grooming. ########## client-mr/mr/src/main/java/org/apache/hadoop/mapred/CelebornSortBasedPusher.java: ########## @@ -0,0 +1,336 @@ +/* + * 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.hadoop.mapred; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.hadoop.io.RawComparator; +import org.apache.hadoop.io.WritableUtils; +import org.apache.hadoop.io.serializer.Serializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.celeborn.client.ShuffleClient; +import org.apache.celeborn.common.CelebornConf; +import org.apache.celeborn.common.unsafe.Platform; +import org.apache.celeborn.common.util.Utils; + +public class CelebornSortBasedPusher<K, V> extends OutputStream { + final Logger logger = LoggerFactory.getLogger(CelebornSortBasedPusher.class); Review Comment: ditto -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
