code: def _handle_event(self, event: Event) -> None:
      if isinstance(event, EventJobDone):
          job = event.job
  
          if event.exc is not None:
              logger.exception(
                  "Failed to upload file: %s",
                  job.path,
                  exc_info=event.exc,
              )
  
          if job.artifact_id:
              if event.exc is None:
                  self._artifacts[job.artifact_id]["pending_count"] -= 1
                  self._maybe_commit_artifact(job.artifact_id)
              else:
                  if not self.silent:
                      termerror(
                          "Uploading artifact file failed. Artifact won't be committed."
                      )
                  self._fail_artifact_futures(
                      job.artifact_id, event.exc
                  )
          self._running_jobs.pop(job.save_name)
          # If we have any pending jobs, start one now
          if self._pending_jobs:
              event = self._pending_jobs.pop(0)
              self._start_upload_job(event)
      elif isinstance(event, RequestCommitArtifact):
          if event.artifact_id not in self._artifacts:
              self._init_artifact(event.artifact_id)
          self._artifacts[event.artifact_id]["commit_requested"] = True
          self._artifacts[event.artifact_id][
              "finalize"
          ] = event.finalize
          self._artifacts[event.artifact_id][
              "pre_commit_callbacks"
          ].add(event.before_commit)
          self._artifacts[event.artifact_id]["result_futures"].add(
              event.result_future
          )
          self._maybe_commit_artifact(event.artifact_id)
      elif isinstance(event, RequestUpload):
          if event.artifact_id is not None:
              if event.artifact_id not in self._artifacts:
                  self._init_artifact(event.artifact_id)
              self._artifacts[event.artifact_id]["pending_count"] += 1
          self._start_upload_job(event)
      else:
          raise Exception(
              "Programming error: unhandled event: %s" % str(event)
          )
  
imports: import asyncio
  import concurrent.futures
  import logging
  import queue
  import sys
  import threading
  from typing import TYPE_CHECKING, Awaitable, Callable, MutableMapping, MutableSequence, MutableSet, NamedTuple, Optional, Union
  from wandb.errors.term import termerror
  from wandb.filesync import upload_job
  from wandb.sdk.lib.paths import LogicalPath
label_desc: Use image node_id 3 for calling the StepUpload obj's underlying member method code with example usage: obj._handle_event(event) without return types