#  ‘Worker’ object has no attribute ‘core\_worker’

**URL:** <https://discuss.ray.io/t/worker-object-has-no-attribute-core-worker/20556>\
**Category:** Uncategorized\
**Created:** [November 12, 2024, 5:16pm UTC](https://discuss.ray.io/t/worker-object-has-no-attribute-core-worker/20556 "2024-11-12T17:16:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Maxwell](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/james_maxwell/32/7293_2.png) [@James\_Maxwell](https://discuss.ray.io/u/James_Maxwell)\
**Post date:** [November 12, 2024, 5:16pm UTC](https://discuss.ray.io/t/worker-object-has-no-attribute-core-worker/20556/1 "2024-11-12T17:16:04Z")

</div>

### What happened + What you expected to happen

I am attempting to use the ray.data.read\_parquet method to read data from an Azure Storage account. However, I encounter the following error when trying to call to\_pandas on the Ray dataset: I have created my own ray cluster using docker-compose for local development and testing.

  

2024-11-11 16:58:13,900 ERROR exceptions.py:81 – Full stack trace:  
Traceback (most recent call last):  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/exceptions.py”, line 49, in handle\_trace  
return fn(\*args, \*\*kwargs)  
^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/plan.py”, line 423, in execute\_to\_iterator  
bundle\_iter = execute\_to\_legacy\_bundle\_iterator(executor, self)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/legacy\_compat.py”, line 51, in execute\_to\_legacy\_bundle\_iterator  
bundle\_iter = executor.execute(dag, initial\_stats=stats)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/streaming\_executor.py”, line 124, in execute  
self.\_topology, \_ = build\_streaming\_topology(dag, self.\_options)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/streaming\_executor\_state.py”, line 382, in build\_streaming\_topology  
setup\_state(dag)  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/streaming\_executor\_state.py”, line 373, in setup\_state  
parent\_state = setup\_state(parent)  
^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/streaming\_executor\_state.py”, line 379, in setup\_state  
op.start(options)  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/execution/operators/input\_data\_buffer.py”, line 48, in start  
self.\_input\_data = self.\_input\_data\_factory(  
^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/planner/plan\_read\_op.py”, line 85, in get\_input\_data  
cleaned\_metadata(read\_task, read\_task\_ref),  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/\_internal/planner/plan\_read\_op.py”, line 35, in cleaned\_metadata  
locations = get\_local\_object\_locations([read\_task\_ref])  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/experimental/locations.py”, line 75, in get\_local\_object\_locations  
core\_worker = ray.\_private.worker.global\_worker.core\_worker

AttributeError: ‘Worker’ object has no attribute ‘core\_worker’  
Running 0: 0.00 row [00:00, ? row/s]  
ray.data.exceptions.SystemException

The above exception was the direct cause of the following exception:

Traceback (most recent call last):  
File “/Users/fme\_tms\_ldm\_ray\_cluster/sample\_code/src/sample\_code/deltalake\_test.py”, line 39, in   
df = ds.to\_pandas()  
^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/dataset.py”, line 4588, in to\_pandas  
bundles = self.iter\_internal\_ref\_bundles()  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/dataset.py”, line 4845, in iter\_internal\_ref\_bundles  
iter\_ref\_bundles, \_, \_ = self.\_plan.execute\_to\_iterator()  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/Users/.venv/lib/python3.11/site-packages/ray/data/exceptions.py”, line 89, in handle\_trace  
raise e.with\_traceback(None) from SystemException()  
AttributeError: ‘Worker’ object has no attribute ‘core\_worker’

### Versions / Dependencies

ray = 2.38.0  
python = 3.11.10  
Os = macos

### Reproduction script

raytest image

```auto
FROM python:3.11.10-slim

RUN pip install --no-cache-dir -U 'ray[default,data]' adlfs fsspec tqdm deltalake deltaray

```

envs

```auto
HOST=localhost
RAY_IMAGE=raytest
REDISPORT=6345
DASHBOARDPORT=8265
HEADNODEPORT=20001
REDISPASSWORD=yourpassword
NUM_WORKERS=4
NUM_CPU_WORKER=1

```

docker compose

```auto
version: "3"

services:
  ray-head:
    image: ${RAY_IMAGE}
    ports:
      - "${REDISPORT}:${REDISPORT}"
      - "${DASHBOARDPORT}:${DASHBOARDPORT}"
      - "${HEADNODEPORT}:${HEADNODEPORT}"
    env_file:
      - .env
    command: bash -c "ray start --head --ray-client-server-port=${HEADNODEPORT} --dashboard-port=${DASHBOARDPORT} --port=${REDISPORT} --dashboard-host=0.0.0.0 --redis-password=${REDISPASSWORD} --block"
    shm_size: 2g
    deploy:
      resources:
        limits:
          cpus: '1'
          memory: '2g'
    networks:
      - ray_net

  ray-worker:
    image: ${RAY_IMAGE}
    depends_on: 
      - ray-head
    env_file:
      - .env
    command: bash -c "ray start --address=ray-head:${REDISPORT} --redis-password=${REDISPASSWORD} --num-cpus=${NUM_CPU_WORKER} --block" 
    shm_size: 2g
    deploy:
      mode: replicated
      replicas: ${NUM_WORKERS} 
      resources:
        limits:
          cpus: ${NUM_CPU_WORKER}
          memory: '2g'
    networks:
      - ray_net
  
networks:
  ray_net:
    ipam:
      driver: default
      config:
        - subnet: 172.63.0.0/16

```

python script

```python
import ray
from deltalake import DeltaTable
from ray.data import read_parquet
from ray.data.datasource import ParquetMetadataProvider
from fsspec import filesystem

ray.init(address='ray://localhost:20001')

access_key = "mykey"
account_name = "myaccountname"

storage_options = {
    "account_name": account_name,
    "account_key": access_key,
}
fs = filesystem("abfs", **storage_options)

partition_filters = [("customer_id", "in", ["abc"])]

dt = DeltaTable("abfs://mypath", storage_options=storage_options)

ds = read_parquet(
    paths=dt.file_uris(partition_filters=partition_filters),
    filesystem=fs,
    columns=None,
    parallelism=-1,
    ray_remote_args=None,
    tensor_column_schema=None,
    meta_provider=ParquetMetadataProvider(),
)

df = ds.to_pandas()
print(df)

```

### Issue Severity

High: It blocks me from completing my task.

---

<div class="post-metadata">

**Author:** ![mowen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/mowen/32/7309_2.png) [@mowen](https://discuss.ray.io/u/mowen)\
**Post date:** [November 13, 2024, 7:33pm UTC](https://discuss.ray.io/t/worker-object-has-no-attribute-core-worker/20556/2 "2024-11-13T19:33:05Z")

</div>

I think this issue stems from how you are initializing ray with `ray.init(address='ray://localhost:20001')`. This will use ray in Client Mode which has some limitations for various libraries (more on ray Client Mode [here](https://docs.ray.io/en/latest/cluster/running-applications/job-submission/ray-client.html)). In this case the driver doesn’t have access to the `core_worker` attribute because it’s not a full Ray worker, and the error `AttributeError: 'Worker' object has no attribute 'core_worker'` occurs because the function `get_local_object_locations` tries to access `ray._private.worker.global_worker.core_worker`, which doesn’t exist in client mode.

I would try this again without using Client Mode and see if that fixes your problem. More on how to call ray init [here](https://docs.ray.io/en/latest/ray-core/api/doc/ray.init.html).
