-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RuntimeJobV2 class and new JobStatus' #1450
Conversation
Pull Request Test Coverage Report for Build 8162277899Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
qiskit_ibm_runtime/runtime_job_v2.py
Outdated
def _set_status_and_error_message(self) -> None: | ||
"""Fetch and set status and error message.""" | ||
if self._status not in JOB_FINAL_STATES: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these methods need to be duplicated, especially since there are methods like in_final_state()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these status related methods are in BaseRuntimeJob
instead, it makes things messier because JOB_FINAL_STATES
is different, and all the statuses are strings instead of enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if the only difference is JOB_FINAL_STATES
, and you're just checking if a status is in final state, can't you just call if not self.in_final_state()
and have each child implement its own in_final_state()
?
@abstractmethod | ||
def _status_from_job_response(self, response: Dict) -> str: | ||
"""Returns the job status from an API response.""" | ||
return response["state"]["status"].upper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure what the best way to handle this _status_from_job_response
method was - I don't think it's best practice to make a private method abstract but it makes sense for the child classes to have to implement this method since the API_TO_JOB_STATUS
is different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the 2 job classes can be consolidated a bit more, but we can do that later.
Summary
Details and comments
Fixes #1352
Fixes #1366