docstr: Keeps track over an epoch of which (entity, part) pairs have been
  processed. Since we store partition data in temporary files during an
  epoch, this dirty state is necessary to know whether the partition
  checkpint or the intermediate file should be read.
docstr_tok: ["Keeps","track","over","an","epoch","of","which","(","entity",",","part",")","pairs","have","been","processed",".","Since","we","store","partition","data","in","temporary","files","during","an","epoch",",","this","dirty","state","is","necessary","to","know","whether","the","partition","checkpint","or","the","intermediate","file","should","be","read","."]
code: def check_and_set_dirty(
      self, entity: EntityName, part: Partition
  ) -> bool:
      """
      Keeps track over an epoch of which (entity, part) pairs have been
      processed. Since we store partition data in temporary files during an
      epoch, this dirty state is necessary to know whether the partition
      checkpint or the intermediate file should be read.
      """
      key = (entity, part)
      res = key in self.dirty
      self.dirty.add(key)
      return res
  
imports: import logging
  import random
  from abc import ABC, abstractmethod
  from collections import defaultdict
  from statistics import mean
  from typing import Dict, List, NamedTuple, Optional, Set, Tuple
  from torchbiggraph.config import BucketOrder
  from torchbiggraph.distributed import Startable
  from torchbiggraph.rpc import Client, Server
  from torchbiggraph.stats import Stats, StatsHandler
  from torchbiggraph.types import Bucket, EntityName, Partition, Rank, Side
label_desc: Use image node_id 8 for calling the LockServer obj's underlying member method code with example usage: obj.check_and_set_dirty(entity, part) and returns: res