Skip to content

Commit

Permalink
fix: wait and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeach-aws committed Oct 13, 2023
1 parent 5d67f02 commit adfc964
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 2 additions & 4 deletions examples/hybrid_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
device_arn = Devices.Amazon.SV1


@hybrid_job(device=device_arn) # choose priority device
@hybrid_job(device=device_arn, wait_until_complete=True) # choose priority device
def run_hybrid_job(num_tasks=1):
device = AwsDevice(device_arn) # declare AwsDevice within the hybrid job

Expand All @@ -44,7 +44,5 @@ def run_hybrid_job(num_tasks=1):


job = run_hybrid_job(num_tasks=5)
print(job)

result = job.result()
print(result)
print(job.result())
9 changes: 4 additions & 5 deletions examples/hybrid_job_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,17 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import os

from braket.aws import AwsDevice, AwsQuantumJob
from braket.circuits import Circuit, FreeParameter, Observable
from braket.devices import Devices
from braket.jobs import save_job_result
from braket.jobs import get_job_device_arn, save_job_result
from braket.jobs.metrics import log_metric


def run_hybrid_job(num_tasks: int):
# use the device specified in the hybrid job
device = AwsDevice(os.environ.get("AMZN_BRAKET_DEVICE_ARN"))
device = AwsDevice(get_job_device_arn())

# create a parametric circuit
circ = Circuit()
Expand All @@ -49,6 +48,6 @@ def run_hybrid_job(num_tasks: int):
source_module="hybrid_job_script.py", # specify file or directory with code to run
entry_point="hybrid_job_script:run_hybrid_job", # specify function to run
hyperparameters={"num_tasks": 5},
wait_until_complete=True,
)
print(job)
print(job.result())
print(job.result())

0 comments on commit adfc964

Please sign in to comment.