Parse the process output to retrieve the expiration date and time. The result includes any configured expiration buffer.
503988
private DateTime credentialExpirationTime(JsonNode credentialsJson) {
        String expiration = getText(credentialsJson, "Expiration");

        if (expiration != null) {
            DateTime credentialExpiration = new DateTime(DateUtils.parseISO8601Date(expiration));
            credentialExpiration = credentialExpiration.minus(expirationBufferUnit.toMillis(expirationBufferValue));
            return credentialExpiration;
        } else {
            return DateTime.now().plusYears(9999);
        }
    }
1369373
def calculate_expiration(self, token):
        
        if not token:
            return None
        now = datetime.utcnow()
        time_to_live = self.config["expiration"]
        if "exp" not in token:
            return now + timedelta(seconds=time_to_live)
        elif self.config["refresh"]:
            exp = datetime.utcfromtimestamp(token["exp"])
            # 0.5: reduce refresh frequent
            if exp - now < timedelta(seconds=0.5 * time_to_live):
                return now + timedelta(seconds=time_to_live)
        return None
997473
def expiry_date(self, value):
        
        if value:
            self._expiry_date = parse(value).date() if isinstance(value, type_check) else value
1115962
def get_backend_expiry(self, expiry=DEFAULT_EXPIRY):
        
        if expiry == DEFAULT_EXPIRY:
            expiry = self.default_expiry
        elif expiry == 0:
            # avoid time.time() related precision issues
            expiry = -1
        return None if expiry is None else time.time() + expiry
1042632
def add_expiration_postfix(expiration):
    
    if re.match(r'^[1-9][0-9]*$', expiration):
        return expiration + ".0a1"

    if re.match(r'^[1-9][0-9]*\.0$', expiration):
        return expiration + "a1"

    return expiration
428091
public static String getOutputPart(ProcessOutput processOutput,String prefix)
    {
        //get output
        String output=processOutput.getOutputText();

        if(output!=null)
        {
            //set flag
            boolean validOutput=false;

            int index=output.indexOf(prefix);
            if(index!=-1)
            {
                //get index
                index=index+prefix.length();
    
                if(output.length()>index)
                {
                    //get output
                    output=output.substring(index);
                    
                    output=output.trim();
                    index=output.indexOf("\n");
                    if(index!=-1)
                    {
                        output=output.substring(0,index);
                        output=output.trim();
                    }

                    if(output.length()>0)
                    {
                        //set flag
                        validOutput=true;
                    }
                }
            }
            
            if(!validOutput)
            {
                output=null;
            }
        }
        
        return output;
    }
465995
def parse_output(self, line):
        """"""

        try:
            key, value = line.split(":")
            self.update_value(key.strip(), value.strip())
        except ValueError:
            pass
1176502
def get_build_output(self, process):
        

        while True:
            output = process.stdout.readline()
            if output == b'' and process.poll() is not None:
                if process.returncode > 0:
                    raise Exception("Compilation ended with an error"
                                    ".\nSTDERR\n%s\nSTDOUT\n%s" %
                                    (process.stderr.read(),
                                     process.stdout.read()))
                return
            if output:
                # Parse the output to get current and total tasks
                # This assumes the progress displayed by waf is in the form
                # [current/total]
                matches = re.search(r'\[\s*(\d+?)/(\d+)\].*',
                                    output.strip().decode('utf-8'))
                if matches is not None:
                    yield [int(matches.group(1)), int(matches.group(2))]
450841
def get_raw_data_from_buffer(self, filter_func=None, converter_func=None):
        '''
        '''
        if self._is_running:
            raise RuntimeError('Readout thread running')
        if not self.fill_buffer:
            logging.warning('Data buffer is not activated')
        return [convert_data_array(data_array_from_data_iterable(data_iterable), filter_func=filter_func, converter_func=converter_func) for data_iterable in self._data_buffer]
1087363
def parse(self):
        
        # Run the parser
        opt, arg = self.parser.parse_known_args(self.arguments)
        self.opt = opt
        self.arg = arg
        self.check()

        # Enable --all if no particular stat or group selected
        opt.all = not any([
            getattr(opt, stat.dest) or getattr(opt, group.dest)
            for group in self.sample_stats.stats
            for stat in group.stats])

        # Time period handling
        if opt.since is None and opt.until is None:
            opt.since, opt.until, period = did.base.Date.period(arg)
        else:
            opt.since = did.base.Date(opt.since or "1993-01-01")
            opt.until = did.base.Date(opt.until or "today")
            # Make the 'until' limit inclusive
            opt.until.date += delta(days=1)
            period = "given date range"

        # Validate the date range
        if not opt.since.date < opt.until.date:
            raise RuntimeError(
                "Invalid date range ({0} to {1})".format(
                    opt.since, opt.until.date - delta(days=1)))
        header = "Status report for {0} ({1} to {2}).".format(
            period, opt.since, opt.until.date - delta(days=1))

        # Finito
        log.debug("Gathered options:")
        log.debug('options = {0}'.format(opt))
        return opt, header
