# Reading a list of images in a Worfklows

**URL:** https://discuss.ray.io/t/reading-a-list-of-images-in-a-worfklows/20858
**Category:** Ray Workflows
**Created:** [December 3, 2024, 12:21am UTC](https://discuss.ray.io/t/reading-a-list-of-images-in-a-worfklows/20858 "2024-12-03T00:21:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Josiah\_Reeves](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/josiah_reeves/32/5909_2.png) [@Josiah\_Reeves](https://discuss.ray.io/u/Josiah_Reeves)
#### Post date: [December 3, 2024, 12:21am UTC](https://discuss.ray.io/t/reading-a-list-of-images-in-a-worfklows/20858/1 "2024-12-03T00:21:41Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- High: It blocks me to complete my task.

I would like to replace my `ray.data.read_images` and Dataset with `workflows` I have been unable to find a good example showing how to read in multiple files as part of a DAG. For example, I would like to read a list of images:

```auto
from pydantic import BaseModel
from ray.dag.dag_node import DAGNode
from ray.dag.input_node import InputNode
from ray import workflow

@ray.remote(num_cpus=0.5)
def read(dir) -> Dict[str, Any]:
    img = Image.open(dir)
    img = np.array(img) / 255.0
    return dict(image=img, path=dir)

class ContentInput(BaseModel):
    paths: List[str] = []
    output_dir: str = None

with InputNode() as input_node:
    dag: DAGNode = [read.remote(path) for path in input_node.paths]

results = dag.execute(image_paths)
results = ray.get(results)

```

I could make the reader an actor and read them in a loop but this blocks until all of the images in the list are read in so not that useful.

```auto
....

@ray.remote(num_cpus=0.5)
class Reader:
    def read(self, dirs: List[str]) -> List[Dict[str, Any]]:
        return [self(dir) for dir in dirs]
    
    def __call__ (self, dir) -> Dict[str, Any]:
        img = Image.open(dir)
        img = np.array(img) / 255.0
        fn = Path(dir).stem
        return dict(image=img, path=dir)

```

Any insight on the best way to do this would be appreciated. I did find this demo but a lot of this seems to be no longer supported: [2022\_04\_13\_ray\_serve\_meetup\_demo/deployment\_graph.py at main · ray-project/2022\_04\_13\_ray\_serve\_meetup\_demo · GitHub](https://github.com/ray-project/2022_04_13_ray_serve_meetup_demo/blob/main/deployment_graph.py#L101)

---

<div class="post-metadata">

### Author: ![Josiah\_Reeves](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/josiah_reeves/32/5909_2.png) [@Josiah\_Reeves](https://discuss.ray.io/u/Josiah_Reeves)
#### Post date: [December 13, 2024, 4:50pm UTC](https://discuss.ray.io/t/reading-a-list-of-images-in-a-worfklows/20858/2 "2024-12-13T16:50:01Z")

</div>

Is Ray Workflows deprecated as the slack channel seems to suggest?
