code: def test_cuda_assignment(
      cuda_total_devices, cuda_visible_devices, env
  ):
      class MyCUDAUserExecutor(Executor):
          def __init__(self, **kwargs):
              super().__init__(**kwargs)
              self.cuda_visible_devices = os.environ[
                  "CUDA_VISIBLE_DEVICES"
              ]
  
          @requests
          def foo(self, **kwargs):
              return DocumentArray(
                  [
                      Document(
                          tags={
                              "cuda_visible_devices": str(
                                  self.cuda_visible_devices
                              )
                          }
                      )
                  ]
              )
  
      f = Flow().add(uses=MyCUDAUserExecutor, env=env or {}, replicas=3)
      with f:
          ret = f.post(
              on="/", inputs=DocumentArray.empty(50), request_size=1
          )
          cuda_visible_devices = set(
              [doc.tags["cuda_visible_devices"] for doc in ret]
          )
  
      assert cuda_visible_devices == {"0", "1", "2"}
  
imports: import os
  import pytest
  from jina import Flow, Executor, requests, DocumentArray, Document
label_desc: Use image node_id 3 for calling a global function with example usage: test_cuda_assignment(cuda_total_devices, cuda_visible_devices, env) and returns: DocumentArray