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

chore: tweak log messages #129

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions opvious/client/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async def _prepare_problem(
for label, param in problem.parameters.items():
builder.set_parameter(label, param)
inputs = builder.build()
_logger.info(
_logger.debug(
"Validated inputs. [parameters=%s]",
builder.parameter_entry_count,
)
Expand Down Expand Up @@ -540,9 +540,11 @@ async def queue_solve(
annotations=encode_annotations(annotations or []),
),
) as res:
return res.json_data()["uuid"]
uuid = res.json_data()["uuid"]
_logger.info("Queued solve. [uuid=%s]", uuid)
return uuid

async def cancel_solve(self, uuid: Uuid) -> bool:
async def cancel_solve(self, uuid: Uuid) -> None:
"""Cancels a running solve

This method will throw if the solve does not exist or is not pending
Expand All @@ -551,11 +553,11 @@ async def cancel_solve(self, uuid: Uuid) -> bool:
Args:
uuid: The target solve's ID
"""
data = await self._executor.execute_graphql_query(
await self._executor.execute_graphql_query(
query="@CancelQueuedSolve",
variables=json_dict(uuid=uuid),
)
return bool(data["cancelQueuedSolve"])
_logger.info("Cancelled solve. [uuid=%s]", uuid)

async def poll_solve(
self, uuid: Uuid
Expand Down Expand Up @@ -609,11 +611,9 @@ async def _track_solve(self, uuid: Uuid) -> Optional[SolveOutcome]:
details.append(f"cuts={ret.cut_count}")
if ret.lp_iteration_count is not None:
details.append(f"iterations={ret.lp_iteration_count}")
_logger.info(
"QueuedSolve is running... [%s]", ", ".join(details)
)
_logger.info("Solve is running... [%s]", ", ".join(details))
else:
_logger.info("QueuedSolve is queued...")
_logger.info("Solve is queued...")
return None
return ret

Expand All @@ -630,21 +630,22 @@ async def wait_for_solve_outcome(
uuid: The target solve's ID
assert_feasible: Throw if the final outcome was not feasible
"""
_logger.debug("Tracking solve... [uuid=%s]", uuid)
outcome = await self._track_solve(uuid)
if not outcome:
raise Exception("Missing outcome")
status = solve_outcome_status(outcome)
if isinstance(outcome, FeasibleOutcome):
details = feasible_outcome_details(outcome)
_logger.info(
"QueuedSolve completed with status %s.%s",
"Solve completed with status %s.%s",
status,
f" [{details}]" if details else "",
)
elif assert_feasible:
raise UnexpectedSolveOutcomeError(outcome)
else:
_logger.info("QueuedSolve completed with status %s.", status)
_logger.info("Solve completed with status %s.", status)
return outcome

async def fetch_solve_inputs(self, uuid: Uuid) -> SolveInputs:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "opvious"
version = "0.19.0rc2"
version = "0.19.0rc3"
description = "Opvious Python SDK"
authors = ["Opvious Engineering <[email protected]>"]
readme = "README.md"
Expand Down
Loading