Return True if ``pid`` is referenced in the obsoletes field of any object.

    This will return True even if the PID is in the obsoletes field of an object that
    does not exist on the local MN, such as replica that is in an incomplete chain.
972154
def is_obsoletes_pid(pid):
    
    return d1_gmn.app.models.ScienceObject.objects.filter(obsoletes__did=pid).exists()
1058463
def archive_sciobj(pid):
    
    sciobj_model = d1_gmn.app.model_util.get_sci_model(pid)
    sciobj_model.is_archived = True
    sciobj_model.save()
    _update_modified_timestamp(sciobj_model)
639415
def _orphan_this_process(cls, wait_for_parent=False):
        """"""
        # The current PID will be the PPID of the forked child
        ppid = os.getpid()

        pid = os.fork()
        if pid > 0:
            # Exit parent
            sys.exit(0)

        if wait_for_parent and cls._pid_is_alive(ppid, timeout=1):
            raise DaemonError(
                'Parent did not exit while trying to orphan process')
214128
def dump_is_last(self, obj):
        
        if self._is_child(obj) and isinstance(obj, PIDNodeOrdered):
            if obj.children.count() > 0:
                return obj.children.ordered('asc').all()[-1] == \
                    self.context['pid']
            elif obj.draft_child:
                return obj.draft_child == self.context['pid']
            else:
                return True
        else:
            return None
59456
def checkPidFile(pidfile):
    
    if os.path.exists(pidfile):
        try:
            with open(pidfile) as f:
                pid = int(f.read())
        except ValueError:
            raise ValueError('Pidfile {} contains non-numeric value'.format(pidfile))
        try:
            os.kill(pid, 0)
        except OSError as why:
            if why.errno == errno.ESRCH:
                # The pid doesn't exist.
                print('Removing stale pidfile {}'.format(pidfile))
                os.remove(pidfile)
            else:
                raise OSError("Can't check status of PID {} from pidfile {}: {}".format(
                    pid, pidfile, why))
        else:
            raise BusyError("'{}' exists - is this master still running?".format(pidfile))
575088
def hasBeenRotated(self):
      """"""
      try:
         # If the inodes don't match, it means the file has been replaced.
         # The inode number cannot be recycled as long as we hold the
         # filehandle open, so this test can be trusted.
         return os.stat(self._path).st_ino != self._inode
      except OSError:
         # If the file doesn't exist, let's call it "rotated".
         return True
851365
public boolean isReferencedByRoot() {
        if(rootBean) {
            return true;
        }
        for(Reference reference : references) {
            Instance parent = reference.getParent();
            if(parent.isReferencedByRoot()) {
                return true;
            }
        }
        return false;
    }
1184625
boolean isStale(long[] newVersions, int replicaIndex) {
        int index = replicaIndex - 1;
        long currentVersion = versions[index];
        long newVersion = newVersions[index];
        return currentVersion > newVersion;
    }
331995
public static boolean isNewer(HasMetadata newer, HasMetadata older) {
        long n1 = parseResourceVersion(newer);
        long n2 = parseResourceVersion(older);
        return n1 >= n2;
    }
879510
protected boolean cascadeDeleteFor(ObjectReferenceDescriptor ord)
    {
        boolean result;
        Boolean runtimeSetting = (Boolean) runtimeCascadeDeleteMap.get(ord);
        if(runtimeSetting == null)
        {
            /*
            arminw: Here we use the auto-delete flag defined in metadata
            */
            result = ord.getCascadingDelete() == ObjectReferenceDescriptor.CASCADE_OBJECT;
        }
        else
        {
            result = runtimeSetting.booleanValue();
        }
        return result;
    }
371529
def _is_old_database(db_dir, args):
    
    snpeff_version = effects.snpeff_version(args)
    if LooseVersion(snpeff_version) >= LooseVersion("4.1"):
        pred_file = os.path.join(db_dir, "snpEffectPredictor.bin")
        if not utils.file_exists(pred_file):
            return True
        with utils.open_gzipsafe(pred_file, is_gz=True) as in_handle:
            version_info = in_handle.readline().strip().split("\t")
        program, version = version_info[:2]
        if not program.lower() == "snpeff" or LooseVersion(snpeff_version) > LooseVersion(version):
            return True
    return False
104775
def exists(self, value=None):
        
        try:
            if not value:
                value = self.get()
        except (AttributeError, DoesNotExist):
            # If the instance is deleted, the _pk attribute doesn't exist
            # anymore. So we catch the AttributeError to return False (this pk
            # field doesn't exist anymore) in this specific case
            return False
        else:
            return self.connection.sismember(self.collection_key, value)
481120
def isRecordidField?( fid )
      fields = lookupFieldsByType( "recordid" )
      (fields and fields.last and fields.last.attributes[ "id" ] == fid)
   end
239673
protected boolean isTransient(ClassDescriptor cld, Object obj, Identity oid)
    {
        // if the Identity is transient we assume a non-persistent object
        boolean isNew = oid != null && oid.isTransient();
        /*
        detection of new objects is costly (select of ID in DB to check if object
        already exists) we do:
        a. check if the object has nullified PK field
        b. check if the object is already registered
        c. lookup from cache and if not found, last option select on DB
        */
        if(!isNew)
        {
            final PersistenceBroker pb = getBroker();
            if(cld == null)
            {
                cld = pb.getClassDescriptor(obj.getClass());
            }
            isNew = pb.serviceBrokerHelper().hasNullPKField(cld, obj);
            if(!isNew)
            {
                if(oid == null)
                {
                    oid = pb.serviceIdentity().buildIdentity(cld, obj);
                }
                final ObjectEnvelope mod = objectEnvelopeTable.getByIdentity(oid);
                if(mod != null)
                {
                    // already registered object, use current state
                    isNew = mod.needsInsert();
                }
                else
                {
                    // if object was found cache, assume it's old
                    // else make costly check against the DB
                    isNew = pb.serviceObjectCache().lookup(oid) == null
                            && !pb.serviceBrokerHelper().doesExist(cld, oid, obj);
                }
            }
        }
        return isNew;
    }
162159
def apply_previous_archived_version_if_applicable(rels_ext)
      # If a previously archived pid was passed in, use it to set pav:previousVersion
      # If not, check SOLR for one.
      pid = previously_archived_pid_finder.call(archive_type, osf_project_identifier)
      pid = ROF::Utility.check_solr_for_previous(config, osf_project_identifier) if pid.nil?
      rels_ext['pav:previousVersion'] = pid if pid
      rels_ext
    end
1090486
def check_missing_references(client):
    """"""
    from renku.models.refs import LinkReference

    missing = [
        ref for ref in LinkReference.iter_items(client)
        if not ref.reference.exists()
    ]

    if not missing:
        return True

    click.secho(
        WARNING + 'There are missing references.'
        '\n  (use "git rm <name>" to clean them)\n\n\t' + '\n\t  '.join(
            click.style(str(ref.path), fg='yellow') + ' -> ' +
            click.style(str(ref.reference), fg='red') for ref in missing
        ) + '\n'
    )
    return False
5727
def _has_changed(instance):
    
    for field, value in instance._original_fields.items():
        if field != 'pk' and \
           not isinstance(instance._meta.get_field(field), ManyToManyField):
            try:
                if field in getattr(instance, '_tracked_fields', []):
                    if isinstance(instance._meta.get_field(field), ForeignKey):
                        if getattr(instance, '{0}_id'.format(field)) != value:
                            return True
                    else:
                        if getattr(instance, field) != value:
                            return True
            except TypeError:
                # Can't compare old and new value, should be different.
                return True
    return False