Skip to content

Commit

Permalink
fix: Fix inconsistencies (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijc authored Sep 20, 2021
1 parent 04e38dd commit ade113d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/braket/aws/aws_quantum_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AwsQuantumJob:
RESULTS_READY_STATES = {"COMPLETED"}
TERMINAL_STATES = RESULTS_READY_STATES.union(NO_RESULT_TERMINAL_STATES)
DEFAULT_RESULTS_POLL_TIMEOUT = 864000
DEFAULT_RESULTS_POLL_INTERVAL = 1
DEFAULT_RESULTS_POLL_INTERVAL = 5
RESULTS_FILENAME = "results.json"
RESULTS_TAR_FILENAME = "model.tar.gz"
LOG_GROUP = "/aws/braket/jobs"
Expand Down Expand Up @@ -340,17 +340,17 @@ def state(self, use_cached_value: bool = False) -> str:
"""
return self.metadata(use_cached_value).get("status")

def logs(self, wait: bool = False, poll: int = 5) -> None:
def logs(self, wait: bool = False, poll_interval_seconds: int = 5) -> None:
"""Display logs for a given job, optionally tailing them until job is complete.
If the output is a tty or a Jupyter cell, it will be color-coded
based on which instance the log entry is from.
Args:
wait (bool): Whether to keep looking for new log entries until the job completes
(default: False).
Default: False.
poll (int): The interval in seconds between polling for new log entries and job
completion (default: 5).
poll_interval_seconds (int): The interval in seconds between polling for new log
entries and job completion. Default: 5.
Raises:
exceptions.UnexpectedStatusException: If waiting and the training job fails.
Expand Down Expand Up @@ -392,7 +392,7 @@ def logs(self, wait: bool = False, poll: int = 5) -> None:
color_wrap = logs.ColorWrap()

while True:
time.sleep(poll)
time.sleep(poll_interval_seconds)

has_streams = logs.flush_log_streams(
self._aws_session,
Expand Down Expand Up @@ -479,7 +479,7 @@ def result(
Args:
poll_timeout_seconds (float): The polling timeout for `result()`. Default: 10 days.
poll_interval_seconds (float): The polling interval for `result()`. Default: 1 second.
poll_interval_seconds (float): The polling interval for `result()`. Default: 5 seconds.
Returns:
Dict[str, Any]: Dict specifying the job results.
Expand Down Expand Up @@ -518,7 +518,7 @@ def download_result(
Default: 10 days.
poll_interval_seconds: (float): The polling interval for `download_result()`.
Default: 1 second.
Default: 5 seconds.
Raises:
RuntimeError: if job is in FAILED or CANCELLED state.
Expand Down
2 changes: 1 addition & 1 deletion src/braket/jobs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class OutputDataConfig:
class StoppingCondition:
"""Conditions that spedifits when the job should be forcefully stopped."""

maxRuntimeInSeconds: int = 100_000
maxRuntimeInSeconds: int = 5 * 24 * 60 * 60


@dataclass
Expand Down
6 changes: 3 additions & 3 deletions test/unit_tests/braket/aws/test_aws_quantum_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ def test_logs(
quantum_job._aws_session.describe_log_streams.side_effect = log_stream_responses
quantum_job._aws_session.get_log_events.side_effect = log_events_responses

quantum_job.logs(wait=True, poll=0)
quantum_job.logs(wait=True, poll_interval_seconds=0)

captured = capsys.readouterr()
assert captured.out == "\n".join(
Expand Down Expand Up @@ -1069,7 +1069,7 @@ def get_log_events(log_group, log_stream, start_time, start_from_head, next_toke

quantum_job._aws_session.get_log_events.side_effect = get_log_events

quantum_job.logs(wait=True, poll=0)
quantum_job.logs(wait=True, poll_interval_seconds=0)

captured = capsys.readouterr()
assert captured.out == "\n".join(
Expand Down Expand Up @@ -1108,7 +1108,7 @@ def test_logs_error(quantum_job, generate_get_job_response, capsys):
)

with pytest.raises(ClientError, match="Some error message"):
quantum_job.logs(wait=True, poll=1)
quantum_job.logs(wait=True, poll_interval_seconds=1)


def test_invalid_input_parameters(entry_point, aws_session):
Expand Down

0 comments on commit ade113d

Please sign in to comment.