code: def worker_process(strategyClass, port, logLevel):
      class Worker(worker.Worker):
          def runStrategy(self, barFeed, *args, **kwargs):
              strat = strategyClass(barFeed, *args, **kwargs)
              strat.run()
              return strat.getResult()
  
      # Create a worker and run it.
      try:
          name = "worker-%s" % (os.getpid())
          w = Worker("localhost", port, name)
          w.getLogger().setLevel(logLevel)
          w.run()
      except Exception as e:
          w.getLogger().exception("Failed to run worker: %s" % (e))
  
file_path: pyalgotrade/pyalgotrade/optimizer/local.py
imports: import logging
  import multiprocessing
  import os
  import random
  import socket
  import threading
  import time
  from pyalgotrade.optimizer import base
  from pyalgotrade.optimizer import server
  from pyalgotrade.optimizer import worker
  from pyalgotrade.optimizer import xmlrpcserver
label_desc: Use image node_id 1 for calling a global function with example usage: worker_process(strategyClass, port, logLevel) and returns: strat