Skip to content
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

feat: job decorator #729

Merged
merged 20 commits into from
Oct 16, 2023
Merged

feat: job decorator #729

merged 20 commits into from
Oct 16, 2023

Conversation

ajberdy
Copy link
Contributor

@ajberdy ajberdy commented Oct 9, 2023

Issue #, if available:

Description of changes:

Enable running jobs via decorated functions!

Testing done:

Unit/integ/manual

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Co-authored-by: Matthew Beach <[email protected]>
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (c4f07f5) 100.00% compared to head (9d2214a) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #729    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          127       129     +2     
  Lines         8237      8387   +150     
  Branches      1832      1866    +34     
==========================================
+ Hits          8237      8387   +150     
Files Coverage Δ
src/braket/aws/aws_quantum_job.py 100.00% <100.00%> (ø)
src/braket/aws/aws_session.py 100.00% <100.00%> (ø)
src/braket/jobs/__init__.py 100.00% <100.00%> (ø)
src/braket/jobs/_entry_point_template.py 100.00% <100.00%> (ø)
src/braket/jobs/config.py 100.00% <100.00%> (ø)
src/braket/jobs/data_persistence.py 100.00% <100.00%> (ø)
src/braket/jobs/environment_variables.py 100.00% <100.00%> (ø)
src/braket/jobs/hybrid_job.py 100.00% <100.00%> (ø)
src/braket/jobs/image_uris.py 100.00% <100.00%> (ø)
src/braket/jobs/local/local_job.py 100.00% <100.00%> (ø)
... and 1 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ajberdy
Copy link
Contributor Author

ajberdy commented Oct 9, 2023

2 loc missing coverage and a few dangling todos remaining

from logging import Logger, getLogger
from pathlib import Path
from types import ModuleType
from typing import Any, Callable, Dict, Iterable, Optional, Union
Copy link
Member

Choose a reason for hiding this comment

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

We've now deprecated Python 3.8, so you no longer have to import Callable, Dict and Iterable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exciting, I will update this PR to use 3.9+ syntax

@ajberdy ajberdy marked this pull request as ready for review October 15, 2023 18:56
@ajberdy ajberdy requested a review from a team as a code owner October 15, 2023 18:56
Comment on lines 267 to 272
"Serialization failed for decorator hybrid job. For troubleshooting, "
"see the developer guide: #todo: link to docs with info as below"
# "Serialization failed for decorator hybrid job. If you are referencing "
# "an object from outside the function scope, either directly or through "
# "function parameters, try instantiating the object inside the decorated "
# "function instead."
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we update this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I'm guessing we won't have the docs till after the launch? So I can put a temporary error message with the content itself instead of a link

@ajberdy ajberdy requested a review from kshitijc October 16, 2023 17:00
kshitijc
kshitijc previously approved these changes Oct 16, 2023
tags: dict[str, str] = None,
logger: Logger = getLogger(__name__),
) -> Callable:
"""Creates a job by invoking the Braket CreateJob API.
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't valid if local=True. Could we update to make it unambiguous?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!

@ajberdy ajberdy merged commit 71ef0ec into main Oct 16, 2023
22 checks passed
@ajberdy ajberdy deleted the feature/job-decorator branch October 16, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants