Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Job manager #389

Merged
merged 12 commits into from
Oct 17, 2019
Merged

Job manager #389

merged 12 commits into from
Oct 17, 2019

Conversation

jyu00
Copy link
Collaborator

@jyu00 jyu00 commented Oct 11, 2019

Summary

Addresses #333 .

Details and comments

A job manager that takes a list of circuits/schedules, splits them into multiple jobs and submits the jobs. A few notes:

  • run() only takes a list of circuits/schedules, not a single one. The rationale is the manager is meant to manage a large number of jobs.
  • run() takes IBMQBackend, not BaseBackend as the backend input. Local backends don't have circuit limits and thus shouldn't need a job manager.
  • This does not split the circuits by max gates, since the "payload too large" error should go away once object storage is deployed everywhere (soon).

@jyu00 jyu00 changed the title Job manager [WIP] Job manager Oct 14, 2019
@jyu00 jyu00 changed the title [WIP] Job manager Job manager Oct 15, 2019
Raises:
JobError: If a job cannot be submitted.
"""
if (all(isinstance(exp, ScheduleComponent) for exp in experiments) and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-checking - all or any?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assemble will fail if they're not all the same type, but any is probably more efficient here.

except JobError as err:
logger.warning("Unable to retrieve status for job %d (job ID=%s): %s",
i, job.job_id(), str(err))
statuses.append(None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this cause some ripples in report()? It seems it would not account for the job in the non-detailed output (which can be considered "by design"), but more importantly can you check it does not cause an error in the function (ie. when accessing status.value or similar cases)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not counting in the summary report is by design; fixed status.value. We really should have a JobStatus.UNKNOWN.

error_report = self._jm.error_message()
self.assertIsNotNone(error_report)
print("JobManager.error_message(): \n{}".format(error_report))
print("\nJobManager.report(): \n{}".format(self._jm.report()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do a pass for the prints, which seem to be leftovers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were intentional to allow someone to "eyeball" them in the Travis log. But perhaps they just pollute the log. I'll remove them.

Copy link
Member

@diego-plan9 diego-plan9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jyu00 ! I think it is a solid start - merging so we can split off the remaining work in upcoming PRs and help reviewing.

from qiskit.providers.basebackend import BaseBackend
from qiskit.providers.exceptions import JobTimeoutError
from qiskit.providers import (BaseJob, # type: ignore[attr-defined]
JobTimeoutError, BaseBackend)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note I reverted this change from master during the conflict solving at the latest merge, as technically the qiskit.providers API is the one that is stable - we don't have that guarantee for qiskit.providers.xxx.yyy (at the expense of the mypy ignore).

@diego-plan9 diego-plan9 merged commit 94398a4 into Qiskit:master Oct 17, 2019
@jyu00 jyu00 mentioned this pull request Oct 23, 2019
@jyu00 jyu00 deleted the job_manager_initial branch November 6, 2019 14:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants