Purge an object from Fedora.  Calls :meth:`ApiFacade.purgeObject`.

        :param pid: pid of the object to be purged
        :param log_message: optional log message
        :rtype: boolean
501882
def purge_object(self, pid, log_message=None):
        
        kwargs = {'pid': pid}
        if log_message:
            kwargs['logMessage'] = log_message
        response = self.api.purgeObject(**kwargs)
        return response.status_code == requests.codes.ok
54077
def destroy_cloudwatch_log_event(app='', env='dev', region=''):
    

    session = boto3.Session(profile_name=env, region_name=region)
    cloudwatch_client = session.client('logs')

    # FIXME: see below
    # TODO: Log group name is required, where do we get it if it is not in application-master-env.json?
    cloudwatch_client.delete_subscription_filter(logGroupName='/aws/lambda/awslimitchecker', filterName=app)

    return True
44149
def cleanup(logger, *args):
    """"""
    for obj in args:
        if obj is not None and hasattr(obj, 'cleanup'):
            try:
                obj.cleanup()
            except NotImplementedError:
                pass
            except Exception:
                logger.exception("Unable to cleanup %s object", obj)
187705
def delete_pid(self, force_del=False):
        
        pid = self.read_pid()
        if pid != getpid() or force_del:
            logger.debug('process %d tried to delete pid' % getpid())
            return False

        if access(self.pid_file_name, F_OK):
            try:
                remove(self.pid_file_name)  # remove the old pid file
                logger.debug('delete pid (%d)' % getpid())
            except:
                logger.debug("can't delete pid file")
1322056
def purge_run(self, event):
        """"""
        location_id = event['location_id']
        verbosity = event['verbosity']

        try:
            logger.info(__("Running purge for location id {}.", location_id))
            location_purge(location_id=location_id, delete=True, verbosity=verbosity)
        except Exception:  # pylint: disable=broad-except
            logger.exception("Error while purging location.", extra={'location_id': location_id})
1358977
def remove_pid_file(process_name):
    
    pid_filename = get_pid_filename(process_name)
    try:
        os.remove(pid_filename)
        print('Removed pid file at: {0}'.format(pid_filename), file=sys.stdout)
    except Exception as e:
        print('Unable to remove pid file at: {0}, because of: {1}'.format(pid_filename, e),
              file=sys.stderr)
811934
def _clean_prior(self):
        

        if self._loaded:
            try:
                pid_file = daemon.get_daemon_pidfile(self)

                # check if it exists so we don't raise
                if os.path.isfile(pid_file):
                    # read pid from file
                    pid = int(common.readfile(pid_file))

                    # check if pid file is stale
                    if pid and not daemon.pid_exists(pid):
                        common.safe_remove_file(pid_file)
                        raise ValueError

            except (ValueError, TypeError):
                self._clean()
                return True

        return False
158062
public Date purgeObject(Context context,
                            String pid,
                            String logMessage) throws ServerException {
        try {
            CreatorJournalEntry cje =
                    new CreatorJournalEntry(METHOD_PURGE_OBJECT, context);
            cje.addArgument(ARGUMENT_NAME_PID, pid);
            cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
            return (Date) cje.invokeAndClose(delegate, writer);
        } catch (JournalException e) {
            throw new GeneralException("Problem creating the Journal", e);
        }
    }
45225
def is_obsoleted_by_pid(pid):
    
    return d1_gmn.app.models.ScienceObject.objects.filter(
        obsoleted_by__did=pid
    ).exists()
578950
def delete_log(self, log):
        ''''''
        if os.path.splitext(log)[-1] != '.log':
            raise Exception('File without .log was passed in for deletoin')
        with suppress(Exception):
            os.remove(log)
1292356
def payload_unregister(klass, pid):
    
    cmd = ['payload-unregister']
    for x in [klass, pid]:
        cmd.append(x)
    subprocess.check_call(cmd)
960645
def worker_wrapper(worker_instance, pid_path):
    
    def exit_handler(*args):
        """
        Remove pid file on exit
        """
        if len(args) > 0:
            print("Exit py signal {signal}".format(signal=args[0]))
        remove(pid_path)

    atexit.register(exit_handler)
    signal.signal(signal.SIGINT, exit_handler)
    signal.signal(signal.SIGTERM, exit_handler)

    worker_instance.work()

    # Remove pid file if the process can not catch signals
    exit_handler(2)
828182
protected void removeMsgFromLogHandler(String msgId, String handlerId) {
        Set<String> logHandlerIdSet = getOrCreateLogHandlerIdSet(msgId);
        logHandlerIdSet.remove(handlerId);
    }
1045844
@Override
    public boolean purgeRelationship(String pid,
                                     String relationship,
                                     String object,
                                     boolean isLiteral,
                                     String datatype) {
        LOG.debug("start: purgeRelationship");
        assertInitialized();
        try {
            MessageContext ctx = context.getMessageContext();
            return m_management.purgeRelationship(ReadOnlyContext
                                                          .getSoapContext(ctx),
                                                  pid,
                                                  relationship,
                                                  object,
                                                  isLiteral,
                                                  datatype);
        } catch (Throwable th) {
            LOG.error("Error purging relationships", th);
            throw CXFUtility.getFault(th);
        } finally {
            LOG.debug("end: purgeRelationship");
        }
    }
1121254
public final void remove(String pid) throws LowlevelStorageException {
        File file = getFile(pid);

        pathRegistry.remove(pid);
        fileSystem.delete(file);
    }
705569
function log(level, message) {
  if(!~map[this._level].indexOf(level)) return false;
  var pid = process.pid
    , time = logtime()
    , args = slice.call(arguments, 1)
    , cb = typeof args[args.length - 1] === 'function'
      ? args.pop() : null
    , stream = level === LEVELS.WARNING ? this._err : this._out;
  var msg = '[' + pid + '] ' + time + ' '
    + getPrefix(level, stream.isTTY) + ' ';

  if(args.length > 1) {
    message = util.format.apply(util, args);
  }else{
    message = args[0];
  }
  msg += message + EOL;
  stream.write(msg, cb);
  return message;
}
292746
def clean(cls, pid):
        
        with cls._lock:
            try:
                cls._ensure_pool_exists(pid)
            except KeyError:
                LOGGER.debug('Pool clean invoked against missing pool %s', pid)
                return
            cls._pools[pid].clean()
            cls._maybe_remove_pool(pid)