docstr: Used to mark the App has stopped if everything has fine.
docstr_tok: ["Used","to","mark","the","App","has","stopped","if","everything","has","fine","."]
code: def stop_app(self, app: "lightning.LightningApp"):  # noqa: F821
      """Used to mark the App has stopped if everything has fine."""
  
      external_app_spec: "Externalv1LightningappInstance" = self.client.lightningapp_instance_service_get_lightningapp_instance(
          project_id=CloudBackend._get_project_id(),
          id=CloudBackend._get_app_id(),
      )
  
      spec = external_app_spec.spec
      spec.desired_state = V1LightningappInstanceState.STOPPED
  
      self.client.lightningapp_instance_service_update_lightningapp_instance(
          project_id=CloudBackend._get_project_id(),
          id=CloudBackend._get_app_id(),
          body=AppinstancesIdBody(spec=spec),
      )
  
imports: import inspect
  import json
  import logging
  import os
  import random
  import string
  import urllib
  from time import monotonic, sleep, time
  from typing import List, Optional
  from lightning_cloud.openapi import AppinstancesIdBody, Externalv1LightningappInstance, Externalv1Lightningwork, V1BuildSpec, V1Drive, V1DriveSpec, V1DriveStatus, V1DriveType, V1Flowserver, V1LightningappInstanceState, V1LightningappRestartPolicy, V1LightningworkClusterDriver, V1LightningworkDrives, V1LightningworkSpec, V1LightningworkState, V1ListLightningworkResponse, V1Metadata, V1NetworkConfig, V1PackageManager, V1PythonDependencyInfo, V1SourceType, V1UserRequestedComputeConfig
  from lightning_cloud.openapi.rest import ApiException
  from lightning.app.core import LightningApp, LightningWork
  from lightning.app.core.queues import QueuingSystem
  from lightning.app.runners.backends.backend import Backend
  from lightning.app.storage import Drive, Mount
  from lightning.app.utilities.enum import WorkStageStatus, WorkStopReasons, make_status
  from lightning.app.utilities.exceptions import LightningPlatformException
  from lightning.app.utilities.network import LightningClient, _check_service_url_is_ready
  from lightning_cloud.openapi import SpecLightningappInstanceIdWorksBody, WorksIdBody
label_desc: Use image node_id 18 for calling the CloudBackend obj's underlying member method code with example usage: obj.stop_app(app) without return types