lxm3.xm_cluster.PythonPackage¶
- class lxm3.xm_cluster.PythonPackage(entrypoint: CommandList | ModuleName, path: str = '.', resources=NOTHING, extra_packages=NOTHING, pip_args=NOTHING)¶
Python package describes an executable that can be packaged by
pip install.PythonPackagedescribes a python distribution that can be installed bypip install. This is the recommended way to package python projects. For an introduction to python packaging, see Packaging Python Projects.Note
lxm3 uses
pip installto install the package into a temporary directory that will be subsequently packaged into a zip archive that will be deployed and unzipped when jobs run on the cluster. However, this should be considered an implementation detail.lxm3 uses
pip install --no-depsby default to install the package. This means that lxm3 will not install the dependencies required by the project. The reason is that typical ML dependencies are large. (e.g. TensorFlow is around 400MB) Therefore, you should install your dependencies first on the cluster (better, if you are using singularity, install them in the container).The root directory of the deployed archive will be added to PYTHONPATH, so you can import your package as usual. However, if that interferes with package imports, please open an issue and let us know.
- entrypoint¶
Entrypoint for the built executable.
Currently, only
ModuleNameandCommandListare supported.For
ModuleName, this corresponds to runningpython3 -m <module_name>.For
CommandList, this corresponds to running a shell script including the commands.
- path¶
Path to the python project. This should be the path to a directory
paththat can be installed as a python package bypip install <path>. If it’s a relative path, this will be resolved relative to the launcher’s working directory.- Type:
str
- extra_packages¶
List of paths to additional packages that will be install by
pip.extra_packagesis useful if you also want to include a dependency that you are also working on locally and you want to use your development version which are not installed in the runtime environment.- Type:
List[str]
- pip_args¶
Additional options that will be passed to
pip install. Defaults to--no-deps --no-compile.- Type:
List[str]
- __init__(entrypoint: CommandList | ModuleName, path: str = '.', resources=NOTHING, extra_packages=NOTHING, pip_args=NOTHING) None¶
Method generated by attrs for class PythonPackage.
Methods
__init__(entrypoint[, path, resources, ...])Method generated by attrs for class PythonPackage.
Attributes
name