Class DurableTask
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<DurableTask>
-
- org.jenkinsci.plugins.durabletask.DurableTask
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<DurableTask>
- Direct Known Subclasses:
FileMonitoringTask
public abstract class DurableTask extends AbstractDescribableImpl<DurableTask> implements ExtensionPoint
A task which may be run asynchronously on a build node and withstand disconnection of the slave agent. Should have a descriptor, and aconfig.jelly
for form data binding.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description DurableTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
captureOutput()
Requests that standard output of the task be captured rather than streamed.void
charset(Charset cs)
Requests that a specified charset be used to transcode process output.void
defaultCharset()
Requests that the node’s system charset be used to transcode process output.DurableTaskDescriptor
getDescriptor()
abstract Controller
launch(EnvVars env, FilePath workspace, Launcher launcher, TaskListener listener)
Launches a durable task.
-
-
-
Method Detail
-
getDescriptor
public DurableTaskDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<DurableTask>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<DurableTask>
-
launch
public abstract Controller launch(EnvVars env, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException
Launches a durable task.- Parameters:
env
- basic environment variables to use during launchworkspace
- the workspace to uselauncher
- a way to start processeslistener
- log output for the build- Returns:
- a way to check up on the task’s subsequent status
- Throws:
IOException
InterruptedException
-
captureOutput
public void captureOutput() throws UnsupportedOperationException
Requests that standard output of the task be captured rather than streamed. If you useController.watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener)
, standard output will not be sent toHandler.output(java.io.InputStream)
; it will be included inHandler.exited(int, byte[])
instead. Otherwise (using polling mode), standard output will not be sent toController.writeLog(hudson.FilePath, java.io.OutputStream)
; callController.getOutput(hudson.FilePath, hudson.Launcher)
to collect. Standard error should still be streamed to the log. Should be called prior tolaunch(hudson.EnvVars, hudson.FilePath, hudson.Launcher, hudson.model.TaskListener)
to take effect.- Throws:
UnsupportedOperationException
- if this implementation does not support that mode
-
charset
public void charset(@NonNull Charset cs)
Requests that a specified charset be used to transcode process output. The encoding ofController.writeLog(hudson.FilePath, java.io.OutputStream)
andController.getOutput(hudson.FilePath, hudson.Launcher)
is then presumed to be UTF-8. If not called, no translation is performed.- Parameters:
cs
- the character set in which process output is expected to be
-
defaultCharset
public void defaultCharset()
Requests that the node’s system charset be used to transcode process output. The encoding ofController.writeLog(hudson.FilePath, java.io.OutputStream)
andController.getOutput(hudson.FilePath, hudson.Launcher)
is then presumed to be UTF-8. If not called, no translation is performed.
-
-