A job is a long-running asynchronous operation performed by an ArcGIS Server asynchronous service operation.
This is the base class for a range of long-running jobs classes, such as GeoprocessingJob, GenerateGeodatabaseJob, SyncGeodatabaseJob, GenerateOfflineMapJob, and ExportVectorTilesJob. You can create a job instance from its associated task using a set of parameters. For example, to create a GeoprocessingJob, call GeoprocessingTask.createJob(GeoprocessingParameters) and provide a set of GeoprocessingParameters. A newly instantiated job has a status of JobStatus.notStarted.
Call Job.start to initiate the job on the server. If the server accepts the job, it assigns a unique job id (available from the Job.serverJobId) and executes the job. At this point, the job status is JobStatus.started. The running job periodically polls the server to get messages and progress of the job. While the job is in progress, you can listen for changes to the Job.status, display its collection of Job.messages, and report the Job.progress to show the percentage of the job that has been completed.
When the job is done, you can examine the Job.status to determine if it was successful. If the job failed (JobStatus.failed), information about the failure is available in the Job.error. If the job succeeds (JobStatus.succeeded), its specific type of result is returned. For example, a successful GeoprocessingJob returns a GeoprocessingResult, a successful ExportVectorTilesJob returns an ExportVectorTilesResult, and so on.
If necessary, you can pause a job and re-start it using Job.pause and Job.start, respectively. Note, you should always cancel jobs that are no longer needed by calling Job.cancel. This sends a cancel request to the server and helps reduce unnecessary server load.
- Implemented types
- Mixed in types
- Implementers
Constructors
-
Job.fromJson(Map<
String, dynamic> json) -
factory
- Job.fromJsonString(String jsonString)
-
factory
Properties
- error → ArcGISException?
-
Contains an error if the job fails, otherwise null.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
messages
→ List<
JobMessage> -
The job's messages.
no setter
-
onJobDone
→ Stream<
void> -
Sets the function that will be called when the job is done.
no setter
-
onMessageAdded
→ Stream<
JobMessage> -
Indicates that a new
JobMessage
was added to Job.messages.no setter -
onProgressChanged
→ Stream<
int> -
Sets the function that will be called when the job's progress has changed.
no setter
-
onStatusChanged
→ Stream<
JobStatus> -
Indicates that the Job.status property has changed.
no setter
- progress → int
-
The current progress of the job as a percentage complete.
no setter
- result → T?
-
The result of a job that has succeeded.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverJobId → String
-
The server job Id of the job.
no setter
- status → JobStatus
-
The status of the job.
no setter
Methods
-
cancel(
) → Future< bool> - Cancels this Job and waits for any asynchronous, server-side operations to be canceled.
-
checkStatus(
) → Future< bool> - Initiates a request to check the server status.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → bool - Pauses the job.
-
run(
) → Future< T> - Starts the job and returns a Future that completes with either the result of the job or an error if the job did not finish successfully.
-
start(
) → bool - Starts the job if the job is not started or paused.
-
toJson(
) → Map< String, dynamic> -
Returns a JSON representation of this Object in the data type used by jsonDecode.
inherited
-
toJsonString(
) → String -
Returns a JSON representation of this Object as a String.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited