code: def train_func(config):
      logger = None
      if ray.train.get_context().get_world_rank() == 0:
          logger = WandbLogger(name="demo-run", project="demo-project")
  
      ptl_trainer = pl.Trainer(
          max_epochs=5,
          accelerator="cpu",
          logger=logger,
          log_every_n_steps=1,
      )
      model = DummyModel()
      ptl_trainer.fit(model, train_dataloaders=dataloader)
      if ray.train.get_context().get_world_rank() == 0:
          wandb.finish()
  
file_path: ray/python/ray/train/examples/experiment_tracking/lightning_exp_tracking_wandb.py
imports: from lightning_exp_tracking_model_dl import DummyModel, dataloader
  import os
  import pytorch_lightning
  import wandb
  from pytorch_lightning.loggers.wandb import WandbLogger
  import ray
  from ray.train import ScalingConfig
  from ray.train.torch import TorchTrainer
label_desc: Use image node_id 1 for calling a global function with example usage: train_func(config) without return types