schrodinger.tasks.hosts module¶
- schrodinger.tasks.hosts.strip_gpu_from_localhost(hostname)¶
Check host strings to see if ‘localhost-gpu’ was specified and, if so, replace with ‘localhost’
- Parameters
hostname (str) – Host name to be checked
- Returns
The actual hostname value to be used in a job command.
- Return type
str
- schrodinger.tasks.hosts.get_GPGPUs(hostname)¶
- class schrodinger.tasks.hosts.Host(name, processors=0, num_gpus=0, gpulist=None)¶
Bases:
schrodinger.models.json.JsonableClassMixin
,schrodinger.job.jobcontrol.Host
Extension of jobcontrol.Host class with GPUs.
- CPUTYPE = 'cpu'¶
- GPUTYPE = 'gpu'¶
- __init__(name, processors=0, num_gpus=0, gpulist=None)¶
- toJsonImplementation()¶
Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.
- Returns
A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders
- classmethod fromJsonImplementation(json_dict)¶
Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.
- Parameters
json_dict (dict) – A dictionary loaded from a JSON string or file.
- Returns
An instance of the derived class.
- Return type
cls
- classmethod fromJobControlHost(jchost: schrodinger.job.jobcontrol.Host, ncpus: bool) schrodinger.tasks.hosts.Host ¶
Create a Host object from a jobcontrol.Host object.
- Parameters
jchost – The jobcontrol.Host object to be converted
ncpus – Whether to display number of cpus in label
- Returns
The new Host object
- setGpuList(gpulist)¶
- autoSetGpuList()¶
- hostType()¶
Used to determine what type of host this is.
- label()¶
Returns the string to show in controls, etc.
- units()¶
Return the unit string for the type of processors provided by this host.
- maxNum()¶
Returns the number of processors for the type of host - for GPU host, return the number of GPUs, for non-GPU hosts, return the number of CPUs.
- class schrodinger.tasks.hosts.Gpu(index, desc)¶
Bases:
schrodinger.models.json.JsonableClassMixin
- __init__(index, desc)¶
- toJsonImplementation()¶
Abstract method that must be defined by all derived classes. Converts an instance of the derived class into a jsonifiable object.
- Returns
A dict made up of JSON native datatypes or Jsonable objects. See the link below for a table of such types. https://docs.python.org/2/library/json.html#encoders-and-decoders
- classmethod fromJsonImplementation(json_dict)¶
Abstract method that must be defined by all derived classes. Takes in a dictionary and constructs an instance of the derived class.
- Parameters
json_dict (dict) – A dictionary loaded from a JSON string or file.
- Returns
An instance of the derived class.
- Return type
cls
- schrodinger.tasks.hosts.get_hosts(ncpus: bool = True, excludeGPGPUs: bool = True) List[schrodinger.tasks.hosts.Host] ¶
Return a list of Host objects for use in config dialogs. Note these are a subclass of jobcontrol.Host which has additional features for text labels and accounting for GPUs.
- Parameters
ncpus – whether host text labels should include number of processors
excludeGPGPUs – whether to exclude GPU hosts from the list
- schrodinger.tasks.hosts.get_hostsChanged_signal() PyQt6.QtCore.pyqtSignal ¶
Return the signal that is emitted when the list of hosts changes. This function is to be used in the GUI.
- schrodinger.tasks.hosts.get_host_by_name(name)¶
Get the Host object from the hosts list that matches the specified hostname.
- schrodinger.tasks.hosts.disable_local_gpu_check()¶
Globally disable the check for local GPU hosts.
This will disable checking for remote or local GPU hosts. This should only be used in backends to skip possibly expensive local GPU-checks which can be triggered for every task that’s instantiated (since every task will call get_hosts()). Don’t use this unless you know what you’re doing.