yr.InvokeOptions.debug#
- InvokeOptions.debug: DebugConfig#
Configure the stateful/stateless function runtime environment with conda, pip, working_dir, and env_vars.
- conda provides different Python runtime environments for stateful function.
Specify an existing conda environment (the environment exists on all nodes)
runtime_env = {"conda":"pytorch_p39"}Create and use conda environments through configuration.
runtime_env["conda"] = {"name":"myenv","channels": ["conda-forge"], "dependencies": ["python=3.9", "msgpack-python=1.0.5", "protobuf", "libgcc-ng", "cloudpickle=2.0.0", "cython=3.0.10", "pyyaml=6.0.2"]}Create and use a conda environment through a YAML file (the YAML file meets the conda requirements).
runtime_env = {"conda":"/home/env.yaml"}
pip installs dependencies for Python runtime environment.
working_dir configure the code path of the job.
env_vars configure process-level environment variables.
runtime_env = {"env_vars":{"OMP_NUM_THREADS": "32", "TF_WARNINGS": "none"}}shared_dir supports configuring a shared directory for some instance, with yr managing the lifecycle of this shared directory. shared_dir supports two fields: name and TTL. The name field only allows numbers, letters, “-”, and “_”. The TTL supports integers greater than 0 and less than INTMAX.
runtime_env = {"shared_dir":{"name": "user_define", "TTL": 5}}- Constraints of runtime_env:
The keys supported by runtime_env are conda, env_vars, pip, working_dir. Other keys will not take effect and will not cause errors.
Run the yr function with conda. The environment needs to have yr and its third-party dependencies. It is recommended that users first create a conda environment and then specify it with runtime_env, for example:
runtime_env = {"conda":"pytorch_p39"}runtime_env supports creating and switching conda environments using configurations. The configuration needs to install third-party dependencies for yr, for example:
runtime_env["conda"] = {"name":"myenv","channels": ["conda-forge"], "dependencies": ["python=3.9", "msgpack-python=1.0.5", "protobuf", "libgcc-ng", "cloudpickle=2.0.0", "cython=3.0.10", "pyyaml=6.0.2"]}The environment created using conda in runtime_env needs to be cleaned up by the user.
In runtime_env, conda can use pip to install dependencies, which are managed directly by conda.
runtime_env = {"conda":{'name': 'my_project_env', 'channels': ['defaults', 'conda-forge'], 'dependencies': ['python=3.9', {'pip': ['requests==2.25.1']}]}}Currently, Python 3.9 and Python 3.11 SDKs are available. The Python version of conda needs to be consistent with the SDK version.
If both InvokeOptions.env_vars and InvokeOptions.runtime_env[“env_vars”] are configured with the same key, the configuration in InvokeOptions.env_vars will be used.
If InvokeOptions.runtime_env[“working_dir”] is configured, use this configuration, otherwise, use YR.Config.working_dir and finally use the configuration in InvokeOptions.env_vars.
If you use conda, you need to specify the environment variable YR_CONDA_HOME to point to installation path.
shared_dir has the following constraints: 1. It is not recommended to configure different TTL for the same shared directory. 2. The minimum cleanup interval for shared directories is 5 seconds. 3. When multiple yr Agents are deployed on the same node, each Agent must be configured with different root directory to prevent conflicts in shared directory management.