class_docstr: An implementation of data store which uses NFS for storing policy checkpoints when using Coach in distributed mode.
  The policy checkpoints are written by the trainer and read by the rollout worker.
class_docstr_tok: ["An","implementation","of","data","store","which","uses","NFS","for","storing","policy","checkpoints","when","using","Coach","in","distributed","mode",".","The","policy","checkpoints","are","written","by","the","trainer","and","read","by","the","rollout","worker","."]
docstr: Create NFS resources such as PV and PVC in Kubernetes.
docstr_tok: ["Create","NFS","resources","such","as","PV","and","PVC","in","Kubernetes","."]
code: def create_k8s_nfs_resources(self) -> bool:
      """
      Create NFS resources such as PV and PVC in Kubernetes.
      """
      from kubernetes import client as k8sclient
  
      pv_name = "nfs-ckpt-pv-{}".format(uuid.uuid4())
      persistent_volume = k8sclient.V1PersistentVolume(
          api_version="v1",
          kind="PersistentVolume",
          metadata=k8sclient.V1ObjectMeta(
              name=pv_name, labels={"app": pv_name}
          ),
          spec=k8sclient.V1PersistentVolumeSpec(
              access_modes=["ReadWriteMany"],
              nfs=k8sclient.V1NFSVolumeSource(
                  path=self.params.path, server=self.params.server
              ),
              capacity={"storage": "10Gi"},
              storage_class_name="",
          ),
      )
      k8s_api_client = k8sclient.CoreV1Api()
      try:
          k8s_api_client.create_persistent_volume(persistent_volume)
          self.params.pv_name = pv_name
      except k8sclient.rest.ApiException as e:
          screen.print(
              "Got exception: %s\n while creating the NFS PV", e
          )
          return False
  
      pvc_name = "nfs-ckpt-pvc-{}".format(uuid.uuid4())
      persistent_volume_claim = k8sclient.V1PersistentVolumeClaim(
          api_version="v1",
          kind="PersistentVolumeClaim",
          metadata=k8sclient.V1ObjectMeta(name=pvc_name),
          spec=k8sclient.V1PersistentVolumeClaimSpec(
              access_modes=["ReadWriteMany"],
              resources=k8sclient.V1ResourceRequirements(
                  requests={"storage": "10Gi"}
              ),
              selector=k8sclient.V1LabelSelector(
                  match_labels={"app": self.params.pv_name}
              ),
              storage_class_name="",
          ),
      )
  
      try:
          k8s_api_client.create_namespaced_persistent_volume_claim(
              self.params.namespace, persistent_volume_claim
          )
          self.params.pvc_name = pvc_name
      except k8sclient.rest.ApiException as e:
          screen.print(
              "Got exception: %s\n while creating the NFS PVC", e
          )
          return False
  
      return True
  
file_path: coach/rl_coach/data_stores/nfs_data_store.py
imports: import uuid
  from rl_coach.data_stores.data_store import DataStoreParameters
  from rl_coach.data_stores.checkpoint_data_store import CheckpointDataStore
  from rl_coach.logger import screen
label_desc: Use image node_id 8 for calling the NFSDataStore obj's underlying member method code with example usage: obj.create_k8s_nfs_resources() and returns: True, False, False