Skip to content

Commit

Permalink
Merge branch 'feature/job-decorator' into cd-results
Browse files Browse the repository at this point in the history
  • Loading branch information
ajberdy authored Oct 13, 2023
2 parents 6a2600e + 0efbd82 commit 6a4dd1e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 51 deletions.
43 changes: 0 additions & 43 deletions examples/job.py

This file was deleted.

11 changes: 5 additions & 6 deletions src/braket/jobs/hybrid_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,14 @@ def _sanitize(hyperparameter: Any) -> str:

sanitized = (
string_hp
# replace newlines with spaces
# replace forbidden characters with close matches
.replace("\n", " ")
# replace forbidden characters with "?"
.replace("$", "?")
.replace("(", "?")
.replace("&", "?")
.replace("`", "?")
.replace("(", "{")
.replace("&", "+")
.replace("`", "'")
# not technically forbidden, but to avoid mismatched parens
.replace(")", "?")
.replace(")", "}")
)

# max allowed length for a hyperparameter is 2500
Expand Down
2 changes: 1 addition & 1 deletion test/integ_tests/test_create_quantum_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def decorator_job(a, b: int, c=0, d: float = 1.0, **extras):
with open(hp_file, "r") as f:
hyperparameters = json.load(f)
assert hyperparameters == {
"a": "MyClass(value)",
"a": "MyClass{value}",
"b": "2",
"c": "0",
"d": "5",
Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests/braket/jobs/test_hybrid_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def my_job():
),
(
"with weird chars: (&$`)",
"with weird chars: ?????",
"with weird chars: {+?'}",
),
(
"?" * 2600,
Expand Down

0 comments on commit 6a4dd1e

Please sign in to comment.