Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show host a task is running on in emp ps #976

Closed
ejholmes opened this issue Aug 18, 2016 · 1 comment
Closed

Show host a task is running on in emp ps #976

ejholmes opened this issue Aug 18, 2016 · 1 comment
Assignees

Comments

@ejholmes
Copy link
Contributor

This would be really easy to do, and would be helpful for debugging.

@Nosajool
Copy link
Contributor

Unfortunately, the host isn't a field on the Task so it seems like we'd have to make another request. One way to do this is to feed the task's ContainerInstanceArns to func (*ECS) DescribeContainerInstances Then we'd have access to the container's Ec2InstanceId.

http://docs.aws.amazon.com/sdk-for-go/api/service/ecs/#Task

type Task struct {
    // The Amazon Resource Name (ARN) of the cluster that hosts the task.
    ClusterArn *string `locationName:"clusterArn" type:"string"`
    // The Amazon Resource Name (ARN) of the container instances that host the task.
    ContainerInstanceArn *string `locationName:"containerInstanceArn" type:"string"`
    // The containers associated with the task.
    Containers []*Container `locationName:"containers" type:"list"`
    // The Unix timestamp for when the task was created (the task entered the PENDING
    // state).
    CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
    // The desired status of the task.
    DesiredStatus *string `locationName:"desiredStatus" type:"string"`
    // The last known status of the task.
    LastStatus *string `locationName:"lastStatus" type:"string"`
    // One or more container overrides.
    Overrides *TaskOverride `locationName:"overrides" type:"structure"`
    // The Unix timestamp for when the task was started (the task transitioned from
    // the PENDING state to the RUNNING state).
    StartedAt *time.Time `locationName:"startedAt" type:"timestamp" timestampFormat:"unix"`
    // The tag specified when a task is started. If the task is started by an Amazon
    // ECS service, then the startedBy parameter contains the deployment ID of the
    // service that starts it.
    StartedBy *string `locationName:"startedBy" type:"string"`
    // The Unix timestamp for when the task was stopped (the task transitioned from
    // the RUNNING state to the STOPPED state).
    StoppedAt *time.Time `locationName:"stoppedAt" type:"timestamp" timestampFormat:"unix"`
    // The reason the task was stopped.
    StoppedReason *string `locationName:"stoppedReason" type:"string"`
    // The Amazon Resource Name (ARN) of the task.
    TaskArn *string `locationName:"taskArn" type:"string"`
    // The Amazon Resource Name (ARN) of the task definition that creates the task.
    TaskDefinitionArn *string `locationName:"taskDefinitionArn" type:"string"`
    // contains filtered or unexported fields
}
func (c *ECS) DescribeContainerInstances(input *DescribeContainerInstancesInput) (*DescribeContainerInstancesOutput, error)

type DescribeContainerInstancesInput struct {
    // The short name or full Amazon Resource Name (ARN) of the cluster that hosts
    // the container instances to describe. If you do not specify a cluster, the
    // default cluster is assumed.
    Cluster *string `locationName:"cluster" type:"string"`
    // A space-separated list of container instance IDs or full Amazon Resource
    // Name (ARN) entries.
    ContainerInstances []*string `locationName:"containerInstances" type:"list" required:"true"`
    // contains filtered or unexported fields
}


type DescribeContainerInstancesOutput struct {
    // The list of container instances.
    ContainerInstances []*ContainerInstance `locationName:"containerInstances" type:"list"`
    // Any failures associated with the call.
    Failures []*Failure `locationName:"failures" type:"list"`
    // contains filtered or unexported fields
}
type ContainerInstance struct {
    // This parameter returns true if the agent is actually connected to Amazon
    // ECS. Registered instances with an agent that may be unhealthy or stopped
    // return false, and instances without a connected agent cannot accept placement
    // requests.
    AgentConnected *bool `locationName:"agentConnected" type:"boolean"`
    // The status of the most recent agent update. If an update has never been requested,
    // this value is NULL.
    AgentUpdateStatus *string `locationName:"agentUpdateStatus" type:"string" enum:"AgentUpdateStatus"`
    // The attributes set for the container instance by the Amazon ECS container
    // agent at instance registration.
    Attributes []*Attribute `locationName:"attributes" type:"list"`
    // The Amazon Resource Name (ARN) of the container instance. The ARN contains
    // the arn:aws:ecs namespace, followed by the region of the container instance,
    // the AWS account ID of the container instance owner, the container-instance
    // namespace, and then the container instance ID. For example, arn:aws:ecs:region:aws_account_id:container-instance/container_instance_ID
    // .
    ContainerInstanceArn *string `locationName:"containerInstanceArn" type:"string"`
    // The EC2 instance ID of the container instance.
    Ec2InstanceId *string `locationName:"ec2InstanceId" type:"string"`
    // The number of tasks on the container instance that are in the PENDING status.
    PendingTasksCount *int64 `locationName:"pendingTasksCount" type:"integer"`
    // The registered resources on the container instance that are in use by current
    // tasks.
    RegisteredResources []*Resource `locationName:"registeredResources" type:"list"`
    // The remaining resources of the container instance that are available for
    // new tasks.
    RemainingResources []*Resource `locationName:"remainingResources" type:"list"`
    // The number of tasks on the container instance that are in the RUNNING status.
    RunningTasksCount *int64 `locationName:"runningTasksCount" type:"integer"`
    // The status of the container instance. The valid values are ACTIVE or INACTIVE.
    // ACTIVE indicates that the container instance can accept tasks.
    Status *string `locationName:"status" type:"string"`
    // The version information for the Amazon ECS container agent and Docker daemon
    // running on the container instance.
    VersionInfo *VersionInfo `locationName:"versionInfo" type:"structure"`
    // contains filtered or unexported fields
}

cc @phobologic, this is what I was talking about in standup

Nosajool added a commit that referenced this issue Aug 22, 2016
Nosajool added a commit that referenced this issue Aug 22, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Nosajool added a commit that referenced this issue Aug 23, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Nosajool added a commit that referenced this issue Aug 23, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Nosajool added a commit that referenced this issue Aug 23, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Nosajool added a commit that referenced this issue Aug 23, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Nosajool added a commit that referenced this issue Aug 26, 2016
Closes #976

Add mocks for cloudformation tests

fix cli tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants