docstr: Gather up system and code packaging info and register them as task metadata
code: def _register_system_metadata(
      self, run_id, step_name, task_id, attempt
  ):
      """Gather up system and code packaging info and register them as task metadata"""
      metadata = []
      # Take everything from system info and store them as metadata
      sys_info = self._get_system_info_as_dict()
  
      # field, and type could get long in theory...can the metadata backend handle it?
      # E.g. as of 5/9/2022 Metadata service's DB says VARCHAR(255).
      # It is likely overkill to fail a flow over an over-flow. We should expect the
      # backend to try to tolerate this (e.g. enlarge columns, truncation fallback).
      metadata.extend(
          MetaDatum(
              field=str(k),
              value=str(v),
              type=str(k),
              tags=["attempt_id:{0}".format(attempt)],
          )
          for k, v in sys_info.items()
      )
      # Also store code packaging information
      code_sha = os.environ.get("METAFLOW_CODE_SHA")
      if code_sha:
          code_url = os.environ.get("METAFLOW_CODE_URL")
          code_ds = os.environ.get("METAFLOW_CODE_DS")
          metadata.append(
              MetaDatum(
                  field="code-package",
                  value=json.dumps(
                      {
                          "ds_type": code_ds,
                          "sha": code_sha,
                          "location": code_url,
                      }
                  ),
                  type="code-package",
                  tags=["attempt_id:{0}".format(attempt)],
              )
          )
      if metadata:
          self.register_metadata(run_id, step_name, task_id, metadata)
  
imports: import json
  import os
  import re
  import time
  from collections import namedtuple
  from itertools import chain
  from metaflow.exception import MetaflowInternalError, MetaflowTaggingError
  from metaflow.tagging_util import validate_tag
  from metaflow.util import get_username, resolve_identity_as_tuple, is_stringish
label_desc: Use image node_id 31 for calling the MetadataProvider obj's underlying member method code with example usage: obj._register_system_metadata(run_id, step_name, task_id, attempt) without return types