zaynt4606 commented on code in PR #3091: URL: https://github.com/apache/celeborn/pull/3091#discussion_r1957668637
########## verifier/src/main/scala/org/apache/celeborn/verifier/conf/VerifierConf.scala: ########## @@ -0,0 +1,116 @@ +/* + * 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.verifier.conf + +import java.io.File +import java.util + +import org.apache.celeborn.common.CelebornConf +import org.apache.celeborn.common.rpc.RpcAddress +import org.apache.celeborn.common.util.Utils + +class VerifierConf { + + val celebornConf = new CelebornConf() + private val settings = new util.HashMap[String, String]() + + def get(key: String, defaultValue: String): String = { + Option(settings.get(key)).getOrElse(defaultValue) + } + + def set(key: String, value: String): Unit = { + settings.put(key, value) + } +} + +object VerifierConf { + + private val defaultScriptsLocation: String = + sys.env.get("CELEBORN_HOME").map { t => s"$t${File.separator}sbin" } + .map { t => new File(s"$t") } + .filter(_.isFile) + .map(_.getAbsolutePath) + .orNull + + def schedulerAddress(conf: VerifierConf): RpcAddress = { + val parts = conf.get( + "verf.scheduler.address", + s"${Utils.localHostName(conf.celebornConf)}:19097").split(":") + RpcAddress(parts(0), parts(1).toInt) + } + + def runnerTestMode(conf: VerifierConf): Boolean = { + conf.get("verf.runner.test.mode", "false").toBoolean + } + + def runnerTimeOutMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.timeout", "120s")) + } + + def runnerRegisterRetryDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.register.retry.delay", "5s")) + } + + def runnerHeartBeatDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.delay", "30s")) + } + + def runnerHeartBeatIntervalMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.interval", "30s")) + } + + def planActionBadInflightFile(conf: VerifierConf): String = { + conf.get("verf.plan.action.block.bad.inflight.location", s"/root/badblock/inflight") + } + + def planActionDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.default.interval", "5s") + } + + def planActionOccupyCpuMaxDurationMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.plan.action.occupycpu.maxduration", "120s")) + } + + def planActionSelectorDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.selector.default.interval", "5s") + } + + def startMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.start.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def stopMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.stop.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def startWorkerScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.worker.start.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") Review Comment: `start-worker.sh` ########## verifier/src/main/scala/org/apache/celeborn/verifier/conf/VerifierConf.scala: ########## @@ -0,0 +1,116 @@ +/* + * 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.verifier.conf + +import java.io.File +import java.util + +import org.apache.celeborn.common.CelebornConf +import org.apache.celeborn.common.rpc.RpcAddress +import org.apache.celeborn.common.util.Utils + +class VerifierConf { + + val celebornConf = new CelebornConf() + private val settings = new util.HashMap[String, String]() + + def get(key: String, defaultValue: String): String = { + Option(settings.get(key)).getOrElse(defaultValue) + } + + def set(key: String, value: String): Unit = { + settings.put(key, value) + } +} + +object VerifierConf { + + private val defaultScriptsLocation: String = + sys.env.get("CELEBORN_HOME").map { t => s"$t${File.separator}sbin" } + .map { t => new File(s"$t") } + .filter(_.isFile) + .map(_.getAbsolutePath) + .orNull + + def schedulerAddress(conf: VerifierConf): RpcAddress = { + val parts = conf.get( + "verf.scheduler.address", + s"${Utils.localHostName(conf.celebornConf)}:19097").split(":") + RpcAddress(parts(0), parts(1).toInt) + } + + def runnerTestMode(conf: VerifierConf): Boolean = { + conf.get("verf.runner.test.mode", "false").toBoolean + } + + def runnerTimeOutMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.timeout", "120s")) + } + + def runnerRegisterRetryDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.register.retry.delay", "5s")) + } + + def runnerHeartBeatDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.delay", "30s")) + } + + def runnerHeartBeatIntervalMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.interval", "30s")) + } + + def planActionBadInflightFile(conf: VerifierConf): String = { + conf.get("verf.plan.action.block.bad.inflight.location", s"/root/badblock/inflight") + } + + def planActionDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.default.interval", "5s") + } + + def planActionOccupyCpuMaxDurationMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.plan.action.occupycpu.maxduration", "120s")) + } + + def planActionSelectorDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.selector.default.interval", "5s") + } + + def startMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.start.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def stopMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.stop.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def startWorkerScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.worker.start.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def stopWorkerScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.worker.stop.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") Review Comment: `stop-worker.sh` ########## verifier/pom.xml: ########## @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.celeborn</groupId> + <artifactId>celeborn-parent_${scala.binary.version}</artifactId> + <version>${project.version}</version> + </parent> + + <artifactId>celeborn-verifier_${scala.binary.version}</artifactId> + <packaging>jar</packaging> + <name>Celeborn Verifier</name> + + <dependencies> + <dependency> + <groupId>org.apache.celeborn</groupId> + <artifactId>celeborn-common_${scala.binary.version}</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.ratis</groupId> + <artifactId>ratis-common</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.ratis</groupId> + <artifactId>ratis-client</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.alibaba.fastjson2</groupId> + <artifactId>fastjson2</artifactId> + </dependency> Review Comment: need to add log dependencies ` <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-1.2-api</artifactId> </dependency>` ########## verifier/src/main/scala/org/apache/celeborn/verifier/conf/VerifierConf.scala: ########## @@ -0,0 +1,116 @@ +/* + * 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.verifier.conf + +import java.io.File +import java.util + +import org.apache.celeborn.common.CelebornConf +import org.apache.celeborn.common.rpc.RpcAddress +import org.apache.celeborn.common.util.Utils + +class VerifierConf { + + val celebornConf = new CelebornConf() + private val settings = new util.HashMap[String, String]() + + def get(key: String, defaultValue: String): String = { + Option(settings.get(key)).getOrElse(defaultValue) + } + + def set(key: String, value: String): Unit = { + settings.put(key, value) + } +} + +object VerifierConf { + + private val defaultScriptsLocation: String = + sys.env.get("CELEBORN_HOME").map { t => s"$t${File.separator}sbin" } + .map { t => new File(s"$t") } + .filter(_.isFile) + .map(_.getAbsolutePath) + .orNull + + def schedulerAddress(conf: VerifierConf): RpcAddress = { + val parts = conf.get( + "verf.scheduler.address", + s"${Utils.localHostName(conf.celebornConf)}:19097").split(":") + RpcAddress(parts(0), parts(1).toInt) + } + + def runnerTestMode(conf: VerifierConf): Boolean = { + conf.get("verf.runner.test.mode", "false").toBoolean + } + + def runnerTimeOutMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.timeout", "120s")) + } + + def runnerRegisterRetryDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.register.retry.delay", "5s")) + } + + def runnerHeartBeatDelayMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.delay", "30s")) + } + + def runnerHeartBeatIntervalMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.runner.heartbeat.interval", "30s")) + } + + def planActionBadInflightFile(conf: VerifierConf): String = { + conf.get("verf.plan.action.block.bad.inflight.location", s"/root/badblock/inflight") + } + + def planActionDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.default.interval", "5s") + } + + def planActionOccupyCpuMaxDurationMs(conf: VerifierConf): Long = { + Utils.timeStringAsMs(conf.get("verf.plan.action.occupycpu.maxduration", "120s")) + } + + def planActionSelectorDefaultInterval(conf: VerifierConf): String = { + conf.get("verf.plan.action.selector.default.interval", "5s") + } + + def startMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.start.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") + } + + def stopMasterScript(conf: VerifierConf): String = { + conf.get( + "verf.scripts.master.stop.script", + s"$defaultScriptsLocation${File.separator}start-master.sh") Review Comment: should be `stop-master.sh` -- 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]
