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

Allow Drivers to Attach information to an allocation #5863

Open
Smithx10 opened this issue Jun 20, 2019 · 3 comments
Open

Allow Drivers to Attach information to an allocation #5863

Smithx10 opened this issue Jun 20, 2019 · 3 comments

Comments

@Smithx10
Copy link

Currently, I don’t believe Drivers can return or attach any arbitrary data onto an allocation that is gotten after a successful provision. At least I don’t see any place on the Allocation struct. We’d like to inform the user about where on Triton their allocation is running, their current package size, just some Metadata about their Task Allocation. Currently a user must hit nomad, find the alloc id, and then query triton to get the desired information. They’d much rather run “nomad status ” and get back some info that our driver has attached to the allocation / task.

Is there any way to do this today?

// Allocation is used for serialization of allocations.
type Allocation struct {
ID string
Namespace string
EvalID string
Name string
NodeID string
NodeName string
JobID string
Job *Job
TaskGroup string
Resources *Resources
TaskResources map[string]*Resources
AllocatedResources *AllocatedResources
Services map[string]string
Metrics *AllocationMetric
DesiredStatus string
DesiredDescription string
DesiredTransition DesiredTransition
ClientStatus string
ClientDescription string
TaskStates map[string]*TaskState
DeploymentID string
DeploymentStatus *AllocDeploymentStatus
FollowupEvalID string
PreviousAllocation string
NextAllocation string
RescheduleTracker *RescheduleTracker
PreemptedAllocations []string
PreemptedByAllocation string
CreateIndex uint64
ModifyIndex uint64
AllocModifyIndex uint64
CreateTime int64
ModifyTime int64
}

@jorgelbg
Copy link

jorgelbg commented Feb 3, 2020

This would be a very nice feature to have for integrating with Filebeat for instance. We're using filebeat to ship/parse the logs of our jobs to Elasticsearch with a custom auto-discover module.

One of the supported input types in Filebeat is the containers/docker input which takes a container id as an input and it reads the log streams from docker directly. Currently, this feature cannot be used because there is no way of getting the container ID (AFAIK) from the Nomad API.

@schmichael schmichael added the theme/api HTTP API and SDK issues label May 7, 2020
@ghost
Copy link

ghost commented Sep 3, 2020

I am writing a driver plugin and I would like to output some custom runtime information when user ask for it.

The only suitable API seems to be InspectorTask() which return TaskStatus where there is a DriverAttributes map[string]string, but I cannot figure out when it will be called.

@schmichael
Copy link
Member

#10248 almost fulfills this but has 2 downsides:

  1. Task handles are opaque byte arrays which get serialized to base64 by the HTTP API. Users would need a custom tool or script to deserialize the task handle and pull out the field they care about.
  2. Task handles are only available via the HTTP API for task drivers that set the new RemoteTasks=true capability. This enables the Remote Task Driver feature for those tasks which isn't well suited for the general purpose nature of this ask. You can read more about RTDs here: https://www.nomadproject.io/docs/internals/plugins/task-drivers#remote-task-drivers

tl;dr Leaving this open as exposing InspectTask() in a client agent HTTP API is still a good idea.

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

5 participants