Ejemplo n.º 1
0
Archivo: util.py Proyecto: yukingx/ray
def load_args_proto(thing):
    arg = ray_client_pb2.Arg()
    if isinstance(thing, ClientObjectRef):
        arg.local = ray_client_pb2.Arg.Locality.REFERENCE
        arg.reference_id = thing.id
    else:
        arg.local = ray_client_pb2.Arg.Locality.INTERNED
        arg.data = cloudpickle.dumps(thing)
    return arg
Ejemplo n.º 2
0
def convert_to_arg(val):
    out = ray_client_pb2.Arg()
    if isinstance(val, ClientObjectRef):
        out.local = ray_client_pb2.Arg.Locality.REFERENCE
        out.reference_id = val.id
    else:
        out.local = ray_client_pb2.Arg.Locality.INTERNED
        out.data = cloudpickle.dumps(val)
    return out
Ejemplo n.º 3
0
def convert_to_arg(val: Any, client_id: str) -> ray_client_pb2.Arg:
    out = ray_client_pb2.Arg()
    out.local = ray_client_pb2.Arg.Locality.INTERNED
    out.data = dumps_from_client(val, client_id)
    return out