Open andre-merzky opened 3 years ago
SubmitException
on cancel()
is meant to convey problems communicating the request to the LRM. Such as qdel
failing. So it's not quite a mistake.
InvalidStateException
when the job cannot be canceled makes sense.
SubmitException
oncancel()
is meant to convey problems communicating the request to the LRM. Such asqdel
failing. So it's not quite a mistake.
From the [spec]():
SubmitException
This exception is thrown when the JobExecutor.submit call fails
for a reason that is independent of the job that is being submitted.
That seems inconsistent with the use in cancel()
- it specifically refers to the submit()
call, not to 'submitting' any request to the backend. I think it would be confusing to mix the two. If both calls are to share an exception to cover problems with backend communication, then it should maybe be named BackendException
or something similar which makes the intent clear.
I agree it is confusing. There are two options I can think of: 1) rename SubmitException in a way that captures the common denominator between submit
and cancel
while appropriately modifying the description and 2) Add a cancel
specific exception.
I think the exception should be functional rather than nominal, in the same way that IOError is thrown by many callables rather than each callable defining a separate exception based on the operation that is being performed. So that seems to to hint at (1).
I am also for option (1), and BackendException
sounds reasonable to me.
BackendException
Sounds fine I think. Part of me thinks that the exception name should reflect the nature of the problem rather than the location of the problem, since the latter is too similar to SubmitException
. That said, I've seen RemoteException
quite a few times.
The spec defines:
That looks wrong. Also, the text does not clarify when an exception should be raised. I assume that an
InvalidStateException
should be raised ifcancel()
is called on a job in final state?The above also applies to the
job.cancel()
method.BTW: we have
cancel()
on the job executor and the job (which I like). I still think we should havewait()
on both also.