NeosClient#
- class gamspy.NeosClient(email: str, server: str = 'https://neos-server.org:3333', username: str | None = None, password: str | None = None, priority: str = 'long', is_blocking: bool = True)[source]#
Bases:
object
Methods
download_output
(job_number, job_password[, ...])Downloads the output of the job and writes it in a zip file.
email_job_results
(job_number, job_password)Results for a finished job will be emailed to the email address specified in the job submission.
get_completion_code
(job_number, job_password)Gets the completion code for "Done" jobs.
get_final_results
(job_number, job_password)Retrieve results from a submitted job on NEOS.
get_intermediate_results
(job_number, ...[, ...])Gets intermediate results of a job submitted to NEOS, starting at the specified character offset up to the last received data.
get_job_info
(job_number, job_password)Gets information about the job.
get_job_status
(job_number, job_password)Returns the status of the job.
is_alive
()Checks if NEOS Server is alive
kill_job
(job_number, job_password[, killmsg])Cancel a submitted job that is running or waiting to run on NEOS.
Prints NEOS Server queue
submit_job
([xml_path, working_directory])Submits the job to NEOS Server.
- download_output(job_number: int, job_password: str, working_directory: str = '.') None [source]#
Downloads the output of the job and writes it in a zip file.
- Parameters:
- job_numberint
- job_passwordstr
- working_directory: str
- email_job_results(job_number: int, job_password: str) str [source]#
Results for a finished job will be emailed to the email address specified in the job submission. If results are too large for email, they will not be emailed (though they can be accessed via the NEOS website)
- Parameters:
- job_numberint
- job_passwordstr
- Returns:
- str
- get_completion_code(job_number: int, job_password: str) str [source]#
Gets the completion code for “Done” jobs. Result is undefined for jobs that are “Waiting” or “Running”. Returns “Normal”, “Out of memory”, “Timed out”, “Disk Space”, “Server error”, “Unknown Job”, or “Bad Password”
- Parameters:
- job_numberint
- job_passwordstr
- Returns:
- str
- get_final_results(job_number: int, job_password: str, is_blocking: bool = True) Binary [source]#
Retrieve results from a submitted job on NEOS. If the job is still running and the user is not authenticated, then this function will hang until the job is finished. The function returns a base-64 encoded object.
- Parameters:
- job_numberint
- job_passwordstr
- is_blockingbool, optional
- Returns:
- xmlrpc.client.Binary
- get_intermediate_results(job_number: int, job_password: str, offset: int, is_blocking: bool = True) Binary [source]#
Gets intermediate results of a job submitted to NEOS, starting at the specified character offset up to the last received data. Intermediate results are usually the standard output of the solver daemon. Note that because output does not stream for jobs with “long” priority (default value), getIntermediateResults() will not return any results for long priority jobs. Output does stream for jobs with “short” priority (maximum time of 5 minutes).
- Parameters:
- job_numberint
- job_passwordstr
- offsetint
- is_blockingbool, optional
- Returns:
- xmlrpc.client.Binary
- get_job_info(job_number: int, job_password: str) tuple [source]#
Gets information about the job.
- Parameters:
- job_numberint
- job_passwordstr
- Returns:
- tuple
(category, solver_name, input, status, completion_code)
- get_job_status(job_number: int, job_password: str) str [source]#
Returns the status of the job.
- Parameters:
- job_numberint
- job_passwordstr
- Returns:
- str
Either “Done”, “Running”, “Waiting”, “Unknown Job”, or “Bad Password”
- kill_job(job_number: int, job_password: str, killmsg='') str [source]#
Cancel a submitted job that is running or waiting to run on NEOS.
- Parameters:
- job_numberint
- job_passwordstr
- killmsgstr, optional
- Returns:
- str
- submit_job(xml_path: str = 'neos.xml', working_directory: str = '.') tuple[int, str] [source]#
Submits the job to NEOS Server.
- Parameters:
- xml_pathstr, optional
- is_blockingbool, optional
- Returns:
- Tuple[int, str]
Job number and job password
- Raises:
- NeosClientException
In case there was an error on NeosServer