How severe does this issue affect your experience of using Ray?
- Low: It annoys or frustrates me for a moment.
Is there a way to concatenate lists when passing them to a node? For example, consider this code:
from typing import List
import ray
from ray import workflow
@ray.remote
def f(x: int) -> List[int]:
print(f"f({x})")
return [x + 1, x + 2]
@ray.remote
def g(x: int) -> List[int]:
print(f"h({x})")
return [x + 1, x + 2]
@ray.remote
def h(xs: List[List[int]]) -> int:
xs = [x for sublist in xs for x in ray.get(sublist)]
print(f"g({xs})")
return sum(xs)
f_data = f.bind(10)
g_data = g.bind(567)
output = h.bind([f_data, g_data])
print("RESULT", workflow.run(output))
f
and g
output lists and want to give their combined output to h
. If this was plain old Python, I would just do h(f_data + g_data)
, and the type hint for the input of h
would be a nice clean List[int]
. I can’t seem to find a way to achieve that with Ray workflows, besides forcing nested lists, then unnesting them like I have above.
Any advice?