Bases: object
The central class through which we control the PlayMolecule backend.
Starts a PlayMolecule session with a user token, each user has his own unique token. There are some operations which can only be performed by using the Admin token.
token (str) – The user token. If None it will try to read it from the config file.
wait_for_backend (bool) – If set to True, it will block execution until it manages to contact the PlayMolecule backend
server_ip (str) – The IP address of the backend server. If None it will try to read it from the config file.
server_port (int) – The port on which the backend server listens. If None it will try to read it from the config file.
server_version (str) – The API version of the backend server. If None it will try to read it from the config file.
server_protocol (str) – The protocol used by the backend server.
Examples
>>> s = Session("my_token")
>>> s = Session("my_token", server_ip="127.0.0.1", server_port=8095, wait_for_backend=True)
Cancels a job.
This will set the status to ERROR and stop any running execution (children as well)
execid (str) – The execution ID of the job we wish to cancel
Change the password of a user
Deletes a job and all associated data and metadata related to it from the backend. Cannot be undone.
Describe the input parameters of an app.
Returns or prints the available apps.
The list of apps is printed if _logger is True else it’s returned
Finds and returns a Job object
job – The job object with all it’s parameters set
Examples
>>> job = s.get_job(execid="3cadd50b-b208-4a3d-8cf3-d991d22e858a")
Returns or prints a list of submitted jobs.
limit (int) – Maximum number of jobs to be listed or returned
group (str) – The executions group to be returned
appid (str) – Specify the id of an app to return only executions of this app
execid (str) – Specify the execution ID of a job. It can accept a partial beginning of an execution ID or the whole execid
count (bool) – If True it will only return the number of jobs matching the above criteria
in_status (list) – A list of JobStatus codes. Jobs which are in any of the specified states will be returned
not_in_status (list) – A list of JobStatus codes. Only jobs which don’t belong to any of the specified states will be returned
newer_than (int) – Return only jobs more recent than newer_than seconds.
older_than (int) – Return only jobs more old than older_than seconds.
_logger (bool) – Set as True for printing the info and errors in sys.stdout. If False, it returns the same information as a list (default=True).
execs – A list of job executions
Gets the current status of all PlayMolecule backend services
_logger (bool) – Set to False to return the status of the services instead of printing them to sys.stdout
Logs in a user retrieving the user token from the user name and password
Registers a new user in the backend
admin_token (str) – The admin user token
Retrieve the results of several jobs.
outdir (str) – Path to which to retrieve the jobs
force (bool) – If force=True, the destination folder will be overwritten
execid – The id of the job to be retrieved.
name (str) – The name of an execution to be retrieved
group (str) – The group of an execution to be retrieved
recursive (bool) – Set to True to store the jobs in subfolders named by the job names
_logger (bool) – Set to False to reduce verbosity
Examples
>>> s.retrieve_jobs("./results", execid="3cadd50b-b208-4a3d-8cf3-d991d22e858a")
>>> s.retrieve_jobs("./results", group="my_job_group") # Will retrieve all jobs of the group
Sets the status of a job
Examples
>>> s.set_job_status(execid="3cadd50b-b208-4a3d-8cf3-d991d22e858a", status=JobStatus.ERROR)
Returns a new job object of the specified app.
job – The new job object
Examples
>>> job = s.start_app("ProteinPrepare")
>>> job.pdbid = "3ptb"
>>> job.submit()
Blocks execution until it’s able to contact the backend server