Inject context PID in the RECID field.
977728
def inject_pid(self, data):
        """"""
        # Remove already deserialized "pid" field
        pid_value = data.pop('pid', None)
        if pid_value:
            pid_field = current_app.config['PIDSTORE_RECID_FIELD']
            data.setdefault(pid_field, pid_value)
        return data
581711
public static void injectContextProxies(AbstractResourceInfo cri, Object instance) {
        injectContextProxiesAndApplication(cri, instance, null, null);
    }
637086
def pid(self, value):
        """"""
        self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
910956
def init_pid(self, kp, ki, kd):
        """"""
        p, i, d = map(lambda x: int(x * (2 ** 16)), (kp, ki, kd))
        self._set_as_int(Addr.PConstant, p, 4)
        self._set_as_int(Addr.IConstant, i, 4)
        self._set_as_int(Addr.DConstant, d, 4)
274705
public static void setSpecificInputContext(Configuration conf, String inputName, int inputId) {
    for (Map.Entry<String, String> entries : conf) {
      String confKey = entries.getKey();
      String confValue = entries.getValue();
      if (confKey.startsWith(MI_PREFIX + inputName + "." + inputId + CONF)) {
        // Specific context key, value found
        String contextKey = confKey.substring((MI_PREFIX + inputName + "." + inputId + CONF + ".").length(), confKey
            .length());
        conf.set(contextKey, confValue);
      }
    }
  }
735153
def seek(self, idx):
        """"""
        assert not self.writable
        self._check_pid(allow_reset=True)
        pos = ctypes.c_size_t(self.idx[idx])
        check_call(_LIB.MXRecordIOReaderSeek(self.handle, pos))
1201476
public void write_pid(OtpErlangPid pid) {
	write1(pid.tag());
	write_atom(pid.node());
	write4BE(pid.id());
	write4BE(pid.serial());
	switch (pid.tag()) {
	case OtpExternal.pidTag:
	    write1(pid.creation());
	    break;
	case OtpExternal.newPidTag:
	    write4BE(pid.creation());
	    break;
	default:
	    throw new AssertionError("Invalid pid tag " + pid.tag());
	}
    }
831617
private synchronized void addContext(final EvaluatorContext context) {
    this.contextStack.add(context);
    this.contextIds.add(context.getId());
  }
746957
def listen(identifier):
  

  context = Context()
  process = WebProcess(identifier)

  context.spawn(process)

  log.info("Launching PID %s", process.pid)

  return process, context
1085110
protected void configureAndRefreshPortletApplicationContext(ConfigurablePortletApplicationContext pac, PortletContext pc) {
        if (ObjectUtils.identityToString(pac).equals(pac.getId())) {
            // The application context id is still set to its original default value
            // -> assign a more useful id based on available information
            String idParam = pc.getInitParameter(CONTEXT_ID_PARAM);
            if (idParam != null) {
                pac.setId(idParam);
            }
            else {
                // Generate default id...
                pac.setId(ConfigurablePortletApplicationContext.APPLICATION_CONTEXT_ID_PREFIX +
                        ObjectUtils.getDisplayString(pc.getPortletContextName()));
            }
        }

        // Determine parent for root web application context, if any.
        ApplicationContext parent = loadParentContext(pc);

        pac.setParent(parent);
        pac.setPortletContext(pc);
        String initParameter = pc.getInitParameter(CONFIG_LOCATION_PARAM);
        if (initParameter != null) {
            pac.setConfigLocation(initParameter);
        }
        else {
            try {
                pac.setConfigLocation("/WEB-INF/portletApplicationContext.xml");
            }
            catch (UnsupportedOperationException e) {
                //Ignore, may get triggered if the context doesn't support config locations
            }
        }
        customizeContext(pc, pac);
        pac.refresh();
    }
454603
def get_context_file_name(pid_file):
    """"""
    root = os.path.dirname(pid_file)
    port_file = os.path.join(root, "context.json")
    return port_file
1208761
def _get_context_id(self):
        """"""

        from furious.context import get_current_context

        context_id = self._options.get('context_id')

        if context_id:
            return context_id

        try:
            context = get_current_context()
        except errors.NotInContextError:
            context = None
            self.update_options(context_id=None)

        if context:
            context_id = context.id
            self.update_options(context_id=context_id)

        return context_id
513502
def main(dbfile, pidfile, mode):
    '''
    
    '''
    Inspector(dbfile, pidfile).reuse_snapshot().snapshot(mode)
596820
def _clean_pid(self, pid):
        
        if isinstance(pid, (list, tuple)):
            if len(pid) == 1:
                return pid[0]
            else:
                return pid
        return pid
161293
def set_pid():
    
    global pid
    lines = '\n'.join(['import os', '_pid = os.getpid()'])

    try:
        msg_id = send(lines, silent=True, user_variables=['_pid'])
    except TypeError: # change in IPython 3.0+
        msg_id = send(lines, silent=True, user_expressions={'_pid':'_pid'})

    # wait to get message back from kernel
    try:
        child = get_child_msg(msg_id)
    except Empty:
        echo("no reply from IPython kernel")
        return
    try:
        pid = int(child['content']['user_variables']['_pid'])
    except TypeError: # change in IPython 1.0.dev moved this out
        pid = int(child['content']['user_variables']['_pid']['data']['text/plain'])
    except KeyError:    # change in IPython 3.0+
        pid = int(
            child['content']['user_expressions']['_pid']['data']['text/plain'])
    except KeyError: # change in IPython 1.0.dev moved this out
        echo("Could not get PID information, kernel not running Python?")
    return pid
1039203
def pid(self, pidnum):
        """"""
        try:

            with open(self.pidfile, "w+") as pidfile:

                pidfile.write("{0}\n".format(pidnum))

        except IOError:

            LOG.exception("Failed to write pidfile {0}).".format(self.pidfile))
            sys.exit(exit.PIDFILE_INACCESSIBLE)
230836
def unassign(pid_type, pid_value):
    """"""
    from .models import PersistentIdentifier

    obj = PersistentIdentifier.get(pid_type, pid_value)
    obj.unassign()
    db.session.commit()
    click.echo(obj.status)