schrodinger.utils.env module

schrodinger.utils.env.append_path(env_dict, env_var, path)

Appends a path to env_var (defined as constants in schrodinger.utils.env) in the env_dict. This uses the traditional path seperator. We normalize the path argument.

Parameters:
  • env_var (str) – existing environment variable (example: schrodinger.utils.env.PATH)
  • path (str) – path to extend with
schrodinger.utils.env.prepend_path(env_dict, env_var, path)

Appends a path to env_var (defined as constants in schrodinger.utils.env) We normalize the path argument.

Parameters:
  • env_var (str) – existing environment variable (example: schrodinger.utils.env.PATH)
  • path (str) – path to extend with
class schrodinger.utils.env.swap_ld_library_path

Bases: contextlib.ContextDecorator

Restore LD_LIBRARY_PATH to the value that it was when we first ran a toplevel script. ORIGINAL_LD_LIBRARY_PATH is set by toplevel.sh

__enter__()
__exit__(*args)
__call__(func)

Call self as a function.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.env', '__doc__': '\n Restore LD_LIBRARY_PATH to the value that it was when we first ran a\n toplevel script. ORIGINAL_LD_LIBRARY_PATH is set by toplevel.sh\n ', '__enter__': <function swap_ld_library_path.__enter__>, '__exit__': <function swap_ld_library_path.__exit__>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.utils.env'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.utils.env.EnvironmentContext(key, value)

Bases: object

Context manager to temporarily set an environment variable and then return it to its original value upon exit.

__init__(key, value)

Initialize self. See help(type(self)) for accurate signature.

__enter__()
__exit__(*args)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.env', '__doc__': 'Context manager to temporarily set an environment variable\n and then return it to its original value upon exit.\n ', '__init__': <function EnvironmentContext.__init__>, '__enter__': <function EnvironmentContext.__enter__>, '__exit__': <function EnvironmentContext.__exit__>, '__dict__': <attribute '__dict__' of 'EnvironmentContext' objects>, '__weakref__': <attribute '__weakref__' of 'EnvironmentContext' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.utils.env'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.utils.env.remove_ssl_ld_library_path

Bases: contextlib.ContextDecorator

Temporarily remove SSL library path from the LD_LIBRARY_PATH. This will force ssh, as called by MPI, to be linked against the system libcrypto rather than the one in the Schrodinger software (JOBCON-5027). But sometimes the user has ssh but not libcrypto and then their ssh has to use our libcrypto (DESMOND-7780). So test whether ssh fails or not by actually running it. What a world!

__enter__()
__exit__(*args)
__call__(func)

Call self as a function.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.utils.env', '__doc__': '\n Temporarily remove SSL library path from the LD_LIBRARY_PATH. This will\n force ssh, as called by MPI, to be linked against the system libcrypto\n rather than the one in the Schrodinger software (JOBCON-5027).\n But sometimes the user has ssh but not libcrypto and then their ssh\n has to use our libcrypto (DESMOND-7780).\n So test whether ssh fails or not by actually running it. What a world!\n ', '__enter__': <function remove_ssl_ld_library_path.__enter__>, '__exit__': <function remove_ssl_ld_library_path.__exit__>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.utils.env'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.utils.env.prepend_sys_path(path)

Prepend to a specific path to sys.path. Strongly consider using a namespace

Parameters:path (str) – directory name of path