CapGdlrJobs.JobSpecΒΆ
Inherits: RefCounted < Object
Describes one job.
DescriptionΒΆ
Extend it, declare a KEY constant, and override _run():
class_name LoadSaveJob
extends CapGdlrJobs.JobSpec
const KEY := &"save/load"
func _ensure_requirements() -> GdbPromise:
return ensure_job(MountStorageJob.KEY)
func _run(args := {}) -> GdbPromise:
return GdbPromise.new_resolved(load_save())
Register the specification with CapGdlrJobsRegistry.register_job().
MethodsΒΆ
get_key() |
|
void |
initialize(svc_jobs: CapGdlrJobs) |
run(args: Dictionary = {}) |
|
void |
|
get_job_output(key: StringName) |
|
get_job_status(key: StringName) |
|
ensure_job(key: StringName) |
|
_run(args: Dictionary = {}) |
|
Method DescriptionsΒΆ
StringName get_key() π
Returns the KEY constant of the specification.
void initialize(svc_jobs: CapGdlrJobs) π
Connects the specification to the jobs service. The service calls it before the job starts.
GdbPromise ensure_requirements() π
Returns a promise that resolves when the requirements are met. See _ensure_requirements().
GdbPromise run(args: Dictionary = {}) π
Runs the job. See _run().
void abort_current_run() π
Stops the current run. CapGdlrJobs.reset_job() calls it when it aborts the job. Override it to cancel work. The default does nothing.
Variant get_job_output(key: StringName) π
Returns the output of another job. See CapGdlrJobs.get_job_output().
JobStatus get_job_status(key: StringName) π
Returns the status of another job. See CapGdlrJobs.get_job_status().
GdbPromise ensure_job(key: StringName) π
Returns a promise of the output of another job. See CapGdlrJobs.ensure_job(). Use it in _ensure_requirements().
JobRunPolicy get_run_policy() π
Returns the run policy. See _get_run_policy().
GdbPromise _run(args: Dictionary = {}) π
Override it to do the work. Return a promise of the job output. Reject the promise to fail the job.
GdbPromise _ensure_requirements() π
Override it to wait for other jobs or resources before _run(). The default resolves at once.
JobRunPolicy _get_run_policy() π
Override it to change when the job starts. The default is CapGdlrJobs.WHEN_REQUIRED.