lostluck commented on PR #36235:
URL: https://github.com/apache/beam/pull/36235#issuecomment-3322079300
> If we change job.sendState to return a state after processing through a
state machine, then a lot of exported apis in job.go, such as the following,
would need changing to returning the state. Is that ok?
>
> ```go
> func (j *Job) Start() {
> j.sendState(jobpb.JobState_STARTING)
> }
>
> // Running indicates that the job is executing.
> func (j *Job) Running() {
> j.sendState(jobpb.JobState_RUNNING)
> }
>
> // Done indicates that the job completed successfully.
> func (j *Job) Done() {
> j.sendState(jobpb.JobState_DONE)
> }
>
> // Canceling indicates that the job is canceling.
> func (j *Job) Canceling() {
> j.sendState(jobpb.JobState_CANCELLING)
> }
> ```
Mechanically, there's no problem with it, as these are internal packages,
and we can change all the callers.
But there's not need to change all the callers right away, just for the
cancellation call where it appears to matter, and we look up the state
immediately. Most other calls are never inspecting the job status immediately
afterwards, setting and forgetting as the job progresses through the pipeline
execution.
It's OK not to change the other calls.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]