Class JobConfig
- All Implemented Interfaces:
DataSerializable
,IdentifiedDataSerializable
public class JobConfig extends Object implements IdentifiedDataSerializable
- Since:
- 3.0
-
Constructor Summary
Constructors Constructor Description JobConfig()
-
Method Summary
Modifier and Type Method Description JobConfig
addClass(Class... classes)
Adds the given classes and recursively all their nested (inner & anonymous) classes to the Jet job's classpath.JobConfig
addClasspathResource(File file)
Adds a file that will be available as a resource on the Jet job's classpath.JobConfig
addClasspathResource(File file, String id)
Adds a file that will be available as a resource on the Jet job's classpath.JobConfig
addClasspathResource(String path)
Adds a file that will be available as a resource on the Jet job's classpath.JobConfig
addClasspathResource(String path, String id)
Adds a file that will be available as a resource on the Jet job's classpath.JobConfig
addClasspathResource(URL url)
Adds a resource that will be available on the Jet job's classpath.JobConfig
addClasspathResource(URL url, String id)
Adds a resource that will be available on the Jet job's classpath.JobConfig
addJar(File file)
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addJar(String path)
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addJar(URL url)
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addJarsInZip(File file)
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addJarsInZip(String path)
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addJarsInZip(URL url)
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code.JobConfig
addPackage(String... packages)
Adds recursively all the classes and resources in given packages to the Jet job's classpath.JobConfig
attachAll(Map<String,File> idToFile)
Attaches all the files/directories in the supplied map, as if by callingattachDirectory(dir, id)
for every entry that resolves to a directory andattachFile(file, id)
for every entry that resolves to a regular file.JobConfig
attachDirectory(File file)
Adds the supplied directory to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachDirectory(File file, String id)
Adds the supplied directory to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachDirectory(String path)
Adds the directory identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachDirectory(String path, String id)
Adds the directory identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachDirectory(URL url)
Adds the directory identified by the supplied URL to the list of directories that will be available to the job while it's executing in the Jet cluster.JobConfig
attachDirectory(URL url, String id)
Adds the directory identified by the supplied URL to the list of directories that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(File file)
Adds the supplied file to the list of resources that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(File file, String id)
Adds the supplied file to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(String path)
Adds the file identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(String path, String id)
Adds the file identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(URL url)
Adds the file identified by the supplied URL as a resource that will be available to the job while it's executing in the Jet cluster.JobConfig
attachFile(URL url, String id)
Adds the file identified by the supplied URL to the list of resources that will be available to the job while it's executing in the Jet cluster.boolean
equals(Object o)
int
getClassId()
Returns type identifier for this class.JobClassLoaderFactory
getClassLoaderFactory()
Returns the configuredJobClassLoaderFactory
.int
getFactoryId()
Returns DataSerializableFactory factory ID for this class.String
getInitialSnapshotName()
Returns the configured initial snapshot name ornull
if no initial snapshot is configured.String
getName()
Returns the name of the job ornull
if no name was given.ProcessingGuarantee
getProcessingGuarantee()
Returns the configuredprocessing guarantee
.Map<String,ResourceConfig>
getResourceConfigs()
Returns all the registered resource configurations.Map<String,String>
getSerializerConfigs()
Returns all the registered serializer configurations.long
getSnapshotIntervalMillis()
Returns the configuredsnapshot interval
.int
hashCode()
boolean
isAutoScaling()
Returns whether auto scaling is enabled, seesetAutoScaling(boolean)
.boolean
isMetricsEnabled()
Returns if metrics collection is enabled for the job.boolean
isSplitBrainProtectionEnabled()
Tells whethersplit brain protection
is enabled.boolean
isStoreMetricsAfterJobCompletion()
Returns whether metrics should be stored in the cluster after the job completes.boolean
isSuspendOnFailure()
Returns whether the job will be suspended on failure, seesetSuspendOnFailure(boolean)
.void
readData(ObjectDataInput in)
Reads fields from the input stream<T, S extends StreamSerializer<T>>
JobConfigregisterSerializer(Class<T> clazz, Class<S> serializerClass)
Registers the given serializer for the given class for the scope of the job.JobConfig
setAutoScaling(boolean enabled)
Sets whether Jet will scale the job up or down when a member is added or removed from the cluster.JobConfig
setClassLoaderFactory(JobClassLoaderFactory classLoaderFactory)
Sets a customJobClassLoaderFactory
that will be used to load job classes and resources on Jet members.JobConfig
setInitialSnapshotName(String initialSnapshotName)
Sets the exported state snapshot name to restore the initial job state from.JobConfig
setMetricsEnabled(boolean enabled)
Sets whether metrics collection should be enabled for the job.JobConfig
setName(String name)
Sets the name of the job.JobConfig
setProcessingGuarantee(ProcessingGuarantee processingGuarantee)
Set theprocessing guarantee
for the job.JobConfig
setSnapshotIntervalMillis(long snapshotInterval)
Sets the snapshot interval in milliseconds — the interval between the completion of the previous snapshot and the start of a new one.JobConfig
setSplitBrainProtection(boolean isEnabled)
Configures the split brain protection feature.JobConfig
setStoreMetricsAfterJobCompletion(boolean storeMetricsAfterJobCompletion)
Sets whether metrics should be stored in the cluster after the job completes.JobConfig
setSuspendOnFailure(boolean suspendOnFailure)
Sets what happens if the job execution fails: If enabled, the job will be suspended.String
toString()
void
writeData(ObjectDataOutput out)
Writes object fields to output stream
-
Constructor Details
-
JobConfig
public JobConfig()
-
-
Method Details
-
getName
Returns the name of the job ornull
if no name was given. -
setName
Sets the name of the job. There can be at most one active job in the cluster with particular name, however, the name can be reused after the previous job with that name completed or failed. SeeJetInstance.newJobIfAbsent(com.hazelcast.jet.core.DAG, com.hazelcast.jet.config.JobConfig)
. An active job is a job that is running, suspended or waiting to be run.The job name is printed in logs and is visible in Jet Management Center.
The default value is
null
.- Returns:
this
instance for fluent API- Since:
- 3.0
-
isSplitBrainProtectionEnabled
public boolean isSplitBrainProtectionEnabled()Tells whethersplit brain protection
is enabled. -
setSplitBrainProtection
Configures the split brain protection feature. When enabled, Jet will restart the job after a topology change only if the cluster quorum is satisfied. The quorum value iscluster size at job submission time / 2 + 1
.The job can be restarted only if the size of the cluster after restart is at least the quorum value. Only one of the clusters formed due to a split-brain condition can satisfy the quorum. For example, if at the time of job submission the cluster size was 5 and a network partition causes two clusters with sizes 3 and 2 to form, the job will restart only on the cluster with size 3.
Adding new nodes to the cluster after starting the job may defeat this mechanism. For instance, if there are 5 members at submission time (i.e., the quorum value is 3) and later a new node joins, a split into two clusters of size 3 will allow the job to be restarted on both sides.
Split-brain protection is disabled by default.
If auto scaling is disabled and you manually
Job.resume()
the job, the job won't start executing until the quorum is met, but will remain in the resumed state.- Returns:
this
instance for fluent API
-
setAutoScaling
Sets whether Jet will scale the job up or down when a member is added or removed from the cluster. Enabled by default.+--------------------------+-----------------------+----------------+ | Auto scaling | Member added | Member removed | +--------------------------+-----------------------+----------------+ | Enabled | restart (after delay) | restart | | Disabled - snapshots on | no action | suspend | | Disabled - snapshots off | no action | fail | +--------------------------+-----------------------+----------------+
- Returns:
this
instance for fluent API- See Also:
Configuring the scale-up delay
,Enabling/disabling snapshots
-
isAutoScaling
public boolean isAutoScaling()Returns whether auto scaling is enabled, seesetAutoScaling(boolean)
. -
setSuspendOnFailure
Sets what happens if the job execution fails:- If enabled, the job will be suspended. It can later be resumed or upgraded and the computation state will be preserved.
- If disabled, the job will be terminated. The state snapshots will be deleted.
By default it's disabled.
- Returns:
this
instance for fluent API- Since:
- 4.3
-
isSuspendOnFailure
public boolean isSuspendOnFailure()Returns whether the job will be suspended on failure, seesetSuspendOnFailure(boolean)
.- Since:
- 4.3
-
getProcessingGuarantee
Returns the configuredprocessing guarantee
. -
setProcessingGuarantee
Set theprocessing guarantee
for the job. When the processing guarantee is set to at-least-once or exactly-once, the snapshot interval can be configured viasetSnapshotIntervalMillis(long)
, otherwise it will default to 10 seconds.The default value is
ProcessingGuarantee.NONE
.- Returns:
this
instance for fluent API
-
getSnapshotIntervalMillis
public long getSnapshotIntervalMillis()Returns the configuredsnapshot interval
. -
setSnapshotIntervalMillis
Sets the snapshot interval in milliseconds — the interval between the completion of the previous snapshot and the start of a new one. Must be set to a positive value. This setting is only relevant with at-least-once or exactly-once processing guarantees.Default value is set to 10 seconds.
- Returns:
this
instance for fluent API
-
addClass
Adds the given classes and recursively all their nested (inner & anonymous) classes to the Jet job's classpath. They will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. (An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)See also
addJar(java.net.URL)
andaddClasspathResource(java.net.URL)
.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addPackage
Adds recursively all the classes and resources in given packages to the Jet job's classpath. They will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. (An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)See also
addJar(java.net.URL)
andaddClasspathResource(java.net.URL)
.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.1
-
addJar
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the JAR with a URL, which must contain at least one path segment. The last path segment ("filename") will be used as the resource ID, so two JARs with the same filename will be in conflict.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addJar
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the JAR with a
File
. The filename part of the path will be used as the resource ID, so two JARs with the same filename will be in conflict.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addJar
Adds a JAR whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the JAR with a path string. The filename part will be used as the resource ID, so two JARs with the same filename will be in conflict.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addJarsInZip
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. (An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the ZIP file with a URL, which must contain at least one path segment. The last path segment ("filename") will be used as the resource ID, so two ZIPs with the same filename will be in conflict.
The ZIP file should contain only JARs. Any other files will be ignored.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
addJarsInZip
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. (An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the ZIP file with a
File
. The filename part will be used as the resource ID, so two ZIPs with the same filename will be in conflict.The ZIP file should contain only JARs. Any other files will be ignored.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
addJarsInZip
Adds a ZIP file with JARs whose contents will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. (An important example is theIMap
data source, which can instantiate only the classes from the Jet instance's classpath.)This variant identifies the ZIP file with a path string. The filename part will be used as the resource ID, so two ZIPs with the same filename will be in conflict.
The ZIP file should contain only JARs. Any other files will be ignored.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
addClasspathResource
Adds a resource that will be available on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it.This variant identifies the resource with a URL, which must contain at least one path segment. The last path segment ("filename") will be used as the resource ID, so two resources with the same filename will be in conflict.
- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addClasspathResource
Adds a resource that will be available on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it. The suppliedid
becomes the path under which the resource is available from the class loader.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addClasspathResource
Adds a file that will be available as a resource on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it. The file will reside in the root of the classpath, under its own filename. This means that two files with the same filename will be in conflict.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addClasspathResource
Adds a file that will be available as a resource on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it. The suppliedid
becomes the path under which the resource is available from the class loader.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addClasspathResource
Adds a file that will be available as a resource on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it. It will reside in the root of the classpath, under its own filename. This means that two files with the same filename will be in conflict.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
addClasspathResource
Adds a file that will be available as a resource on the Jet job's classpath. All the code attached to the underlying pipeline or DAG will have access to it. The suppliedid
becomes the path under which the resource is available from the class loader.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
attachFile
Adds the file identified by the supplied URL as a resource that will be available to the job while it's executing in the Jet cluster. The resource's filename (the last path segment in the URL) becomes its ID, so two resources with the same filename will be in conflict.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachFile
Adds the file identified by the supplied URL to the list of resources that will be available to the job while it's executing in the Jet cluster. The file will be registered under the supplied ID.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachFile
Adds the supplied file to the list of resources that will be available to the job while it's executing in the Jet cluster. The filename becomes the ID of the file, so two files with the same name will be in conflict.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachFile
Adds the supplied file to the list of files that will be available to the job while it's executing in the Jet cluster. The file will be registered under the supplied ID.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachFile
Adds the file identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster. The filename becomes the ID of the file, so two files with the same name will be in conflict.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachFile
Adds the file identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster. The file will be registered under the supplied ID.To retrieve the file from within the Jet job, call
ctx.attachedFile(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. The file will have the same name as the one supplied here, but it will be in a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the directory identified by the supplied URL to the list of directories that will be available to the job while it's executing in the Jet cluster. Directory name (the last path segment in the URL) becomes its ID, so two directories with the same name will be in conflict. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the directory identified by the supplied URL to the list of directories that will be available to the job while it's executing in the Jet cluster. The directory will be registered under the supplied ID. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the directory identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster. The directory name (the last path segment) becomes its ID, so two directories with the same name will be in conflict. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the directory identified by the supplied pathname to the list of files that will be available to the job while it's executing in the Jet cluster. The directory will be registered under the supplied ID. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the supplied directory to the list of files that will be available to the job while it's executing in the Jet cluster. The directory name (the last path segment) becomes its ID, so two directories with the same name will be in conflict. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachDirectory
Adds the supplied directory to the list of files that will be available to the job while it's executing in the Jet cluster. The directory will be registered under the supplied ID. Hidden files are ignored.To retrieve the directory from within the Jet job, call
ctx.attachedDirectory(id)
, wherectx
is theProcessorSupplier
context available, for example, toServiceFactory.createContextFn()
. It will be a temporary directory on the Jet server.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API- Since:
- 4.0
-
attachAll
Attaches all the files/directories in the supplied map, as if by callingattachDirectory(dir, id)
for every entry that resolves to a directory andattachFile(file, id)
for every entry that resolves to a regular file.- Implementation Note:
- Backing storage for this method is an
IMap
with a default backup count of 1. When adding big files as a resource, size the cluster accordingly in terms of memory, since each file will have 2 copies inside the cluster(primary + backup replica). - Returns:
this
instance for fluent API
-
getResourceConfigs
Returns all the registered resource configurations. -
registerSerializer
@Nonnull @EvolvingApi public <T, S extends StreamSerializer<T>> JobConfig registerSerializer(@Nonnull Class<T> clazz, @Nonnull Class<S> serializerClass)Registers the given serializer for the given class for the scope of the job. It will be accessible to all the code attached to the underlying pipeline or DAG, but not to any other code. There are several serializer types you can register, see the- Parameters:
clazz
- class to register serializer forserializerClass
- class of the serializer to be registered- Returns:
this
instance for fluent API- Since:
- 4.1
getSerializerConfigs
Returns all the registered serializer configurations. This is a private API.setClassLoaderFactory
@Nonnull public JobConfig setClassLoaderFactory(@Nullable JobClassLoaderFactory classLoaderFactory)Sets a customJobClassLoaderFactory
that will be used to load job classes and resources on Jet members.- Returns:
this
instance for fluent API
getClassLoaderFactory
Returns the configuredJobClassLoaderFactory
.getInitialSnapshotName
Returns the configured initial snapshot name ornull
if no initial snapshot is configured.setInitialSnapshotName
Sets the exported state snapshot name to restore the initial job state from. This state will be used for initial state and also for the case when the execution restarts before it produces first snapshot.The job will use the state even if processing guarantee is set to
ProcessingGuarantee.NONE
.- Parameters:
initialSnapshotName
- the snapshot name given toJob.exportSnapshot(String)
- Returns:
this
instance for fluent API- Since:
- 3.0
setMetricsEnabled
Sets whether metrics collection should be enabled for the job. NeedsBaseMetricsConfig.isEnabled()
to be on in order to function.Metrics for running jobs can be queried using
Job.getMetrics()
It's enabled by default.- Since:
- 3.2
isMetricsEnabled
public boolean isMetricsEnabled()Returns if metrics collection is enabled for the job.- Since:
- 3.2
isStoreMetricsAfterJobCompletion
public boolean isStoreMetricsAfterJobCompletion()Returns whether metrics should be stored in the cluster after the job completes. Needs bothBaseMetricsConfig.isEnabled()
andisMetricsEnabled()
to be on in order to function.If enabled, metrics can be retrieved by calling
Job.getMetrics()
.It's disabled by default.
- Since:
- 3.2
setStoreMetricsAfterJobCompletion
Sets whether metrics should be stored in the cluster after the job completes. If enabled, metrics can be retrieved for the configured job even if it's no longer running (has completed successfully, has failed, has been cancelled or suspended) by callingJob.getMetrics()
.If disabled, once the configured job stops running
Job.getMetrics()
will always return empty metrics for it, regardless of the settings forglobal metrics collection
orper job metrics collection
.It's disabled by default.
- Since:
- 3.2
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializable
Returns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryId
in interfaceIdentifiedDataSerializable
- Returns:
- factory ID
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializable
Returns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassId
in interfaceIdentifiedDataSerializable
- Returns:
- type ID
writeData
Description copied from interface:DataSerializable
Writes object fields to output stream- Specified by:
writeData
in interfaceDataSerializable
- Parameters:
out
- output- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the output stream has been closed.
readData
Description copied from interface:DataSerializable
Reads fields from the input stream- Specified by:
readData
in interfaceDataSerializable
- Parameters:
in
- input- Throws:
IOException
- if an I/O error occurs. In particular, anIOException
may be thrown if the input stream has been closed.
equals
hashCode
public int hashCode()toString
-