id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c15300 | won't show
// misses for the interval while stopped.
t.lastFireTime = time.Time{}
if t.state == core.TaskStopped || t.state == core.TaskEnded {
t.state = core.TaskSpinning
t.killChan = make(chan struct{})
// spin in a goroutine
go t.spin()
}
} | |
c15301 | {
continue
}
t.hitCount++
consecutiveFailures = 0
t.workflow.StreamStart(t, mts)
case err := <-errChan:
taskLogger.WithFields(log.Fields{
"_block": "stream",
"task-id": t.id,
"task-name": t.name,
}).Error("Error: " + err.Error())
consecutiveFailures++
if err.... | |
c15302 | := mgr.UnsubscribeDeps(t.ID())
if len(uerrs) > 0 {
errs = append(errs, uerrs...)
}
}
}
for _, err := range errs {
taskLogger.WithFields(log.Fields{
"_block": "UnsubscribePlugins",
"task-id": t.id,
"task-name": t.name,
"task-state": t.state,
}).Error(err)
}
return errs
} | |
c15303 | errs = append(errs, serror.New(err))
} else {
// sending empty mts to unsubscribe to indicate task should not start
uerrs := mgr.UnsubscribeDeps(t.ID())
errs = append(errs, uerrs...)
}
}
return nil, errs
}
// If subscribed successfully add to subbedDeps
subbedDeps = append(subbedDep... | |
c15304 | return ErrTaskNotDisabled
}
t.state = core.TaskStopped
return nil
} | |
c15305 | event.Why = fmt.Sprintf("Task disabled with error: %s", failureMsg)
defer t.eventEmitter.Emit(event)
} | |
c15306 | t.failedRuns++
t.lastFailureTime = t.lastFireTime
t.lastFailureMessage = e[len(e)-1].Error()
} | |
c15307 | t.table[id]; ok {
return t
}
return nil
} | |
c15308 |
"_block": "add",
"task id": task.id,
}).Error(ErrTaskHasAlreadyBeenAdded.Error())
return ErrTaskHasAlreadyBeenAdded
}
return nil
} | |
c15309 | }).Error(ErrTaskNotStopped)
return ErrTaskNotStopped
}
delete(t.table, task.id)
} else {
taskLogger.WithFields(log.Fields{
"_block": "remove",
"task id": task.id,
}).Error(ErrTaskNotFound)
return ErrTaskNotFound
}
return nil
} | |
c15310 |
tasks := make(map[string]*task)
for id, t := range t.table {
tasks[id] = t
}
return tasks
} | |
c15311 | walkWorkflow(wf.processNodes, wf.publishNodes, mgrs)
} | |
c15312 | && ap != nil {
return ap, nil
}
return s.selectPlugin(aps, taskID)
} | |
c15313 | func(r *runner) {
r.grpcSecurity = grpcSecurity
}
} | |
c15314 | }
// For each delegate register needed handlers
for _, del := range r.delegates {
e := del.RegisterHandler(HandlerRegistrationName, r)
if e != nil {
return e
}
}
// Start the monitor
r.monitor.Start(r.availablePlugins)
runnerLog.WithFields(log.Fields{
"_block": "start",
}).Debug("started")
return ... | |
c15315 | != nil {
errs = append(errs, e)
}
}
defer runnerLog.WithFields(log.Fields{
"_block": "start-plugin",
}).Debug("stopped")
return errs
} | |
c15316 |
Id: v.Id,
Name: v.Name,
Version: v.Version,
Key: v.Key,
Type: v.Type,
})
}
}
case *control_event.PluginUnsubscriptionEvent:
runnerLog.WithFields(log.Fields{
"_block": "subscribe-pool",
"event": v.Namespace(),
"plugin-name": v.PluginName,
... | |
c15317 | q.status = queueRunning
go q.start()
}
} | |
c15318 | close(q.kill)
q.status = queueStopped
}
} | |
c15319 | "http") {
return false
}
return true
} | |
c15320 | Minimum ctypes.ConfigValue `json:"minimum,omitempty"`
Maximum ctypes.ConfigValue `json:"maximum,omitempty"`
Type string `json:"type"`
}{
Key: i.key,
Required: i.required,
Default: i.Default(),
Minimum: i.Minimum(),
Maximum: i.Maximum(),
Type: IntegerType,
})
} | |
c15321 | is_minimum_set {
if err := decoder.Decode(&i.minimum); err != nil {
return err
}
}
var is_maximum_set bool
decoder.Decode(&is_maximum_set)
if is_maximum_set {
if err := decoder.Decode(&i.maximum); err != nil {
return err
}
}
return nil
} | |
c15322 | return ctypes.ConfigValueInt{Value: *i.default_}
}
return nil
} | |
c15323 | serrs := cfgfile.Read(path, &cfg, CONFIG_CONSTRAINTS)
if serrs != nil {
for _, serr := range serrs {
log.WithFields(serr.Fields()).Error(serr.Error())
}
log.Fatal("Errors found while parsing global configuration file")
}
} | |
c15324 | field
val := ctx.Bool(flagName)
if ctx.IsSet(flagName) || val {
field = val
if len(inverse) > 0 {
field = !field
}
}
return field
} | |
c15325 | ctx.Int("api-port")
if ctx.IsSet("api-addr") || addr != "" {
portInAddr, err := checkHostPortVals(addr, &port, commandLineErrorPrefix)
if err != nil {
return -1, portInAddr, err
}
return port, portInAddr, nil
}
return port, false, nil
} | |
c15326 | -1, false, err
}
addr := cfg.RestAPI.Address
var port int
if cfg.RestAPI.PortSetByConfigFile() {
port = cfg.RestAPI.Port
} else {
port = -1
}
portInAddr, err := checkHostPortVals(addr, &port, configFileErrorPrefix)
if err != nil {
return -1, portInAddr, err
}
return port, portInAddr, nil
} | |
c15327 | logModule,
"maxprocs": _maxProcs,
}).Warning("Setting GOMAXPROCS to number of CPUs on host")
}
log.Info("setting GOMAXPROCS to: ", _maxProcs, " core(s)")
runtime.GOMAXPROCS(_maxProcs)
//Verify setting worked
actualNumProcs := runtime.GOMAXPROCS(0)
if actualNumProcs != _maxProcs {
log.WithFields(
log... | |
c15328 |
panic("You are trying to wrap a snapError around a snapError. Don't do this.")
}
p := &snapError{
err: e,
fields: make(map[string]interface{}),
}
// insert fields into new snapError
for _, f := range fields {
for k, v := range f {
p.fields[k] = v
}
}
return p
} | |
c15329 | m.duration = v
return MonitorDurationOption(previous)
}
} | |
c15330 | for _, ap := range availablePlugins.all() {
if !ap.IsRemote() {
go ap.CheckHealth()
}
}
availablePlugins.RUnlock()
}()
case <-m.quit:
ticker.Stop()
m.State = MonitorStopped
return
}
}
}()
m.State = MonitorStarted
} | |
c15331 | "test%>"}, "name", false, plugin.SetDefaultString("bob"))
if err != nil {
return *p, err
}
err = p.AddNewStringRule([]string{"intel", "mock", "/foo=㊽"}, "password", true)
return *p, err
} | |
c15332 | if err != nil {
r.Err = err
return r
}
switch resp.Meta.Type {
case rbody.PluginConfigItemType:
// Success
config := resp.Body.(*rbody.PluginConfigItem)
r = &GetPluginConfigResult{config, nil}
case rbody.ErrorType:
r.Err = resp.Body.(*rbody.Error)
default:
r.Err = ErrAPIResponseMetaType
}
return ... | |
c15333 | url.QueryEscape(name), version), ContentTypeJSON, b)
if err != nil {
r.Err = err
return r
}
switch resp.Meta.Type {
case rbody.SetPluginConfigItemType:
// Success
config := resp.Body.(*rbody.SetPluginConfigItem)
r = &SetPluginConfigResult{config, nil}
case rbody.ErrorType:
r.Err = resp.Body.(*rbody.E... | |
c15334 | config := resp.Body.(*rbody.DeletePluginConfigItem)
r = &DeletePluginConfigResult{config, nil}
case rbody.ErrorType:
r.Err = resp.Body.(*rbody.Error)
default:
r.Err = ErrAPIResponseMetaType
}
return r
} | |
c15335 | "error": err.Error(),
}).Error("Unable to determine hostname")
host = "not_found"
}
hostnameReader = &hostnameReaderType{hostname: host, hostnameRefreshTTL: time.Hour, lastRefresh: time.Now()}
} | |
c15336 | = []string{}
mts := mc.tree.gatherMetricTypes()
for _, m := range mts {
mc.keys = append(mc.keys, m.Namespace().String())
}
} | |
c15337 | a cataloged keys (mc.keys)
mc.keys = appendIfMissing(mc.keys, key)
mc.tree.Add(m)
} | |
c15338 | catalogedmt.Plugin,
namespace: ns,
version: catalogedmt.Version(),
lastAdvertisedTime: catalogedmt.LastAdvertisedTime(),
tags: catalogedmt.Tags(),
policy: catalogedmt.Plugin.Policy().Get(catalogedmt.Namespace().Strings()),
config: catalogedmt.Conf... | |
c15339 | "metrics.go,",
"_block": "get-versions",
"error": err,
}).Error("error getting plugin version")
return nil, err
}
return mts, nil
} | |
c15340 | defer mc.mutex.Unlock()
mc.tree.Remove(ns.Strings())
} | |
c15341 | "metrics.go,",
"_block": "subscribe",
"error": err,
}).Error("error getting metric")
return err
}
m.Subscribe()
return nil
} | |
c15342 | '*' as a tuple's items
tupleItems = []string{"*"}
} else {
tuple := strings.TrimSuffix(strings.TrimPrefix(nsElement, core.TuplePrefix), core.TupleSuffix)
items := strings.Split(tuple, core.TupleSeparator)
// removing all leading and trailing white space
for _, item := range items {
tupleItems = ap... | |
c15343 | := catalogedNamespace.IsDynamic()
for _, index := range indexes {
if len(requestedNamespace) > index {
// use namespace's element of requested metric declared in task manifest
// to specify a dynamic instance of the cataloged metric
specifiedNamespace[index].Value = requestedNamespace[index].Value
}
}
... | |
c15344 | }
if i.Name == "" && i.Value == "*" {
return errorMetricDynamicElementHasNoName(i.Value, ns.String())
}
if isTuple(i.Value) {
return errorMetricElementHasTuple(i.Value, ns.String())
}
value += i.Value
}
// plugin should NOT advertise metrics ending with a wildcard
if strings.HasSuffix(value, "*") {
... | |
c15345 | `json:"required"`
Default ctypes.ConfigValue `json:"default,omitempty"`
Type string `json:"type"`
}{
Key: b.key,
Required: b.required,
Default: b.Default(),
Type: BoolType,
})
} | |
c15346 | == nil {
encoder.Encode(false)
} else {
encoder.Encode(true)
if err := encoder.Encode(&b.default_); err != nil {
return nil, err
}
}
return w.Bytes(), nil
} | |
c15347 | return err
}
var isDefaultSet bool
decoder.Decode(&isDefaultSet)
if isDefaultSet {
return decoder.Decode(&b.default_)
}
return nil
} | |
c15348 |
return wrongType(b.key, cv.Type(), BoolType)
}
return nil
} | |
c15349 | return ctypes.ConfigValueBool{Value: *b.default_}
}
return nil
} | |
c15350 | s.plugin.GetConfigPolicy()
if err != nil {
return errors.New(fmt.Sprintf("GetConfigPolicy call error : %s", err.Error()))
}
r := GetConfigPolicyReply{Policy: policy}
*reply, err = s.Encode(r)
if err != nil {
return err
}
return nil
} | |
c15351 | any context.
s.ResetHeartbeat()
s.logger.Debug("Ping received")
*reply = []byte{}
return nil
} | |
c15352 |
return err
}
s.logger.Debugf("Kill called by agent, reason: %s\n", a.Reason)
go func() {
time.Sleep(time.Second * 2)
s.killChan <- 0
}()
*reply = []byte{}
return nil
} | |
c15353 | mt.Plugin.TypeName(), mt.Plugin.Name(), mt.Plugin.Version())
cpKey := fmt.Sprintf("%s"+core.Separator+"%s"+core.Separator+"%d", cp.TypeName(), cp.Name(), cp.Version())
if mtPluginKey == cpKey {
// remove this metric
m.RemoveMetric(mt)
}
}
} | |
c15354 | {
// delete this metric from the node
delete(a.mts, v)
}
}
}
} | |
c15355 | node.children = make(map[string]*mttNode)
}
node.children[n.Value] = &mttNode{}
node = node.children[n.Value]
}
node.mts = make(map[int]*metricType)
node.mts[mt.Version()] = mt
} | |
c15356 |
}
}
if len(mts) == 0 && len(ns) > 0 {
return nil, errorMetricsNotFound("/" + strings.Join(ns, "/"))
}
return mts, nil
} | |
c15357 | remove node from parent
delete(parent.children, ns[len(ns)-1:][0])
return nil
} | |
c15358 | versions into a single slice
for _, mt := range node.mts {
mts = append(mts, mt)
}
}
if len(mts) == 0 {
return nil, errorMetricNotFound("/" + strings.Join(ns, "/"))
}
return mts, nil
} | |
c15359 | node.children != nil {
children = gatherDescendants(children, node)
}
return children
} | |
c15360 | nodes = append(nodes, children...)
return nodes
}
children = parent.gatherChildren(ns[0])
for _, child := range children {
nodes = child.search(nodes, ns[1:])
}
return nodes
} | |
c15361 | != nil {
descendants = gatherDescendants(descendants, child)
}
}
return descendants
} | |
c15362 | `json:"type"`
}{
Key: s.key,
Required: s.required,
Default: s.Default(),
Type: StringType,
})
} | |
c15363 | return err
}
var is_default_set bool
decoder.Decode(&is_default_set)
if is_default_set {
return decoder.Decode(&s.default_)
}
return nil
} | |
c15364 |
return wrongType(s.key, cv.Type(), StringType)
}
return nil
} | |
c15365 | return ctypes.ConfigValueStr{Value: *s.default_}
}
return nil
} | |
c15366 | "block": "stop",
"plugin_name": a,
}).Info("stopping available plugin")
if a.IsRemote() {
return a.client.Close()
}
return a.client.Kill(r)
} | |
c15367 | If it's a streaming plugin, we need to signal the scheduler that
// this plugin is being killed.
if c, ok := a.client.(client.PluginStreamCollectorClient); ok {
c.Killed()
}
if a.ePlugin != nil {
return a.ePlugin.Kill()
}
return nil
} | |
c15368 | a,
}).Debug("health is ok")
}
a.failedHealthChecks = 0
} else {
a.healthCheckFailed()
}
case <-time.After(DefaultHealthCheckTimeout):
a.healthCheckFailed()
}
} | |
c15369 | a.name,
Version: a.version,
Type: int(a.pluginType),
Key: a.key,
Id: a.ID(),
String: a.String(),
}
defer a.emitter.Emit(pde)
}
hcfe := &control_event.HealthCheckFailedEvent{
Name: a.name,
Version: a.version,
Type: int(a.pluginType),
}
defer a.emitter.Emit(hcfe)
} | |
c15370 | &CreateTaskResult{Err: err}
}
switch resp.Meta.Type {
case rbody.AddScheduledTaskType:
// Success
return &CreateTaskResult{resp.Body.(*rbody.AddScheduledTask), nil}
case rbody.ErrorType:
return &CreateTaskResult{Err: resp.Body.(*rbody.Error)}
default:
return &CreateTaskResult{Err: ErrAPIResponseMetaType}... | |
c15371 | if sline == "" || sline == "\n" {
continue
}
if strings.HasPrefix(sline, "data:") {
sline = strings.TrimPrefix(sline, "data:")
line = []byte(sline)
}
ste := &rbody.StreamedTaskEvent{}
err := json.Unmarshal(line, ste)
if err != nil {
r.Err = err
r.Close()
return
... | |
c15372 | &GetTasksResult{resp.Body.(*rbody.ScheduledTaskListReturned), nil}
case rbody.ErrorType:
return &GetTasksResult{Err: resp.Body.(*rbody.Error)}
default:
return &GetTasksResult{Err: ErrAPIResponseMetaType}
}
} | |
c15373 | {
case rbody.ScheduledTaskReturnedType:
// Success
return &GetTaskResult{resp.Body.(*rbody.ScheduledTaskReturned), nil}
case rbody.ErrorType:
return &GetTaskResult{Err: resp.Body.(*rbody.Error)}
default:
return &GetTaskResult{Err: ErrAPIResponseMetaType}
}
} | |
c15374 | {
case rbody.ScheduledTaskStartedType:
// Success
return &StartTasksResult{resp.Body.(*rbody.ScheduledTaskStarted), nil}
case rbody.ErrorType:
return &StartTasksResult{Err: resp.Body.(*rbody.Error)}
default:
return &StartTasksResult{Err: ErrAPIResponseMetaType}
}
} | |
c15375 | return &StopTasksResult{resp.Body.(*rbody.ScheduledTaskStopped), nil}
case rbody.ErrorType:
return &StopTasksResult{Err: resp.Body.(*rbody.Error)}
default:
return &StopTasksResult{Err: ErrAPIResponseMetaType}
}
} | |
c15376 | {
case rbody.ScheduledTaskRemovedType:
// Success
return &RemoveTasksResult{resp.Body.(*rbody.ScheduledTaskRemoved), nil}
case rbody.ErrorType:
return &RemoveTasksResult{Err: resp.Body.(*rbody.Error)}
default:
return &RemoveTasksResult{Err: ErrAPIResponseMetaType}
}
} | |
c15377 |
switch resp.Meta.Type {
case rbody.ScheduledTaskEnabledType:
return &EnableTaskResult{resp.Body.(*rbody.ScheduledTaskEnabled), nil}
case rbody.ErrorType:
return &EnableTaskResult{Err: resp.Body.(*rbody.Error)}
default:
return &EnableTaskResult{Err: ErrAPIResponseMetaType}
}
} | |
c15378 | ok := m["rules"]; ok {
if rules, ok := rs.(map[string]interface{}); ok {
addRulesToConfigPolicyNode(rules, c)
}
}
return nil
} | |
c15379 |
defer p.mutex.Unlock()
for _, r := range rules {
p.rules[r.Key()] = r
}
} | |
c15380 | // Validate versus matching data
e := rule.Validate(cv)
if e != nil {
pErrors.AddError(e)
}
} else {
// If it was required add error
if rule.Required() {
e := fmt.Errorf("required key missing (%s)", key)
pErrors.AddError(e)
} else {
// If default returns we should add it
cv := ... | |
c15381 | r.default_ = &def
}
cpn.Add(r)
case "float":
r, _ := NewFloatRule(k, req)
if d, ok := rule["default"]; ok {
def, _ := d.(float64)
r.default_ = &def
}
if m, ok := rule["minimum"]; ok {
min, _ := m.(float64)
r.minimum = &min
}
if m, ok := rule["maximum"]; ok {
... | |
c15382 | a.CertPath = certPath
return a
} | |
c15383 | a.KeyPath = keyPath
return a
} | |
c15384 | a.TLSEnabled = tlsEnabled
return a
} | |
c15385 | a.CACertPaths = caCertPaths
return a
} | |
c15386 | PingTimeoutDurationDefault,
Pprof: pprof,
}
} | |
c15387 | the count cannot be specified simultaneously. The parameter `count` has been ignored.")
}
return &WindowedSchedule{
Interval: i,
StartTime: start,
StopTime: stop,
Count: count,
}
} | |
c15388 |
newStop = time.Now().Add(time.Duration(w.Count) * w.Interval)
}
// set calculated new stop
w.stopOnTime = &newStop
return
}
// stopOnTime is determined by StopTime
w.stopOnTime = w.StopTime
} | |
c15389 | stop time is before
// the start time, return an error
if w.StopTime != nil && w.StartTime != nil && w.StopTime.Before(*w.StartTime) {
return ErrStopBeforeStart
}
// if the interval is less than zero, return an error
if w.Interval <= 0 {
return ErrInvalidInterval
}
// the schedule passed validation, set as... | |
c15390 | = waitOnInterval(last, w.Interval)
// check if the schedule should be ended after waiting on interval
if time.Now().After(*w.stopOnTime) {
logger.WithFields(log.Fields{
"_block": "windowed-wait",
}).Debug("schedule has ended")
w.state = Ended
}
} else {
logger.WithFields(log.Fields{
... | |
c15391 | ip = v.IP
}
if ip == nil || ip.IsLoopback() {
continue
}
ip = ip.To4()
if ip == nil {
continue // not an ipv4 address
}
return ip.String()
}
}
return "127.0.0.1"
} | |
c15392 | lp.Meta.Name,
"plugin-version": lp.Meta.Version,
"plugin-type": lp.Type.String(),
})
}
l.table[lp.Key()] = lp
return nil
} | |
c15393 | if v < 1 {
pmLogger.Info("finding latest plugin")
return l.findLatest(tnv[0], tnv[1])
}
return nil, ErrPluginNotFound
}
return lp, nil
} | |
c15394 | ator+"%d", lp.TypeName(), lp.Name(), lp.Version())
} | |
c15395 | func(p *pluginManager) {
p.grpcSecurity = grpcSecurity
}
} | |
c15396 | func(p *pluginManager) {
p.pluginTags = tags
}
} | |
c15397 | map[string]map[string]string) {
p.pluginTags = tags
} | |
c15398 | return plugin.NewArg(logLevel, p.pprof)
} | |
c15399 | httprouter.New()
// CORS has to be turned on explicitly in the global config.
// Otherwise, it defauts to the same origin.
origins, err := s.getAllowedOrigins(cfg.Corsd)
if err != nil {
return nil, err
}
if len(origins) > 0 {
c := cors.New(cors.Options{
AllowedOrigins: origins,
AllowedMethods: []strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.