code: def run_layer(job, layer, X, y, F, wf=None):
      """Sub-routine for running learner job"""
      if job != "fit":
          run_layer("fit", layer, X, y, F)
  
      P = np.zeros(F.shape)
  
      path = _get_path(layer.backend, is_learner=False)
      args = {
          "dir": path,
          "job": job,
          "auxiliary": {"X": X, "y": y} if job == "fit" else {"X": X},
          "main": {"X": X, "y": y, "P": P}
          if job == "fit"
          else {"X": X, "P": P},
      }
  
      if layer.backend == "manual":
          # Run manually
          layer.setup(X, y, job)
          if layer.transformers:
              for transformer in layer.transformers:
                  for subtransformer in transformer(args, "auxiliary"):
                      subtransformer()
          for learner in layer.learners:
              for sublearner in learner(args, "main"):
                  sublearner()
  
          if job == "fit":
              layer.collect()
  
      else:
          args = (X, y) if job == "fit" else (X,)
          with ParallelProcessing(
              layer.backend, layer.n_jobs
          ) as manager:
              P = manager.map(
                  layer, job, *args, path=path, return_preds=True
              )
  
      if isinstance(path, str) and layer.backend == "manual":
          try:
              shutil.rmtree(path)
          except OSError:
              warnings.warn(
                  "Failed to destroy temporary test cache at %s" % path
              )
  
      if wf is not None:
          if job in ["fit", "transform"]:
              w = [
                  obj.estimator.coef_
                  for lr in layer.learners
                  for obj in lr.sublearners
              ]
          else:
              w = [
                  obj.estimator.coef_
                  for lr in layer.learners
                  for obj in lr.learner
              ]
          np.testing.assert_array_equal(P, F)
          np.testing.assert_array_equal(w, wf)
  
          assert P.__class__.__name__ == "ndarray"
          assert w[0].__class__.__name__ == "ndarray"
  
imports: from __future__ import division, print_function, with_statement
  import os
  import shutil
  import warnings
  from abc import abstractmethod
  import numpy
  from ..utils.utils import pickle_save, pickle_load
  from ..utils.dummy import OLS, LogisticRegression, Scale
  from ..externals.sklearn.base import clone
  from ..index import INDEXERS
  from ..ensemble.base import Sequential
  from ..estimators import LayerEnsemble
  from ..parallel import ParallelProcessing, Learner, Transformer, Layer, make_group, Pipeline
label_desc: Use image node_id 6 for calling a global function with example usage: run_layer(job, layer, X, y, F, wf) without return types