mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 02:01:24 +08:00
ef527f84ab
* Stream logs to driver by default. * Fix from rebase * Redirect raylet output independently of worker output. * Fix. * Create redis client with services.create_redis_client. * Suppress Redis connection error at exit. * Remove thread_safe_client from redis. * Shutdown driver threads in ray.shutdown(). * Add warning for too many log messages. * Only stop threads if worker is connected. * Only stop threads if they exist. * Remove unnecessary try/excepts. * Fix * Only add new logging handler once. * Increase timeout. * Fix tempfile test. * Fix logging in cluster_utils. * Revert "Increase timeout." This reverts commit b3846b89040bcd8e583b2e18cb513cb040e71d95. * Retry longer when connecting to plasma store from node manager and object manager. * Close pubsub channels to avoid leaking file descriptors. * Limit log monitor open files to 200. * Increase plasma connect retries. * Add comment.
80 lines
3.1 KiB
Python
80 lines
3.1 KiB
Python
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
|
|
import flatbuffers
|
|
import ray.core.generated.ErrorTableData
|
|
|
|
from ray.core.generated.ClientTableData import ClientTableData
|
|
from ray.core.generated.DriverTableData import DriverTableData
|
|
from ray.core.generated.ErrorTableData import ErrorTableData
|
|
from ray.core.generated.GcsTableEntry import GcsTableEntry
|
|
from ray.core.generated.HeartbeatBatchTableData import HeartbeatBatchTableData
|
|
from ray.core.generated.HeartbeatTableData import HeartbeatTableData
|
|
from ray.core.generated.Language import Language
|
|
from ray.core.generated.ObjectTableData import ObjectTableData
|
|
from ray.core.generated.ProfileTableData import ProfileTableData
|
|
from ray.core.generated.TablePrefix import TablePrefix
|
|
from ray.core.generated.TablePubsub import TablePubsub
|
|
|
|
from ray.core.generated.ray.protocol.Task import Task
|
|
|
|
__all__ = [
|
|
"GcsTableEntry", "ClientTableData", "ErrorTableData", "HeartbeatTableData",
|
|
"HeartbeatBatchTableData", "DriverTableData", "ProfileTableData",
|
|
"ObjectTableData", "Task", "TablePrefix", "TablePubsub", "Language",
|
|
"construct_error_message"
|
|
]
|
|
|
|
FUNCTION_PREFIX = "RemoteFunction:"
|
|
LOG_FILE_CHANNEL = "RAY_LOG_CHANNEL"
|
|
|
|
# xray heartbeats
|
|
XRAY_HEARTBEAT_CHANNEL = str(TablePubsub.HEARTBEAT).encode("ascii")
|
|
XRAY_HEARTBEAT_BATCH_CHANNEL = str(TablePubsub.HEARTBEAT_BATCH).encode("ascii")
|
|
|
|
# xray driver updates
|
|
XRAY_DRIVER_CHANNEL = str(TablePubsub.DRIVER).encode("ascii")
|
|
|
|
# These prefixes must be kept up-to-date with the TablePrefix enum in gcs.fbs.
|
|
# TODO(rkn): We should use scoped enums, in which case we should be able to
|
|
# just access the flatbuffer generated values.
|
|
TablePrefix_RAYLET_TASK_string = "RAYLET_TASK"
|
|
TablePrefix_OBJECT_string = "OBJECT"
|
|
TablePrefix_ERROR_INFO_string = "ERROR_INFO"
|
|
TablePrefix_PROFILE_string = "PROFILE"
|
|
|
|
|
|
def construct_error_message(driver_id, error_type, message, timestamp):
|
|
"""Construct a serialized ErrorTableData object.
|
|
|
|
Args:
|
|
driver_id: The ID of the driver that the error should go to. If this is
|
|
nil, then the error will go to all drivers.
|
|
error_type: The type of the error.
|
|
message: The error message.
|
|
timestamp: The time of the error.
|
|
|
|
Returns:
|
|
The serialized object.
|
|
"""
|
|
builder = flatbuffers.Builder(0)
|
|
driver_offset = builder.CreateString(driver_id.binary())
|
|
error_type_offset = builder.CreateString(error_type)
|
|
message_offset = builder.CreateString(message)
|
|
|
|
ray.core.generated.ErrorTableData.ErrorTableDataStart(builder)
|
|
ray.core.generated.ErrorTableData.ErrorTableDataAddJobId(
|
|
builder, driver_offset)
|
|
ray.core.generated.ErrorTableData.ErrorTableDataAddType(
|
|
builder, error_type_offset)
|
|
ray.core.generated.ErrorTableData.ErrorTableDataAddErrorMessage(
|
|
builder, message_offset)
|
|
ray.core.generated.ErrorTableData.ErrorTableDataAddTimestamp(
|
|
builder, timestamp)
|
|
error_data_offset = ray.core.generated.ErrorTableData.ErrorTableDataEnd(
|
|
builder)
|
|
builder.Finish(error_data_offset)
|
|
|
|
return bytes(builder.Output())
|