SolveJob
Bases: BaseModel
A model to represent a job for solving model problems.
set_evaluation_model(model: Model | None) -> None
Set the evaluation model for the solved job.
This will be done automatically. Normally there is no need to call this method.
Parameters:
-
model(Model | None) –
get_status(client: ILunaSolve | None = None, status_source: Literal['cached', 'remote'] = 'cached') -> StatusEnum
Retrieve the current status of the solve job.
Parameters:
-
status_source(Literal['cached', 'remote'], default:'cached') –If "cached", the status is retrieved from the cached status. If "remote", the status is retrieved from the remote service.
-
client(Optional[ILunaSolve], default:None) –The client to be used. If not provided, a new client is created using
Returns:
-
StatusEnum–The current status of the solve job, represented as a value from the
StatusEnumenumeration.
result(client: ILunaSolve | None = None, sleep_time_max: float = 60.0, sleep_time_increment: float = 5.0, sleep_time_initial: float = 5.0, call_style: CallStyle = CallStyle.ACTIVE_WAITING) -> Solution | None
Get the result of the solve job.
This function uses the provided client or creates a new one to retrieve and the result of this solve job. Depending on the call style, it can actively wait for the result or return immediately.
Parameters:
-
client(Optional[ILunaSolve], default:None) –The client to be used. If not provided, a new client is created using ClientFactory.
-
sleep_time_max(float, default:60.0) –Maximum sleep time in seconds between consecutive active waiting checks.
-
sleep_time_increment(float, default:5.0) –Increment value for the sleep time between checks during active waiting.
-
sleep_time_initial(float, default:5.0) –Initial sleep time in seconds for the active waiting process.
-
call_style(CallStyle, default:ACTIVE_WAITING) –Determines if this function will actively wait for the result or return immediately.
Returns:
-
Optional[Solution]–The result of the solve job or None if not available.
Raises:
-
Any exceptions raised by the use case's solve job call will propagate.–
cancel(client: ILunaSolve | None = None) -> None
Cancel a solve job.
This method cancels an already initiated solve job using the provided client or a default one if no client is specified.
Parameters:
-
client(Optional[ILunaSolve], default:None) –The client instance used to perform the cancel operation. If None, the client is obtained via the ClientFactory.
Returns:
-
None–
delete(client: ILunaSolve | None = None) -> None
Delete a job using the specified or default client.
This method deletes this job and solution. A client can optionally be provided otherwise, a default client is obtained through the factory.
Parameters:
-
client(Optional[ILunaSolve], default:None) –The client to be used for job deletion. If not provided, a default client is retrieved using
ClientFactory.
get_by_id(solve_job_id: str, client: ILunaSolve | None = None) -> SolveJob
Retrieve a solve-job by its ID.
Para>meters
solve_job_id: str
Get the solve-job id for which a SolveJob should be retrieved.
client : Optional[ILunaSolve], optional
The client to be used for job deletion. If not provided, a default client
is retrieved using ClientFactory.
Returns:
-
SolveJob–The solve-job object.