MCPcopy Index your code
hub / github.com/moby/swarmkit / Task

Struct Task

api/objects.pb.go:310–372  ·  view source on GitHub ↗

Task specifies the parameters for implementing a Spec. A task is effectively immutable and idempotent. Once it is dispatched to a node, it will not be dispatched to another node.

Source from the content-addressed store, hash-verified

308// immutable and idempotent. Once it is dispatched to a node, it will not be
309// dispatched to another node.
310type Task struct {
311 ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
312 Meta Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta"`
313 // Spec defines the desired state of the task as specified by the user.
314 // The system will honor this and will *never* modify it.
315 Spec TaskSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec"`
316 // SpecVersion is copied from Service, to identify which version of the
317 // spec this task has. Note that this is not directly comparable to the
318 // service's Version.
319 SpecVersion *Version `protobuf:"bytes,14,opt,name=spec_version,json=specVersion,proto3" json:"spec_version,omitempty"`
320 // ServiceID indicates the service under which this task is orchestrated. This
321 // should almost always be set.
322 ServiceID string `protobuf:"bytes,4,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
323 // Slot is the service slot number for a task.
324 // For example, if a replicated service has replicas = 2, there will be a
325 // task with slot = 1, and another with slot = 2.
326 Slot uint64 `protobuf:"varint,5,opt,name=slot,proto3" json:"slot,omitempty"`
327 // NodeID indicates the node to which the task is assigned. If this field
328 // is empty or not set, the task is unassigned.
329 NodeID string `protobuf:"bytes,6,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
330 // Annotations defines the names and labels for the runtime, as set by
331 // the cluster manager.
332 //
333 // As backup, if this field has an empty name, the runtime will
334 // allocate a unique name for the actual container.
335 //
336 // NOTE(stevvooe): The preserves the ability for us to making naming
337 // decisions for tasks in orchestrator, albeit, this is left empty for now.
338 Annotations Annotations `protobuf:"bytes,7,opt,name=annotations,proto3" json:"annotations"`
339 // ServiceAnnotations is a direct copy of the service name and labels when
340 // this task is created.
341 //
342 // Labels set here will *not* be propagated to the runtime target, such as a
343 // container. Use labels on the runtime target for that purpose.
344 ServiceAnnotations Annotations `protobuf:"bytes,8,opt,name=service_annotations,json=serviceAnnotations,proto3" json:"service_annotations"`
345 Status TaskStatus `protobuf:"bytes,9,opt,name=status,proto3" json:"status"`
346 // DesiredState is the target state for the task. It is set to
347 // TaskStateRunning when a task is first created, and changed to
348 // TaskStateShutdown if the manager wants to terminate the task. This field
349 // is only written by the manager.
350 DesiredState TaskState `protobuf:"varint,10,opt,name=desired_state,json=desiredState,proto3,enum=docker.swarmkit.v1.TaskState" json:"desired_state,omitempty"`
351 // List of network attachments by the task.
352 Networks []*NetworkAttachment `protobuf:"bytes,11,rep,name=networks,proto3" json:"networks,omitempty"`
353 // A copy of runtime state of service endpoint from Service
354 // object to be distributed to agents as part of the task.
355 Endpoint *Endpoint `protobuf:"bytes,12,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
356 // LogDriver specifies the selected log driver to use for the task. Agent
357 // processes should always favor the value in this field.
358 //
359 // If present in the TaskSpec, this will be a copy of that value. The
360 // orchestrator may choose to insert a value here, which should be honored,
361 // such a cluster default or policy-based value.
362 //
363 // If not present, the daemon's default will be used.
364 LogDriver *Driver `protobuf:"bytes,13,opt,name=log_driver,json=logDriver,proto3" json:"log_driver,omitempty"`
365 AssignedGenericResources []*GenericResource `protobuf:"bytes,15,rep,name=assigned_generic_resources,json=assignedGenericResources,proto3" json:"assigned_generic_resources,omitempty"`
366 // JobIteration is the iteration number of the Job-mode Service that this
367 // task belongs to.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected