Skip to content

Reconsider [Job|JobExecutor].setJobStatusCallback #177

@hategan

Description

@hategan

First, it seems like a property may be more appropriate here and, the inclusion of "job" in the method name may be superfluous. It is unlikely that significant ambiguity would be introduced if the name was simply setStatusCallback or even 'setCallback`.

However, there are two other, more functional issues:

  1. JobExecutor.get_instance may return a singleton instance. A callback set on that instance previously would be overwritten by any new call to setJobStatusCallback. And, because the callback is a "write-only" property, there is no way to check whether a callback is already set.
  2. This is somewhat related to (1), but chaining callbacks, which is one way of supporting multiple callbacks, requires knowing what the previous callback in the chain is, which is, again, made difficult by the "write-only" aspect of this property.

Suggested Clarification

We should either make setJobStatusCallback into a read/write property (jobStatusCallback) or allow for multiple callbacks directly, e.g., by changing to addJobStatusCallback / removeJobStatusCallback since it's a tried and tested method in both Java and Python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions