mirror of
https://github.com/wassname/ray.git
synced 2026-07-01 17:11:05 +08:00
[java] change RayLog.core to org.slf4j.Logger (#3579)
This commit is contained in:
@@ -5,7 +5,6 @@ import org.ray.api.id.UniqueId;
|
||||
import org.ray.runtime.functionmanager.RayFunction;
|
||||
import org.ray.runtime.task.ArgumentsBuilder;
|
||||
import org.ray.runtime.task.TaskSpec;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -63,9 +62,9 @@ public class Worker {
|
||||
} else {
|
||||
runtime.localActors.put(returnId, result);
|
||||
}
|
||||
RayLog.core.info("Finished executing task {}", spec.taskId);
|
||||
LOGGER.info("Finished executing task {}", spec.taskId);
|
||||
} catch (Exception e) {
|
||||
RayLog.core.error("Error executing task " + spec, e);
|
||||
LOGGER.error("Error executing task " + spec, e);
|
||||
runtime.put(returnId, new RayException("Error executing task " + spec, e));
|
||||
} finally {
|
||||
Thread.currentThread().setContextClassLoader(oldLoader);
|
||||
|
||||
@@ -11,13 +11,15 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.ray.api.id.UniqueId;
|
||||
import org.ray.runtime.generated.ClientTableData;
|
||||
import org.ray.runtime.util.NetworkUtil;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A class used to interface with the Ray control state.
|
||||
*/
|
||||
public class StateStoreProxyImpl implements StateStoreProxy {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StateStoreProxyImpl.class);
|
||||
public KeyValueStoreLink rayKvStore;
|
||||
public ArrayList<KeyValueStoreLink> shardStoreList = new ArrayList<>();
|
||||
|
||||
@@ -87,11 +89,11 @@ public class StateStoreProxyImpl implements StateStoreProxy {
|
||||
return doGetAddressInfo(nodeIpAddress, redisAddress);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
RayLog.core.warn("Error occurred in StateStoreProxyImpl getAddressInfo, "
|
||||
+ (numRetries - count) + " retries remaining", e);
|
||||
LOGGER.warn("Error occurred in StateStoreProxyImpl getAddressInfo, {} retries remaining",
|
||||
(numRetries - count), e);
|
||||
TimeUnit.MILLISECONDS.sleep(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
RayLog.core.error("error at StateStoreProxyImpl getAddressInfo", e);
|
||||
LOGGER.error("error at StateStoreProxyImpl getAddressInfo", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,15 @@ import org.apache.arrow.plasma.ObjectStoreLink;
|
||||
import org.ray.api.id.UniqueId;
|
||||
import org.ray.runtime.RayDevRuntime;
|
||||
import org.ray.runtime.raylet.MockRayletClient;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A mock implementation of {@code org.ray.spi.ObjectStoreLink}, which use Map to store data.
|
||||
*/
|
||||
public class MockObjectStore implements ObjectStoreLink {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MockObjectStore.class);
|
||||
private final RayDevRuntime runtime;
|
||||
private final Map<UniqueId, byte[]> data = new ConcurrentHashMap<>();
|
||||
private final Map<UniqueId, byte[]> metadata = new ConcurrentHashMap<>();
|
||||
@@ -28,8 +30,8 @@ public class MockObjectStore implements ObjectStoreLink {
|
||||
@Override
|
||||
public void put(byte[] objectId, byte[] value, byte[] metadataValue) {
|
||||
if (objectId == null || objectId.length == 0 || value == null) {
|
||||
RayLog.core
|
||||
.error(logPrefix() + "cannot put null: " + objectId + "," + Arrays.toString(value));
|
||||
LOGGER
|
||||
.error("{} cannot put null: {}, {}", logPrefix(), objectId, Arrays.toString(value));
|
||||
System.exit(-1);
|
||||
}
|
||||
UniqueId uniqueId = new UniqueId(objectId);
|
||||
@@ -48,7 +50,7 @@ public class MockObjectStore implements ObjectStoreLink {
|
||||
ArrayList<byte[]> rets = new ArrayList<>(objectIds.length);
|
||||
for (byte[] objId : objectIds) {
|
||||
UniqueId uniqueId = new UniqueId(objId);
|
||||
RayLog.core.info(logPrefix() + " is notified for objectid " + uniqueId);
|
||||
LOGGER.info("{} is notified for objectid {}",logPrefix(), uniqueId);
|
||||
rets.add(dataMap.get(uniqueId));
|
||||
}
|
||||
return rets;
|
||||
|
||||
@@ -20,10 +20,13 @@ import org.ray.runtime.generated.TaskInfo;
|
||||
import org.ray.runtime.task.FunctionArg;
|
||||
import org.ray.runtime.task.TaskSpec;
|
||||
import org.ray.runtime.util.UniqueIdUtil;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RayletClientImpl implements RayletClient {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RayletClientImpl.class);
|
||||
|
||||
private static final int TASK_SPEC_BUFFER_SIZE = 2 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
@@ -70,7 +73,7 @@ public class RayletClientImpl implements RayletClient {
|
||||
|
||||
@Override
|
||||
public void submitTask(TaskSpec spec) {
|
||||
RayLog.core.debug("Submitting task: {}", spec);
|
||||
LOGGER.debug("Submitting task: {}", spec);
|
||||
ByteBuffer info = convertTaskSpecToFlatbuffer(spec);
|
||||
byte[] cursorId = null;
|
||||
if (!spec.getExecutionDependencies().isEmpty()) {
|
||||
@@ -91,8 +94,8 @@ public class RayletClientImpl implements RayletClient {
|
||||
@Override
|
||||
public void fetchOrReconstruct(List<UniqueId> objectIds, boolean fetchOnly,
|
||||
UniqueId currentTaskId) {
|
||||
if (RayLog.core.isDebugEnabled()) {
|
||||
RayLog.core.debug("Blocked on objects for task {}, object IDs are {}",
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Blocked on objects for task {}, object IDs are {}",
|
||||
UniqueIdUtil.computeTaskId(objectIds.get(0)), objectIds);
|
||||
}
|
||||
int ret = nativeFetchOrReconstruct(client, UniqueIdUtil.getIdBytes(objectIds),
|
||||
@@ -254,9 +257,9 @@ public class RayletClientImpl implements RayletClient {
|
||||
ByteBuffer buffer = fbb.dataBuffer();
|
||||
|
||||
if (buffer.remaining() > TASK_SPEC_BUFFER_SIZE) {
|
||||
RayLog.core.error(
|
||||
"Allocated buffer is not enough to transfer the task specification: "
|
||||
+ TASK_SPEC_BUFFER_SIZE + " vs " + buffer.remaining());
|
||||
LOGGER.error(
|
||||
"Allocated buffer is not enough to transfer the task specification: {}vs {}",
|
||||
TASK_SPEC_BUFFER_SIZE, buffer.remaining());
|
||||
assert (false);
|
||||
}
|
||||
return buffer;
|
||||
|
||||
@@ -7,10 +7,13 @@ import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.ServerSocket;
|
||||
import java.util.Enumeration;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NetworkUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NetworkUtil.class);
|
||||
|
||||
public static String getIpAddress(String interfaceName) {
|
||||
try {
|
||||
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||
@@ -35,9 +38,9 @@ public class NetworkUtil {
|
||||
return addr.getHostAddress();
|
||||
}
|
||||
}
|
||||
RayLog.core.warn("You need to correctly specify [ray.java] net_interface in config.");
|
||||
LOGGER.warn("You need to correctly specify [ray.java] net_interface in config.");
|
||||
} catch (Exception e) {
|
||||
RayLog.core.error("Can't get ip address, use 127.0.0.1 as default.", e);
|
||||
LOGGER.error("Can't get ip address, use 127.0.0.1 as default.", e);
|
||||
}
|
||||
|
||||
return "127.0.0.1";
|
||||
|
||||
@@ -2,15 +2,17 @@ package org.ray.runtime.util;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Sha1Digestor {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Sha1Digestor.class);
|
||||
private static final ThreadLocal<MessageDigest> md = ThreadLocal.withInitial(() -> {
|
||||
try {
|
||||
return MessageDigest.getInstance("SHA1");
|
||||
} catch (Exception e) {
|
||||
RayLog.core.error("Cannot get SHA1 MessageDigest", e);
|
||||
LOGGER.error("Cannot get SHA1 MessageDigest", e);
|
||||
throw new RuntimeException("Cannot get SHA1 digest", e);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,13 +3,16 @@ package org.ray.runtime.util;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import org.ray.runtime.util.logger.RayLog;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* some utilities for system process.
|
||||
*/
|
||||
public class SystemUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SystemUtil.class);
|
||||
|
||||
static final ReentrantLock pidlock = new ReentrantLock();
|
||||
static Integer pid;
|
||||
|
||||
@@ -34,7 +37,7 @@ public class SystemUtil {
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
RayLog.core.error("error at SystemUtil startWithJar", e);
|
||||
LOGGER.error("error at SystemUtil startWithJar", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user