code: def _run_cards_subprocess(
      self,
      card_uuid,
      user_set_card_id,
      mode,
      runspec,
      decorator_attributes,
      card_options,
      component_strings,
      logger,
      data=None,
      final=False,
      sync=False,
  ):
      components_file = data_file = None
      wait = final or sync
  
      if len(component_strings) > 0:
          # note that we can't delete temporary files here when calling the subprocess
          # async due to a race condition. The subprocess must delete them
          components_file = tempfile.NamedTemporaryFile(
              "w", suffix=".json", delete=False
          )
          json.dump(component_strings, components_file)
          components_file.seek(0)
      if data is not None:
          data_file = tempfile.NamedTemporaryFile(
              "w", suffix=".json", delete=False
          )
          json.dump(data, data_file)
          data_file.seek(0)
  
      executable = sys.executable
      cmd = [
          executable,
          sys.argv[0],
      ]
      cmd += self._top_level_options + [
          "card",
          "create",
          runspec,
          "--delete-input-files",
          "--card-uuid",
          card_uuid,
          "--mode",
          mode,
          "--type",
          decorator_attributes["type"],
          # Add the options relating to card arguments.
          # todo : add scope as a CLI arg for the create method.
      ]
      if card_options is not None and len(card_options) > 0:
          cmd += ["--options", json.dumps(card_options)]
      # set the id argument.
  
      if decorator_attributes["timeout"] is not None:
          cmd += ["--timeout", str(decorator_attributes["timeout"])]
  
      if user_set_card_id is not None:
          cmd += ["--id", str(user_set_card_id)]
  
      if decorator_attributes["save_errors"]:
          cmd += ["--render-error-card"]
  
      if components_file is not None:
          cmd += ["--component-file", components_file.name]
  
      if data_file is not None:
          cmd += ["--data-file", data_file.name]
  
      response, fail = self._run_command(
          cmd,
          card_uuid,
          os.environ,
          timeout=decorator_attributes["timeout"],
          wait=wait,
      )
      if fail:
          resp = "" if response is None else response.decode("utf-8")
          logger(
              "Card render failed with error : \n\n %s" % resp,
              timestamp=False,
              bad=True,
          )
  
file_path: metaflow/metaflow/plugins/cards/card_creator.py
imports: import time
  import subprocess
  import tempfile
  import json
  import sys
  import os
  from metaflow import current
label_desc: Use image node_id 3 for calling the CardCreator obj's underlying member method code with example usage: obj._run_cards_subprocess(card_uuid, user_set_card_id, mode, runspec, decorator_attributes, card_options, component_strings, logger, data, final, sync) without return types