public class Job extends Descriptor implements Comparable<Job>
An sample expression of it in JSON might be:
{
"addCapabilities" : [ "IPC_LOCK", "SYSLOG" ],
"dropCapabilities" : [ "SYS_BOOT", "KILL" ],
"created" : 1410308461448,
"command" : [ "server", "serverconfig.yaml" ],
"env" : {
"JVM_ARGS" : "-Ddw.feature.randomFeatureFlagEnabled=true"
},
"expires" : null,
"gracePeriod": 60,
"healthCheck" : {
"type" : "http",
"path" : "/healthcheck",
"port" : "http-admin"
},
"id" : "myservice:0.5:3539b7bc2235d53f79e6e8511942bbeaa8816265",
"image" : "myregistry:80/janedoe/myservice:0.5-98c6ff4",
"labels" : {
"baz": "qux"
},
"hostname": "myhost",
"metadata": {
"foo": "bar"
},
"networkMode" : "bridge",
"ports" : {
"http" : {
"externalPort" : 8060,
"internalPort" : 8080,
"protocol" : "tcp"
},
"http-admin" : {
"externalPort" : 8061,
"internalPort" : 8081,
"protocol" : "tcp"
}
},
"registration" : {
"service/http" : {
"ports" : {
"http" : { }
}
}
},
"registrationDomain" : "",
"resources" : {
"memory" : 10485760,
"memorySwap" : 10485760,
"cpuset" : "0",
"cpuShares" : 512
}
"securityOpt" : [ "label:user:USER", "apparmor:PROFILE" ],
"token": "insecure-access-token",
"volumes" : {
"/destination/path/in/container.yaml:ro" : "/source/path/in/host.yaml"
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
Job.Builder |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_NETWORK_MODE |
static Set<String> |
EMPTY_CAPS |
static List<String> |
EMPTY_COMMAND |
static Long |
EMPTY_CREATED |
static String |
EMPTY_CREATING_USER |
static Map<String,String> |
EMPTY_ENV |
static Date |
EMPTY_EXPIRES |
static Integer |
EMPTY_GRACE_PERIOD |
static HealthCheck |
EMPTY_HEALTH_CHECK |
static String |
EMPTY_HOSTNAME |
static Map<String,String> |
EMPTY_LABELS |
static Map<String,String> |
EMPTY_METADATA |
static String |
EMPTY_MOUNT |
static Map<String,PortMapping> |
EMPTY_PORTS |
static Map<String,String> |
EMPTY_RAMDISKS |
static Map<ServiceEndpoint,ServicePorts> |
EMPTY_REGISTRATION |
static String |
EMPTY_REGISTRATION_DOMAIN |
static Resources |
EMPTY_RESOURCES |
static Integer |
EMPTY_SECONDS_TO_WAIT |
static List<String> |
EMPTY_SECURITY_OPT |
static String |
EMPTY_TOKEN |
static Map<String,String> |
EMPTY_VOLUMES |
| Constructor and Description |
|---|
Job(JobId id,
String image,
String hostname,
Long created,
List<String> command,
Map<String,String> env,
Resources resources,
Map<String,PortMapping> ports,
Map<ServiceEndpoint,ServicePorts> registration,
Integer gracePeriod,
Map<String,String> volumes,
Date expires,
String registrationDomain,
String creatingUser,
String token,
HealthCheck healthCheck,
List<String> securityOpt,
String networkMode,
Map<String,String> metadata,
Set<String> addCapabilities,
Set<String> dropCapabilities,
Map<String,String> labels,
Integer secondsToWaitBeforeKill,
Map<String,String> ramdisks)
Create a Job.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Job job) |
boolean |
equals(Object obj) |
Set<String> |
getAddCapabilities() |
List<String> |
getCommand() |
Long |
getCreated() |
String |
getCreatingUser() |
Set<String> |
getDropCapabilities() |
Map<String,String> |
getEnv() |
Date |
getExpires() |
Integer |
getGracePeriod() |
HealthCheck |
getHealthCheck() |
String |
getHostname() |
JobId |
getId() |
String |
getImage() |
Map<String,String> |
getLabels() |
Map<String,String> |
getMetadata() |
String |
getNetworkMode() |
Map<String,PortMapping> |
getPorts() |
Map<String,String> |
getRamdisks() |
Map<ServiceEndpoint,ServicePorts> |
getRegistration() |
String |
getRegistrationDomain() |
Resources |
getResources() |
Integer |
getSecondsToWaitBeforeKill() |
List<String> |
getSecurityOpt() |
String |
getToken() |
Map<String,String> |
getVolumes() |
int |
hashCode() |
static Job.Builder |
newBuilder() |
Job.Builder |
toBuilder() |
String |
toString() |
parse, parse, toJsonBytes, toJsonStringpublic static final Resources EMPTY_RESOURCES
public static final Map<String,PortMapping> EMPTY_PORTS
public static final Long EMPTY_CREATED
public static final Map<ServiceEndpoint,ServicePorts> EMPTY_REGISTRATION
public static final Integer EMPTY_GRACE_PERIOD
public static final String EMPTY_MOUNT
public static final Date EMPTY_EXPIRES
public static final String EMPTY_REGISTRATION_DOMAIN
public static final String EMPTY_CREATING_USER
public static final String EMPTY_TOKEN
public static final HealthCheck EMPTY_HEALTH_CHECK
public static final String DEFAULT_NETWORK_MODE
public static final String EMPTY_HOSTNAME
public static final Integer EMPTY_SECONDS_TO_WAIT
public Job(JobId id, String image, String hostname, @Nullable Long created, @Nullable List<String> command, @Nullable Map<String,String> env, @Nullable Resources resources, @Nullable Map<String,PortMapping> ports, @Nullable Map<ServiceEndpoint,ServicePorts> registration, @Nullable Integer gracePeriod, @Nullable Map<String,String> volumes, @Nullable Date expires, @Nullable String registrationDomain, @Nullable String creatingUser, @Nullable String token, @Nullable HealthCheck healthCheck, @Nullable List<String> securityOpt, @Nullable String networkMode, @Nullable Map<String,String> metadata, @Nullable Set<String> addCapabilities, @Nullable Set<String> dropCapabilities, @Nullable Map<String,String> labels, @Nullable Integer secondsToWaitBeforeKill, @Nullable Map<String,String> ramdisks)
id - The id of the job.image - The docker image to use.hostname - The hostname to pass to the container.created - The timestamp in milliseconds of when the job was created.
This should only be set by the server.command - The command to pass to the container.env - Environment variables to setresources - Resource specification for the container.ports - The ports you wish to expose from the container.registration - Configuration information for the discovery service, if
applicable.gracePeriod - How long to let the container run after deregistering with the
discovery service. If nothing is configured in registration,
this option is ignored.volumes - Docker volumes to mount.expires - If set, a timestamp at which the job and any deployments will be
removed.registrationDomain - If set, overrides the default domain in which discovery service
registration occurs. What is allowed here will vary based
upon the discovery service plugin used.creatingUser - The user creating the job.token - The token needed to manipulate this job.healthCheck - A health check Helios will execute on the container.securityOpt - A list of strings denoting security options for running Docker
containers, i.e. `docker run --security-opt`.networkMode - Sets the networking mode for the container. Supported values
are: bridge, host, and container:<name|id>.metadata - Arbitrary, optional key-value pairs to be stored with the Job.addCapabilities - Linux capabilities to add for the container. Optional.dropCapabilities - Linux capabilities to drop for the container. Optional.labels - Labels to set on the container. Optional.secondsToWaitBeforeKill - The time to ask Docker to wait after sending a SIGTERM to the
container's main process before sending it a SIGKILL. Optional.public JobId getId()
public String getImage()
public String getHostname()
public Long getCreated()
public Resources getResources()
public Map<String,PortMapping> getPorts()
public Map<ServiceEndpoint,ServicePorts> getRegistration()
public String getRegistrationDomain()
public Integer getGracePeriod()
public Date getExpires()
public String getCreatingUser()
public String getToken()
public HealthCheck getHealthCheck()
public String getNetworkMode()
public Integer getSecondsToWaitBeforeKill()
public static Job.Builder newBuilder()
public int compareTo(@NotNull
Job job)
compareTo in interface Comparable<Job>public Job.Builder toBuilder()
Copyright © 2017. All rights reserved.