# How to use wandb logging when have multiple Ray workers

**URL:** <https://community.wandb.ai/t/how-to-use-wandb-logging-when-have-multiple-ray-workers/17746>\
**Category:** W&B Help\
**Created:** [July 1, 2025, 2:27pm UTC](https://community.wandb.ai/t/how-to-use-wandb-logging-when-have-multiple-ray-workers/17746 "2025-07-01T14:27:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chestnut890123](https://avatars.discourse-cdn.com/v4/letter/c/779978/32.png) [@chestnut890123](https://community.wandb.ai/u/chestnut890123)\
**Post date:** [July 1, 2025, 2:27pm UTC](https://community.wandb.ai/t/how-to-use-wandb-logging-when-have-multiple-ray-workers/17746/1 "2025-07-01T14:27:32Z")

</div>

I am using two workers in the `ScalingConfig` and want to log wandb metrics during training at rank 0 worker as default setting in `setup_wandb` which turns on rank\_zero\_only. But got this error

```auto
Fatal Python error: PyGILState_Release: auto-releasing thread-state, but no thread-state for this thread

```

Could there be multiple zero workers?  
I even do something like this but still failed

```auto
worker_rank = ray.train.get_context().get_world_rank()
if worker_rank == 0:
     wandb_run = setup_wandb(...)
     wandb_run.log(...)

```
