-
Notifications
You must be signed in to change notification settings - Fork 33
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
Program proxy for Qiskit Runtime requests #895
Comments
How can the primitive execution be hacked in the sidecar? This issue seems interesting but I'm not sure how to do it. |
Qiskit runtime is an Rest api service. It looks like client for runtime ( We can use this env variable to send request not to runtime, but to our sidecar which will be sending requests to runtime service and preserve ids of executed services. For example inside of sidecar container we will have simple http service, something like this pseudocode: @route("/")
def handle_runtime_request(request):
# send request to runtime
runtime_service_response = requests.post(url="RUNTIME_URL", data=request.data)
# get primitive job id and save it to job
primitive_job_id = runtime_service_response.get("job_id")
gateway_response = requests.post(
"api/v1/jobs/<program_job_id>/primitives",
data={"primitive_id": primitive_job_id})
return runtime_service_response we still need to think how to pass program_job_id 🤔 |
probably this issue can be splitted into 2:
|
we may use tracestate for |
I wonder if this feature should be in the middleware. Should Qiskit or providers be responsible to the association between the program and primitives? |
I would say it should be in middleware, since we build on top of primitives. Primitives services does not know anything about higher level abstractions. At least it will be like that for now. Later on things might change :) |
I see. Is there any other way to do this other than proxying the request in the sidecar? I wonder if it only works with the ibm_runtime. |
🤔 I was thinking about sidecar because it is easy to turn off, it's loosely coupled. But we are more than open for other suggestions :) |
we can proxy it within gateway itself :) |
I see. I wonder if it's ibm_runtime specific implementation. As far as it works with generic providers, it's OK for me. |
The |
I think it is runtime specific.
|
Somehow the |
For the keeping the primitive job ids, we can add a new table with a middleware job id and a primitive job id or we can add a field to the current Job model that has the primitive job id list in a string. I guess that the former is better. @IceKhan13 WDYT? |
Either way works fine. If we want to go with second option, we will probably need to add new endpoint and handle writing this strings/list. It will be less code compared to option 1, I think 🤔 |
A couple of general questions:
|
What I'm doing is like
I have to looked at what are passed between them in more details. |
@IceKhan13 I don't see this env variable defined in the container running the program. It may not be simple to proxy the runtime request from the container. |
@IceKhan13 I wonder if it is possible proxying the primitive requests without ibm_runtime_service change. |
I found
|
Reviewing the issue and the comments and seeing that we are going to need to start configuring Istio I was thinking if we could use it as a way to analyse the traffic too for some specific DNS's, in this case runtime: https://istiobyexample.dev/monitoring-egress-traffic/ ( Just come to my mind don't take it too seriously 😅 ) |
I'm not sure how we do this yet. Can we create a session (implicitly or explicitly by user option) so that we can cancel all jobs in the session? |
We didn't discuss it I think, Aki. Maybe we can save some time together and brainstorm ideas. |
I put a sidecar container in the Ray node. I see the ray container is sending requests to |
Thank you @akihikokuroda ! ❤️ Friday / Monday I will start working on this too and let you know advances |
Data sent for estimator.run are these.
From the response, job_id is captured and RuntimeJob object is created and returned i
|
@akihikokuroda how do you see to create a draft pull request and comment it together next week with mine? (I will try to create it monday / tuesday) |
@Tansito So far, I'm still investigating what and how can be done in the sidecar. So I don't have anything to put in the PR except comments. |
I wonder if the simple sidecar works. The communication between the client and the server is encrypted. The sidecar can not see the contents. It probably must be a TLS proxy to see the contents. |
Scapy is under GPL-2.0. It may not be good for us to use. |
Mmm... Good catch... I don't think we can address that... Any idea? Because taking this into account I only see as solution an integration with the Runtime client (returning to other options like the callback one, and so on) 🤔
Oh! Good catch, Aki! Thank you. |
The runtime job id can be extracted in the proxy now. How can the proxy know the associated middleware job id for the runtime job id? I guess that the middleware job id must be put into the request header of the runtime job request. Is there any idea? @IceKhan13 @Tansito @psschwei |
I don't know any "standard" way to do this so probably a custom header would be my option to go. |
To make this work, the QiskitRuntimeService must be created with |
Webserver based proxy is working. I can take out the iptables configuration when we get the way to fake the backend address. |
Do you think we can close this pull request, @akihikokuroda ? |
Yes,we can. I'll open one to update the job.stop()tomorrow. |
What is the expected behavior?
We need to have a sidecar that proxy all QiskitRutnime requests and associate runtime jobs to Program.
Benifits:
Details
One way to implement this is to add list field
primitives_executions
toJob
model and add primitives job ids to that list. Population of this field will be happening in sidecar (basically within sidecar we will be hittingapi/v1/jobs/<job_id>/primitives
endpoint).When users run
job.stop()
from client we stop all associated primitives to that job.Epic #1162
The text was updated successfully, but these errors were encountered: