Skip to content

Scheduler and Job classes refactoring

Context

In order in ease the integration of new features like job cancellation of scheduler instrumentation, the Job and Scheduler class would benefit from a refactoring.

Task Description

  • Refactor the Job class for better encapsulation and new public interface:
    • Job.register_client() and Job.unregister_client(): add/remove an operation watcher.
    • Job.set_cached_result(): manually associate a result that comes from the action cache.
    • Job.create_lease() and Job.update_lease_state(): lease state manipulation API for the scheduler.
    • Job.cancel_lease(): lease cancellation call.
    • Job.update_operation_stage(): operation stage manipulation API for the scheduler.
    • Job.cancel_operation(): operation cancellation call.
  • Refactor the Scheduler with new public interface:
    • Scheduler.register_client() and Scheduler.unregister_client(): add/remove a job's operation watcher.
    • Scheduler.queue_job() and Scheduler.retry_job(): job handling API for the execution/operation interface.
    • Scheduler.request_job_leases() and Scheduler.update_job_lease_state(): update a job's lease state from the bot interface.
    • Scheduler.cancel_operation(): operation cancellation for the operation interface.

(Cancellation is out of the scope of that issue, see #48 (closed) and #74 (closed))

Edited by Martin Blanchard