// WithRuntime sets the runtime data to provide to the evaluation engine.
978034
func (s *Server) WithRuntime(term *ast.Term) *Server {
	s.runtime = term
	return s
}
295883
func loadV1Runtimes(ic *plugin.InitContext) (map[string]runtime.PlatformRuntime, error) {
	return make(map[string]runtime.PlatformRuntime), nil
}
733248
func (s *FunctionConfiguration) SetRuntime(v string) *FunctionConfiguration {
	s.Runtime = &v
	return s
}
208562
func (o *GetVersionParams) WithTimeout(timeout time.Duration) *GetVersionParams {
	o.SetTimeout(timeout)
	return o
}
727284
func WithDefaultRuntime(rt string) ClientOpt {
	return func(c *clientOpts) error {
		c.defaultRuntime = rt
		return nil
	}
}
1249254
func (hg histogramGauge) With(labelValues ...string) metrics.Gauge {
	return histogramGauge{hg.h.With(labelValues...)}
}
759040
func WithRestoreRuntime(ctx context.Context, id string, client *Client, checkpoint Image, index *imagespec.Index) NewContainerOpts {
	return func(ctx context.Context, client *Client, c *containers.Container) error {
		name, ok := index.Annotations[checkpointRuntimeNameLabel]
		if !ok {
			return ErrRuntimeNameNotFoundInIndex
		}

		// restore options if present
		m, err := GetIndexByMediaType(index, images.MediaTypeContainerd1CheckpointRuntimeOptions)
		if err != nil {
			if err != ErrMediaTypeNotFound {
				return err
			}
		}
		var options *ptypes.Any
		if m != nil {
			store := client.ContentStore()
			data, err := content.ReadBlob(ctx, store, *m)
			if err != nil {
				return errors.Wrap(err, "unable to read checkpoint runtime")
			}
			if err := proto.Unmarshal(data, options); err != nil {
				return err
			}
		}

		c.Runtime = containers.RuntimeInfo{
			Name:    name,
			Options: options,
		}
		return nil
	}
}
892608
func (s *UpdateRuntimeConfigurationInput) SetRuntimeConfiguration(v *RuntimeConfiguration) *UpdateRuntimeConfigurationInput {
	s.RuntimeConfiguration = v
	return s
}
660334
func (s *ApplicationDetail) SetRuntimeEnvironment(v string) *ApplicationDetail {
	s.RuntimeEnvironment = &v
	return s
}
438783
func (m *MockInstallation) WithRunningRegistry(arg0 logger.Logger, arg1 ui.Stage, arg2 func() error) error {
	ret := m.ctrl.Call(m, "WithRunningRegistry", arg0, arg1, arg2)
	ret0, _ := ret[0].(error)
	return ret0
}
598978
func (s *Server) monitorRuntime() {
	// Disable metrics when poll interval is zero.
	if s.metricInterval <= 0 {
		return
	}

	var m runtime.MemStats
	ticker := time.NewTicker(s.metricInterval)
	defer ticker.Stop()

	defer s.gcNotifier.Close()

	s.logger.Printf("runtime stats initializing (%s interval)", s.metricInterval)

	for {
		// Wait for tick or a close.
		select {
		case <-s.closing:
			return
		case <-s.gcNotifier.AfterGC():
			// GC just ran.
			s.holder.Stats.Count("garbage_collection", 1, 1.0)
		case <-ticker.C:
		}

		// Record the number of go routines.
		s.holder.Stats.Gauge("goroutines", float64(runtime.NumGoroutine()), 1.0)

		openFiles, err := countOpenFiles()
		// Open File handles.
		if err == nil {
			s.holder.Stats.Gauge("OpenFiles", float64(openFiles), 1.0)
		}

		// Runtime memory metrics.
		runtime.ReadMemStats(&m)
		s.holder.Stats.Gauge("HeapAlloc", float64(m.HeapAlloc), 1.0)
		s.holder.Stats.Gauge("HeapInuse", float64(m.HeapInuse), 1.0)
		s.holder.Stats.Gauge("StackInuse", float64(m.StackInuse), 1.0)
		s.holder.Stats.Gauge("Mallocs", float64(m.Mallocs), 1.0)
		s.holder.Stats.Gauge("Frees", float64(m.Frees), 1.0)
	}
}
867216
func WithRuntime(name string, options interface{}) NewContainerOpts {
	return func(ctx context.Context, client *Client, c *containers.Container) error {
		var (
			any *types.Any
			err error
		)
		if options != nil {
			any, err = typeurl.MarshalAny(options)
			if err != nil {
				return err
			}
		}
		c.Runtime = containers.RuntimeInfo{
			Name:    name,
			Options: any,
		}
		return nil
	}
}
963979
func (self *Context) RunTimer(id string) bool {
	return self.spider.RunTimer(id)
}
823404
func (c *Client) With(opts ...Opt) Opt {
	return Opts(opts).Merged().Apply(c)
}
738388
func fillRuntime(c context.Context, i *python.Interpreter, r *vpython.Runtime) error {
	// JSON fields correspond to "vpython.Runtime" fields.
	const script = `` +
		`import json, sys;` +
		`json.dump({` +
		`'path': sys.executable,` +
		`'prefix': sys.prefix,` +
		`}, sys.stdout)`

	// Probe the runtime information.
	var stdout, stderr bytes.Buffer
	cmd := i.IsolatedCommand(c, python.CommandTarget{Command: script})
	cmd.Stdout = &stdout
	if err := cmd.Run(); err != nil {
		logging.WithError(err).Errorf(c, "Failed to get runtime information:\n%s", stderr.Bytes())
		return errors.Annotate(err, "failed to get runtime information").Err()
	}

	if err := json.Unmarshal(stdout.Bytes(), r); err != nil {
		return errors.Annotate(err, "could not unmarshal output: %q", stdout.Bytes()).Err()
	}

	// "sys.executable" is allowed to be None. If it is, use the Python
	// interpreter path.
	//
	// Resolve it to an absolute path. "sys.executable" says that it must be one,
	// but we'll enforce it just to be sure.
	if r.Path == "" {
		r.Path = i.Python
	}
	if err := filesystem.AbsPath(&r.Path); err != nil {
		return err
	}

	var err error
	if r.Hash, err = hashPath(r.Path); err != nil {
		return err
	}

	return nil
}
21292
func WithData(ctx context.Context, data lager.Data) lager.Logger {
	return FromContext(ctx).WithData(data)
}
598232
func (s *CreateFleetInput) SetRuntimeConfiguration(v *RuntimeConfiguration) *CreateFleetInput {
	s.RuntimeConfiguration = v
	return s
}