code: def test_mpfuture_status():
      evt = mp.Event()
      future = hivemind.MPFuture()
  
      def _proc1(future):
          assert future.set_running_or_notify_cancel() is True
          evt.set()
  
      p = mp.Process(target=_proc1, args=(future,))
      p.start()
      p.join()
      assert evt.is_set()
      evt.clear()
  
      assert (
          future.running()
          and not future.done()
          and not future.cancelled()
      )
      with pytest.raises(InvalidStateError):
          future.set_running_or_notify_cancel()
  
      future = hivemind.MPFuture()
      assert future.cancel()
  
      def _proc2(future):
          assert (
              not future.running()
              and future.done()
              and future.cancelled()
          )
          assert future.set_running_or_notify_cancel() is False
          evt.set()
  
      p = mp.Process(target=_proc2, args=(future,))
      p.start()
      p.join()
      evt.set()
  
      future2 = hivemind.MPFuture()
      future2.cancel()
      assert future2.set_running_or_notify_cancel() is False
  
imports: import asyncio
  import concurrent.futures
  import multiprocessing
  import random
  import time
  from concurrent.futures import ThreadPoolExecutor
  import numpy
  import pytest
  import torch
  import hivemind
  from hivemind.compression import deserialize_torch_tensor, serialize_torch_tensor
  from hivemind.proto.runtime_pb2 import CompressionType
  from hivemind.utils import BatchTensorDescriptor, DHTExpiration, HeapEntry, MSGPackSerializer, ValueWithExpiration
  from hivemind.utils.asyncio import achain, aenumerate, aiter_with_timeout, amap_in_executor, anext, as_aiter, asingle, attach_event_on_finished, azip, cancel_and_wait, enter_asynchronously
  from hivemind.utils.mpfuture import InvalidStateError
  from hivemind.utils.performance_ema import PerformanceEMA
label_desc: Use image node_id 4 for calling a global function with example usage: test_mpfuture_status() without return types