id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c169300
aws.StringValue(roleCredentials.AccessKeyId), SecretAccessKey: aws.StringValue(roleCredentials.SecretAccessKey), Expiration: aws.StringValue(roleCredentials.Expiration), RoleType: roleType, } }
c169301
empty") } manager.idToTaskCredentials[credentials.CredentialsID] = TaskIAMRoleCredentials{ ARN: taskCredentials.ARN, IAMRoleCredentials: taskCredentials.GetIAMRoleCredentials(), } return nil }
c169302
return TaskIAMRoleCredentials{ ARN: taskCredentials.ARN, IAMRoleCredentials: taskCredentials.GetIAMRoleCredentials(), }, ok }
c169303
manager.taskCredentialsLock.Unlock() delete(manager.idToTaskCredentials, id) }
c169304
for _, field := range expectedFields { if _, ok := responseMap[field]; !ok { return fmt.Errorf("missing field '%s' in %s response", field, responseName) } } return nil }
c169305
"Getpid") ret0, _ := ret[0].(int) return ret0 }
c169306
"Getpid", reflect.TypeOf((*MockOS)(nil).Getpid)) }
c169307
ProxyEgressPort: aws.StringValue(proxyConfig.Properties[proxyEgressPort]), AppPorts: buildAppPorts(proxyConfig), EgressIgnoredIPs: buildEgressIgnoredIPs(proxyConfig), EgressIgnoredPorts: buildEgressIgnoredPorts(proxyConfig), }, nil }
c169308
strings.Split(*proxyConfig.Properties[appPorts], splitter) } return inputAppPorts }
c169309
!= nil { inputEgressIgnoredIPs = strings.Split(*proxyConfig.Properties[egressIgnoredIPs], splitter) } // append agent default egress ignored IPs return appendDefaultEgressIgnoredIPs(inputEgressIgnoredIPs) }
c169310
!= nil { inputEgressIgnoredPorts = strings.Split(*proxyConfig.Properties[egressIgnoredPorts], splitter) } return inputEgressIgnoredPorts }
c169311
= true } if strings.TrimSpace(egressIgnoredIP) == instanceMetadataEndpointIP { hasInstanceMetadataEndpointIP = true } } if !hasTaskMetadataEndpointIP { egressIgnoredIPs = append(egressIgnoredIPs, taskMetadataEndpointIP) } if !hasInstanceMetadataEndpointIP { egressIgnoredIPs = append(egressIgnoredIPs, instanceMetadataEndpointIP) } return egressIgnoredIPs }
c169312
return strings.Contains(awserr.Message(), InstanceTypeChangedErrorMessage) } return false }
c169313
ok { return &DefaultNamedError{Err: namedErr.Error(), Name: namedErr.ErrorName()} } return &DefaultNamedError{Err: err.Error()} }
c169314
cannot be initialized for task %s: %v", err.taskARN, err.origErr) }
c169315
NOTE: task memory specifications are optional if task.Memory > 0 { linuxMemorySpec, err := task.buildLinuxMemorySpec() if err != nil { return specs.LinuxResources{}, err } linuxResourceSpec.Memory = &linuxMemorySpec } return linuxResourceSpec, nil }
c169316
assume a fixed evaluation period of 100ms (100000us), // we'd need a quota of 12800000us, which is longer than the maximum of 1000000. // For 128 vCPUs, we'd probably need something like a 1ms (1000us - the minimum) // evaluation period, an 128000us quota in order to stay within the min/max limits. return specs.LinuxCPU{ Quota: &taskCPUQuota, Period: &taskCPUPeriod, }, nil }
c169317
default task CPU shares if taskCPUShares == 0 { // Set default CPU shares taskCPUShares = minimumCPUShare } return specs.LinuxCPU{ Shares: &taskCPUShares, } }
c169318
errors.Errorf("task memory spec builder: container memory limit(%d) greater than task memory limit(%d)", containerMemoryLimit, task.Memory) } } // Kernel expects memory to be expressed in bytes memoryBytes := task.Memory * bytesPerMegabyte return specs.LinuxMemory{ Limit: &memoryBytes, }, nil }
c169319
Override cgroup parent return task.overrideCgroupParent(hostConfig) }
c169320
errors.Wrapf(err, "task cgroup override: unable to obtain cgroup root for task: %s", task.Arn) } hostConfig.CgroupParent = cgroupRoot } return nil }
c169321
dev, netlinkClient: netlinkClient, ctx: ctx, timeout: timeout, } return retriever.retrieve() }
c169322
return nil }) if err != nil { return "", err } // RetryWithBackoffCtx returns nil when the context is cancelled. Check if there was // a timeout here. TODO: Fix RetryWithBackoffCtx to return ctx.Err() on context Done() if err = ctx.Err(); err != nil { return "", errors.Wrapf(err, "eni mac address: timed out waiting for eni device '%s'", retriever.dev) } return retriever.macAddress, nil }
c169323
apierrors.NewRetriableError(apierrors.NewRetriable(false), err) } retriever.macAddress = link.Attrs().HardwareAddr.String() return nil }
c169324
*/ if strings.HasPrefix(splitDevLink[1], pciDevicePrefix) || strings.HasPrefix(splitDevLink[1], vifDevicePrefix) { return true } if strings.HasPrefix(splitDevLink[1], virtualDevicePrefix) { return false } // NOTE: Should never reach here seelog.Criticalf("Failed to validate device path: %s", devicePath) return false }
c169325
return eventLog.Warning(eventLogID, message) case seelog.ErrorLvl, seelog.CriticalLvl: return eventLog.Error(eventLogID, message) } return nil }
c169326
} if len(output.AuthorizationData) != 1 { return nil, fmt.Errorf("unexpected number of results in AuthorizationData (%d)", len(output.AuthorizationData)) } return output.AuthorizationData[0], nil }
c169327
mock.recorder = &MockEngineMockRecorder{mock} return mock }
c169328
ret[0].(*types.StatsJSON) ret1, _ := ret[1].(error) return ret0, ret1 }
c169329
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDockerStats", reflect.TypeOf((*MockEngine)(nil).ContainerDockerStats), arg0, arg1) }
c169330
:= ret[1].([]*ecstcs.TaskMetric) ret2, _ := ret[2].(error) return ret0, ret1, ret2 }
c169331
"GetInstanceMetrics", reflect.TypeOf((*MockEngine)(nil).GetInstanceMetrics)) }
c169332
:= ret[1].([]*ecstcs.TaskHealth) ret2, _ := ret[2].(error) return ret0, ret1, ret2 }
c169333
RetryWithBackoffCtx(context.Background(), backoff, fn) }
c169334
:= err.(apierrors.Retriable) if err == nil || (isRetriableErr && !retriableErr.Retry()) { return err } _time.Sleep(backoff.Duration()) } }
c169335
return RetryNWithBackoffCtx(context.Background(), backoff, n, fn) }
c169336
== 0 { // Break out after n tries return nil } return err }) return err }
c169337
0 { randJitter = 0 } else { randJitter = rand.Int63n(jitter.Nanoseconds()) } return time.Duration(duration.Nanoseconds() + randJitter) }
c169338
mock.recorder = &MockIOUtilMockRecorder{mock} return mock }
c169339
error { ret := m.ctrl.Call(m, "WriteFile", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 }
c169340
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteFile", reflect.TypeOf((*MockIOUtil)(nil).WriteFile), arg0, arg1, arg2) }
c169341
// Convert ec2 tags to ecs tags for _, ec2Tag := range res.Tags { // Filter out all tags "aws:" prefix if !strings.HasPrefix(strings.ToLower(aws.StringValue(ec2Tag.Key)), awsTagPrefix) && !strings.HasPrefix(strings.ToLower(aws.StringValue(ec2Tag.Value)), awsTagPrefix) { tags = append(tags, &ecs.Tag{ Key: ec2Tag.Key, Value: ec2Tag.Value, }) } } return tags, nil }
c169342
utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats) return } if containerID, ok := utils.GetMuxValueFromRequest(r, statsContainerIDMuxName); ok { seelog.Infof("V2 task/container stats handler: writing response for container '%s'", containerID) WriteContainerStatsResponse(w, taskARN, containerID, statsEngine) return } seelog.Infof("V2 task/container stats handler: writing response for task '%s'", taskARN) WriteTaskStatsResponse(w, taskARN, state, statsEngine) } }
c169343
for: " + taskARN) utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeTaskStats) return } responseJSON, _ := json.Marshal(taskStatsResponse) utils.WriteJSONToResponse(w, http.StatusOK, responseJSON, utils.RequestTypeTaskStats) }
c169344
:= json.Marshal("Unable to get container stats for: " + containerID) utils.WriteJSONToResponse(w, http.StatusBadRequest, errResponseJSON, utils.RequestTypeContainerStats) return } responseJSON, _ := json.Marshal(dockerStats) utils.WriteJSONToResponse(w, http.StatusOK, responseJSON, utils.RequestTypeContainerStats) }
c169345
(knownBackendStatus == "STOPPED" && desiredStatus != "STOPPED") || (knownBackendStatus == "RUNNING" && desiredStatus == "PENDING") { desiredStatus = "" } return &TaskResponse{ Arn: task.Arn, DesiredStatus: desiredStatus, KnownStatus: knownBackendStatus, Family: task.Family, Version: task.Version, Containers: containers, } }
c169346
nil { resp.Networks = []containermetadata.Network{ { NetworkMode: utils.NetworkModeAWSVPC, IPv4Addresses: eni.GetIPV4Addresses(), IPv6Addresses: eni.GetIPV6Addresses(), }, } } return resp }
c169347
PortResponse{ ContainerPort: binding.ContainerPort, Protocol: binding.Protocol.String(), } if eni == nil { port.HostPort = binding.HostPort } else { port.HostPort = port.ContainerPort } resp = append(resp, port) } return resp }
c169348
DockerName: volume.Name, Source: volume.Source, Destination: volume.Destination, } resp = append(resp, volResp) } return resp }
c169349
for ndx, task := range allTasks { containerMap, _ := state.ContainerMapByArn(task.Arn) taskResponses[ndx] = NewTaskResponse(task, containerMap) } return &TasksResponse{Tasks: taskResponses} }
c169350
metadata, TaskMetrics: taskMetrics, Timestamp: aws.Time(time.Now()), } }
c169351
{ return &PublishHealthRequest{ Metadata: metadata, Tasks: healthMetrics, Timestamp: aws.Time(time.Now()), } }
c169352
event := <-eventChan go buffer.CopyEvents(&event) } return case event := <-eventChan: go buffer.CopyEvents(&event) } } }
c169353
if event.Status == containerEvent { buffer.lock.Lock() defer buffer.lock.Unlock() buffer.events = append(buffer.events, event) // Check if there is consumer waiting for events if buffer.empty { buffer.empty = false // Unblock the consumer buffer.waitForEvent.Done() } return } } }
c169354
} else { event := buffer.events[0] buffer.events = buffer.events[1:] buffer.lock.Unlock() // Send event to the buffer listener in <- event } } }
c169355
container stats handler: unable to get container ID from request: %s", err.Error())) utils.WriteJSONToResponse(w, http.StatusBadRequest, responseJSON, utils.RequestTypeContainerStats) return } seelog.Infof("V3 container stats handler: writing response for container '%s'", containerID) // v3 handler shares the same container stats response format with v2 handler. v2.WriteContainerStatsResponse(w, taskARN, containerID, statsEngine) } }
c169356
case ECSClient: return NewGenericMetricsClient(ECSClientSubsystem, registry) default: seelog.Error("Unmanaged MetricsClient cannot be created.") return nil } }
c169357
mock.recorder = &MockECRSDKMockRecorder{mock} return mock }
c169358
mock.recorder = &MockECRFactoryMockRecorder{mock} return mock }
c169359
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockECRFactory)(nil).GetClient), arg0) }
c169360
mock.recorder = &MockECRClientMockRecorder{mock} return mock }
c169361
getCredentialsEventType case credentials.ExecutionRoleType: return getCredentialsTaskExecutionEventType default: return getCredentialsInvalidRoleTypeEventType } }
c169362
mock.recorder = &MockGPUManagerMockRecorder{mock} return mock }
c169363
ret := m.ctrl.Call(m, "GetDevices") ret0, _ := ret[0].([]*ecs.PlatformDevice) return ret0 }
c169364
ret0, _ := ret[0].([]string) return ret0 }
c169365
"SetDevices", reflect.TypeOf((*MockGPUManager)(nil).SetDevices)) }
c169366
string) { m.ctrl.Call(m, "SetDriverVersion", arg0) }
c169367
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDriverVersion", reflect.TypeOf((*MockGPUManager)(nil).SetDriverVersion), arg0) }
c169368
[]string) { m.ctrl.Call(m, "SetGPUIDs", arg0) }
c169369
string) { m.ctrl.Call(m, "SetRuntimeVersion", arg0) }
c169370
mock.recorder = &MockRoundTripperMockRecorder{mock} return mock }
c169371
ret[0].(*http.Response) ret1, _ := ret[1].(error) return ret0, ret1 }
c169372
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RoundTrip", reflect.TypeOf((*MockRoundTripper)(nil).RoundTrip), arg0) }
c169373
mock.recorder = &MockNetLinkMockRecorder{mock} return mock }
c169374
m.ctrl.Call(m, "LinkByName", arg0) ret0, _ := ret[0].(netlink.Link) ret1, _ := ret[1].(error) return ret0, ret1 }
c169375
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LinkByName", reflect.TypeOf((*MockNetLink)(nil).LinkByName), arg0) }
c169376
:= ret[0].([]netlink.Link) ret1, _ := ret[1].(error) return ret0, ret1 }
c169377
"LinkList", reflect.TypeOf((*MockNetLink)(nil).LinkList)) }
c169378
mock.recorder = &MockCNIMockRecorder{mock} return mock }
c169379
ret0, _ := ret[0].(types.Result) ret1, _ := ret[1].(error) return ret0, ret1 }
c169380
ret0, _ := ret[0].(types.Result) ret1, _ := ret[1].(error) return ret0, ret1 }
c169381
:= m.ctrl.Call(m, "DelNetwork", arg0, arg1) ret0, _ := ret[0].(error) return ret0 }
c169382
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DelNetwork", reflect.TypeOf((*MockCNI)(nil).DelNetwork), arg0, arg1) }
c169383
:= m.ctrl.Call(m, "DelNetworkList", arg0, arg1) ret0, _ := ret[0].(error) return ret0 }
c169384
make(map[string]*entry), evictList: list.New(), } return lru }
c169385
if !ok { return nil, false } lru.updateAccessed(key) return entry.value, true }
c169386
added: time.Now()} // Remove from the evict list if an entry already existed lru.removeFromEvictList(key) lru.evictList.PushBack(key) lru.purgeSize() }
c169387
lru.removeFromEvictList(key) delete(lru.cache, key) }
c169388
expiration [%s] < now [%s]", eni.ExpiresAt.String(), now.String()) } seelog.Infof("Starting ENI ack timer with duration=%s, %s", duration.String(), eni.stringUnsafe()) eni.ackTimer = time.AfterFunc(duration, timeoutFunc) return nil }
c169389
eni.guard.RUnlock() return eni.AttachStatusSent }
c169390
eni.guard.Unlock() eni.AttachStatusSent = true }
c169391
eni.guard.Unlock() eni.ackTimer.Stop() }
c169392
return time.Now().After(eni.ExpiresAt) }
c169393
eni.guard.RUnlock() return eni.stringUnsafe() }
c169394
eni.AttachStatusSent, eni.MACAddress, eni.Status.String(), eni.ExpiresAt.String()) }
c169395
if err != nil { seelog.Warnf("Error initializing metrics engine: %v", err) return } err = StartSession(params, params.StatsEngine) if err != nil { seelog.Warnf("Error starting metrics session with backend: %v", err) } }
c169396
closed for a valid reason") backoff.Reset() } else { seelog.Infof("Error from tcs; backing off: %v", tcsError) params.time().Sleep(backoff.Duration()) } } }
c169397
timer.Reset(retry.AddJitter(defaultHeartbeatTimeout, defaultHeartbeatJitter)) } }
c169398
timer.Reset(retry.AddJitter(defaultHeartbeatTimeout, defaultHeartbeatJitter)) } }
c169399
timer.Reset(retry.AddJitter(defaultHeartbeatTimeout, defaultHeartbeatJitter)) } }