718776
def _run_expiration(self, conn):
        """"""
        # The logic here is sufficiently complicated, and we need
        # enough random keys (Redis documentation strongly encourages
        # not constructing key names in scripts) that we'll need to
        # do this in multiple steps.  This means that, when we do
        # go in and actually expire things, we need to first check
        # that they're still running.

        # Get, and clear out, the list of expiring items
        now = time.time()
        script = conn.register_script("""
        local result = redis.call("zrangebyscore", KEYS[1], 0, ARGV[1])
        redis.call("zremrangebyscore", KEYS[1], 0, ARGV[1])
        return result
        """)
        expiring = script(keys=[self._key_expiration()], args=[time.time()])
        
        # Manually expire each item one by one
        script = conn.register_script("""
        -- item may have fallen out of the worker list, if someone finished
        -- at just the very last possible moment (phew!)
        local wworker = redis.call("hget", KEYS[3], "i" .. ARGV[1])
        if not wworker then return end

        -- we want to return item, plus everything it's reserved
        local to_return = redis.call("smembers", KEYS[4])
        to_return[#to_return + 1] = ARGV[1]
        for i = 1, #to_return do
          local pri = redis.call("hget", KEYS[2], to_return[i])
          redis.call("zadd", KEYS[1], pri, to_return[i])
        end
        -- already removed from expiration list
        -- remove from worker list too
        redis.call("hdel", KEYS[3], "i" .. ARGV[1])
        redis.call("hdel", KEYS[3], wworker)
        """)
        for item in expiring:
            script(keys=[self._key_available(), self._key_priorities(),
                         self._key_workers(), self._key_reservations(item)],
                   args=[item])
975006
public int getRealExpire(int expire, String expireExpression, Object[] arguments, Object result) throws Exception {
        Integer tmpExpire = null;
        if (null != expireExpression && expireExpression.length() > 0) {
            tmpExpire = this.getElValue(expireExpression, null, arguments, result, true, Integer.class);
            if (null != tmpExpire && tmpExpire.intValue() >= 0) {
                // 返回缓存时间表达式计算的时间
                return tmpExpire.intValue();
            }
        }
        return expire;
    }
60577
def _on_process_finished(self):
        
        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()
545826
private byte[] collectProcessResultsBytes(Process process, ProcessBuilder builder,
      SubProcessIOFiles outPutFiles) throws Exception {

    Byte[] results;

    try {

      LOG.debug(String.format("Executing process %s", createLogEntryFromInputs(builder.command())));

      // If process exit value is not 0 then subprocess failed, record logs
      if (process.exitValue() != 0) {
        outPutFiles.copyOutPutFilesToBucket(configuration, FileUtils.toStringParams(builder));
        String log = createLogEntryForProcessFailure(process, builder.command(), outPutFiles);
        throw new Exception(log);
      }

      // If no return file then either something went wrong or the binary is setup incorrectly for
      // the ret file either way throw error
      if (!Files.exists(outPutFiles.resultFile)) {
        String log = createLogEntryForProcessFailure(process, builder.command(), outPutFiles);
        outPutFiles.copyOutPutFilesToBucket(configuration, FileUtils.toStringParams(builder));
        throw new Exception(log);
      }

      // Everything looks healthy return bytes
      return Files.readAllBytes(outPutFiles.resultFile);

    } catch (Exception ex) {
      String log = String.format("Unexpected error runnng process. %s error message was %s",
          createLogEntryFromInputs(builder.command()), ex.getMessage());
      throw new Exception(log);
    }
  }
824766
def _expire_data(self):
        
        expire_time_stamp = time.time() - self.expire_time
        self.timed_data   = {d: t for d, t in self.timed_data.items()
                             if t > expire_time_stamp}
300554
def _analyze_result(self, exitcode, output, isTimeout, termination_reason):
        """"""

        # Ask tool info.
        tool_status = None
        if exitcode is not None:
            logging.debug("My subprocess returned %s.", exitcode)
            tool_status = self.runSet.benchmark.tool.determine_result(
                exitcode.value or 0, exitcode.signal or 0, output, isTimeout)

            if tool_status in result.RESULT_LIST_OTHER:
                # for unspecific results provide some more information if possible
                if exitcode.signal == 6:
                    tool_status = 'ABORTED'
                elif exitcode.signal == 11:
                    tool_status = 'SEGMENTATION FAULT'
                elif exitcode.signal == 15:
                    tool_status = 'KILLED'
                elif exitcode.signal:
                    tool_status = 'KILLED BY SIGNAL '+str(exitcode.signal)

                elif exitcode.value:
                    tool_status = '{} ({})'.format(result.RESULT_ERROR, exitcode.value)

        # Tools sometimes produce a result even after violating a resource limit.
        # This should not be counted, so we overwrite the result with TIMEOUT/OOM
        # here, if this is the case.
        # However, we don't want to forget more specific results like SEGFAULT,
        # so we do this only if the result is a "normal" one like TRUE/FALSE
        # or an unspecific one like UNKNOWN/ERROR.
        status = None
        if isTimeout:
            status = "TIMEOUT"
        elif termination_reason:
            status = _ERROR_RESULTS_FOR_TERMINATION_REASON.get(termination_reason, termination_reason)

        if not status:
            # regular termination
            status = tool_status
        elif tool_status and tool_status not in (
                result.RESULT_LIST_OTHER + [status, 'KILLED', 'KILLED BY SIGNAL 9']):
            # timeout/OOM but tool still returned some result
            status = '{} ({})'.format(status, tool_status)

        return status
348819
public void doProcess(HttpServletRequest req, HttpServletResponse res) 
        throws ServletException, IOException
    {
        try {
            res.setDateHeader("Expires", 0);        // Make sure the browser never caches these requests
            res.setHeader("Pragma", "No-cache");
            res.setHeader("Cache-Control", "no-cache");
            m_servletTask.doProcess(this, req, res, null);
        } catch (Throwable ex)  {
            ex.printStackTrace();
        }
    }