def lcs_delete(self, resource_id):
        res_obj = self.read(resource_id)
        old_state = res_obj.lcstate
        if old_state == LCS.DELETED:
            raise BadRequest("Resource id=%s already DELETED" % (resource_id))

        res_obj.lcstate = LCS.DELETED
        res_obj.ts_updated = get_ion_ts()

        updres = self.rr_store.update(res_obj)
        log.debug("retire(res_id=%s). Change %s_%s to %s_%s", resource_id,
                  old_state, res_obj.availability, res_obj.lcstate, res_obj.availability)

        assocs = self.find_associations(anyside=resource_id, id_only=False)
        for assoc in assocs:
            assoc.retired = True  # retired means soft deleted
        if assocs:
            self.rr_store.update_mult(assocs)
            log.debug("lcs_delete(res_id=%s). Retired %s associations", resource_id, len(assocs))

        if self.container.has_capability(self.container.CCAP.EVENT_PUBLISHER):
            self.event_pub.publish_event(event_type="ResourceLifecycleEvent",
                                     origin=res_obj._id, origin_type=res_obj.type_,
                                     sub_type="%s.%s" % (res_obj.lcstate, res_obj.availability),
                                     lcstate=res_obj.lcstate, availability=res_obj.availability,
                                     lcstate_before=old_state, availability_before=res_obj.availability)
Do stuff
dataset/ETHPy150Open ooici/pyon/pyon/ion/resregistry.py/ResourceRegistry.lcs_delete--crossover with--dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py/CmdScript.func