Skip to content
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

Merged
merged 12 commits into from
Mar 5, 2024

Conversation

kt474
Copy link
Member

@kt474 kt474 commented Feb 29, 2024

Summary

Details and comments

Fixes #1352
Fixes #1366

@coveralls
Copy link

coveralls commented Feb 29, 2024

Pull Request Test Coverage Report for Build 8162277899

Warning: 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

  • 252 of 406 (62.07%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.9%) to 82.304%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/qiskit_runtime_service.py 5 6 83.33%
qiskit_ibm_runtime/runtime_job.py 43 69 62.32%
qiskit_ibm_runtime/base_runtime_job.py 160 204 78.43%
qiskit_ibm_runtime/runtime_job_v2.py 37 120 30.83%
Totals Coverage Status
Change from base Build 8162030636: -0.9%
Covered Lines: 5781
Relevant Lines: 7024

💛 - Coveralls

@kt474 kt474 changed the title [WIP] Add RuntimeJobV2 class [WIP] Add RuntimeJobV2 and JobStatus class Feb 29, 2024
@kt474 kt474 marked this pull request as ready for review March 4, 2024 19:26
@kt474 kt474 changed the title [WIP] Add RuntimeJobV2 and JobStatus class Add RuntimeJobV2 and JobStatus class Mar 4, 2024
@kt474 kt474 changed the title Add RuntimeJobV2 and JobStatus class Add RuntimeJobV2 class and new JobStatus' Mar 4, 2024
Comment on lines 189 to 191
def _set_status_and_error_message(self) -> None:
"""Fetch and set status and error message."""
if self._status not in JOB_FINAL_STATES:
Copy link
Collaborator

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()

Copy link
Member Author

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.

Copy link
Collaborator

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()
Copy link
Member Author

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

Copy link
Collaborator

@jyu00 jyu00 left a 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.

@jyu00 jyu00 merged commit e3fa6df into Qiskit:experimental-0.2 Mar 5, 2024
20 checks passed
@kt474 kt474 added the Changelog: New Feature Include in the Added section of the changelog label Mar 6, 2024
@kt474 kt474 deleted the BasePrimitiveJob branch November 25, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the Added section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants