question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A workflow engine

See original GitHub issue

IBMQ needs a workflow engine to manage the execution and retrieval of jobs.

This would be a higher level construct than Job, which is the unit of interaction with the backends (from the API’s point of view). But jobs have arbitrary limitations that should be masked from the high-level user. For example each backend places its own limit on the number of experiments contained within a job. So currently you have to manually batch many circuits into some jobs, manually store the jobs into some datastructure, and manually retrieve/post-process the results. If one job fails, it can be difficult to recover the total results without manually resubmitting that job and replacing the entry in the database.

The workflow engine automates this process. It can be called a JobManager. At a high level, the user specifies which “tasks” they would like to run. Even if a task has a million circuits, the workflow engine will take care of splitting them, farming them out to the backends, reporting on the progress to the user, and joining the reuslts into a single Result for the task.

Simple pseudo-code (up for discussion):

from qiskit.providers.IBMQ import JobManager
jm = JobManager()

# build a million circuits
from qiskit.circuit.random import random_circuit
circs = []
for _ in range(1000000):
    circs.append(random_circuit())

# farm out the jobs.. 
from qiskit import IBMQ
p = IBMQ.load_account()
device = p.backends.tenerife()
jm.run(circs, backend=device)

# inquire about the status of my runs
jm.status()  # says how many jobs, and the status of each

# join result of (potentially) multiple jobs
res = jm.result()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jyu00commented, Nov 4, 2019

Implemented via the PRs mentioned in this issue.

0reactions
ajavadiacommented, Oct 20, 2019

Hi @jyu00

1- Yes I think partial Jobs/Results should be supported. Terra recently started to support partial results for cases when only a subset of circuits succeed in a job (https://github.com/Qiskit/qiskit-terra/pull/3217). This would be analogous to that. It would be nice if the jobmanager.report() could say something like circuits 200-300 failed to submit. Reason: no credit left. I think currently it says something about job failure, but doesn’t tell the user which circuits in the original huge list this corresponds to.

2- Hm, yeah I see. But that sort of defeats the purpose here because the point of this is to hide “API details” from a user who doesn’t care how jobs are split up, what the limits are, etc. They just want to execute 1000 circuits and look at the result.

So how about: when I do jobmanager.result(), maybe it could return a JobManagerResult class which is agnostic to how many jobs it took to create it? This would basically be a wrapper around the list of results you currently return, but would support methods like jm_result.get_counts(circuit). This would not have a single job_id associated with it (could have a list of job_id maybe).

3- I’m good with whatever you decide here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is a Workflow Engine? - IBM
A workflow engine is the application that runs digital workflow software. It enables businesses to create and automate workflows — in many ...
Read more >
Workflow engine - Wikipedia
A workflow engine is a core technique for task allocation software, such as business process management, in which the workflow engine allocates tasks...
Read more >
Difference Between Workflow Engine vs Business Rule Engine
A workflow engine is a software application designed to help users enforce a series of recurring tasks that make up a business process...
Read more >
Workflow Engine Guide | Smartsheet
A workflow engine, also known as an orchestration engine, is software that automates complex business processes. Usually, this software links to a database ......
Read more >
What is a Workflow Engine? - ProcessMaker
A workflow engine is a software application that helps organizations automate tasks. It manages and monitors activities in a workflow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found