Closed MatthieuMoreau0 closed 2 months ago
I don't know if returning None is the most idiomatic way to do this in pulser; I also contemplated creating a new subclass of
Result
calledEmptyResult
but I wanted to gather some feedback before going for that because it would imply some refactoring of theResult
class and I'm not entirely convinced it would bring much.
I was thinking of something along those lines too, I think it would be better than None
. I also considered having PendingResult
for distinguishing pending jobs from failed ones but that's maybe beyond the scope of this PR.
I think we both agree that the current format that we use to return results is limiting us and that there doesn't seem to be a nice way to include partial results within it.
As such, I would propose we add an alternative, more flexible method to RemoteResults
instead. I was thinking of something along the lines of
RemoteResults.get_available_results() -> dict[JobId, Result]:
This would give the user a workaround when something failed in the traditional method. We could also point the user to this alternative method through the error message. What do you think about this @MatthieuMoreau0 ?
Currently if one of the job of a batch fails, it is impossible to retrieve the results for any jobs of the batch - this raises an exception. In this PR, I suggest instead to add
None
to the list of results for that submission when a job has no results. I don't know if returning None is the most idiomatic way to do this in pulser; I also contemplated creating a new subclass ofResult
calledEmptyResult
but I wanted to gather some feedback before going for that because it would imply some refactoring of theResult
class and I'm not entirely convinced it would bring much.