From 0c97a91e57225d395d5b05d2f5a39aa46341e0ac Mon Sep 17 00:00:00 2001 From: pradeepm66 Date: Tue, 16 Jul 2024 00:01:30 -0700 Subject: [PATCH] multi-pilot changes --- examples/pq_multi_dask.py | 4 ++-- pilot/pilot_compute_service.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/pq_multi_dask.py b/examples/pq_multi_dask.py index 328aeda..5871c28 100644 --- a/examples/pq_multi_dask.py +++ b/examples/pq_multi_dask.py @@ -51,11 +51,11 @@ def circuit(parameters): # Submit tasks to pcs tasks = [] for i in range(1000): - k = pcs.submit_task(f"task_pennylane-{i}", pennylane_quantum_circuit) + k = pcs.submit_task(pennylane_quantum_circuit, task_name = f"task_pennylane-{i}" ) tasks.append(k) for i in range(1000): - k = pcs.submit_task(f"task_pennylane-{i}", pennylane_quantum_circuit, pilot=pilots[0]) + k = pcs.submit_task(pennylane_quantum_circuit, task_name = f"task_pennylane-{i}", pilot=pilots[0]) tasks.append(k) diff --git a/pilot/pilot_compute_service.py b/pilot/pilot_compute_service.py index 1c9a0dd..6117ce0 100644 --- a/pilot/pilot_compute_service.py +++ b/pilot/pilot_compute_service.py @@ -137,7 +137,7 @@ def get_client(self): """ return self.cluster_manager.get_client() - def submit_task(self, task_name, func, *args, **kwargs): + def submit_task(self, func, *args, **kwargs): pilot_scheduled = 'ANY' if kwargs.get("pilot"): @@ -146,6 +146,11 @@ def submit_task(self, task_name, func, *args, **kwargs): pilot_scheduled = kwargs["pilot"] del kwargs["pilot"] + task_name = kwargs.get("task_name", f"task-{uuid.uuid4()}") + if kwargs.get("task_name"): + del kwargs["task_name"] + + if not self.client: self.client = self.get_client()