schrodinger.test.jobserver module¶
- Convenience functions for dealing with job server
(starting, killing, writing config file).
-
class
schrodinger.test.jobserver.ServerInfo(hostname, schrodinger, job_server_directory, username, pid, job_server_port)¶ Bases:
tuple-
__contains__(key, /)¶ Return key in self.
-
__len__()¶ Return len(self).
-
count(value, /)¶ Return number of occurrences of value.
-
hostname¶ Alias for field number 0
-
index(value, start=0, stop=9223372036854775807, /)¶ Return first index of value.
Raises ValueError if the value is not present.
-
job_server_directory¶ Alias for field number 2
-
job_server_port¶ Alias for field number 5
-
pid¶ Alias for field number 4
-
schrodinger¶ Alias for field number 1
-
username¶ Alias for field number 3
-
-
schrodinger.test.jobserver.running_compatibility_tests()[source]¶ Returns true if we are running backwards compatibility tests.
This function is duplicated in server_management.py for backwards compatibility.
-
schrodinger.test.jobserver.get_tls_config(cert_dir)[source]¶ - Parameters
cert_dir (str) – path to wildcard certificates
- Return type
dict
- Returns
dict for webserver tls config
-
schrodinger.test.jobserver.get_job_server_directory(basedir, username)[source]¶ Returns a unique path to a directory to store job server data in.
- Parameters
basedir (str) – prefix of path, usually tmpdir on remote
- Return type
str
- Rparam
Path to a directory
-
schrodinger.test.jobserver.get_job_server_config(job_server_directory)[source]¶ Return a path for a server-specific job server config in the job server directory.
-
schrodinger.test.jobserver.get_queue_type(hostname: str) → str[source]¶ Return a queue type in the format for jsc_admin for a given hostname.
-
schrodinger.test.jobserver.setup_host(hostname, schrodinger, job_server_directory, username, serve_queue_jobs)[source]¶ Set up authentication in a new directory.
-
schrodinger.test.jobserver.setup_supervisord(hostname, username)[source]¶ Setup supervisord to start jobserver in given hostname
-
schrodinger.test.jobserver.setup_server(hostname, schrodinger, job_server_directory, username, append=True, licensing=False, use_certs=False, certs_dir=None, use_shared_supervisors=False, use_ldap=True, use_socket_auth=True)[source]¶ Setup new server on arbitrary ports.
- Parameters
hostname (str) – name of host to set up jobserver
schrodinger (str) – path to SCHRODINGER
job_server_directory (str) – base directory for job server
username (str) – username to use on hostname
append (bool) – If True, add server config to jobserver.config, If False, overwrite jobserver.config
licensing (bool) – If True, pass licensing check params to queued jobs
use_certs – If True, use wildcard certificates in standard internal locations
use_shared_supervisors (bool) – Use shared supervisor executables
use_ldap (bool) – Enable LDAP authentication
use_socket_auth (bool) – Enable unix socket authentication
-
schrodinger.test.jobserver.run_command(ssh, command, login=False)[source]¶ Runs a command.
- Parameters
ssh (paramiko.SSHClient) – a paramiko.SSHClient with an established connection to the remote machine. If ssh is None, the command will be invoked by subprocess.run
command (list[str]) – The command to run as a list of string arguments
login (bool) – If True, command requries login shell for ssh
- Returns
The output of the executed command over ssh; None if local using subprocess
- Return type
str, or None
This function is duplicated in server_management.py for backward compatibility.
-
schrodinger.test.jobserver.write_ini_file(ini_file, ini_contents, ssh=None)[source]¶ Write the configuration file to manage jobserver
-
schrodinger.test.jobserver.monitor_job_server_with_supervisord(cmd, hostname, job_server_directory, username)[source]¶ monitor the given job server command under supervisord
-
schrodinger.test.jobserver.get_ports_from_file(job_server_directory, ssh=None)[source]¶ Parse the output of jobserver to get the pid and ports.
- Parameters
log_filename (str) – path of file to open
ssh (paramiko.SSHClient) – open ssh client, or None to read locally
- Return type
tuple(int,int,int,int)
-
schrodinger.test.jobserver.start_server(hostname, schrodinger, job_server_directory, username, serve_queue_jobs=False)[source]¶ Start a job_server in the
schrodingerdirectory on thehostnameprovided, using thejob_server_directoryas its local storage.
-
schrodinger.test.jobserver.create_job_server_config(hostname, username, job_server_directory)[source]¶ Copy the user_authentication that is created automatically at server setup from the remote server machine to the local launch host and dump it into a job server config file.
- Parameters
hostname (str) – name of hostname where job server config is located
-
schrodinger.test.jobserver.modify_jobserver_yml(hostname, job_server_directory, username, licensing, use_shared_supervisors, certs_dir=None, use_ldap=True, use_socket_auth=True)[source]¶ Modify the jobserver config to respect licensing and web server certificates for a multi-user queue server.
- Parameters
hostname (str) – name of hostname where job server config is located
job_server_directory – path to job server on hostname
licensing (bool) – If True, enable license checking on job_server
certs_dir (str) – If provided, use wildcard certificates from that directory.
use_shared_supervisors (bool) – Use shared supervisor executables
use_ldap (bool) – Enable LDAP authentication
use_socket_auth (bool) – Enable unix socket authentication
-
schrodinger.test.jobserver.kill_server(server)[source]¶ Kill the job_server on
hostnamethat is usingjob_server_directoryas its local storage.
-
schrodinger.test.jobserver.clean_server_dir(server)[source]¶ Remove
job_server_directoryonhostname.
-
schrodinger.test.jobserver.reload_supervisord(ssh, username)[source]¶ Re-read configuration files and start any updated services. This is “safe reload” operation and doesn’t restart any processes running under supervisord.
- Parameters
ssh (paramiko.SSHClient) – open ssh connection
-
schrodinger.test.jobserver.start_localhost_server(hostname, schrodinger, job_server_directory)[source]¶
-
schrodinger.test.jobserver.stop_localhost_server(server)[source]¶ Stop the jobserver running in localhost
-
schrodinger.test.jobserver.get_ssh_client(hostname, username)[source]¶ Return ssh client for hostname. Closes ssh connection automatically.
- Parameters
hostname (str) – name of remote host
-
schrodinger.test.jobserver.get_username_from_host_entry(host_entry_name)[source]¶ Return username from host_entry_name to find the correct remote user. This user name is useful for directory creation, and remote authentication.
- Parameters
host_entry_name (str) – name of host entry (localhost, bolt-gpu)
- Return type
str