.. _oet_environments: *********************** OET Environments *********************** The OET runs Python observing scripts in a child process, and can pull these scripts from its filesystem or Git. When executing an ``SBDefinition``, the ``Activity`` references a script with either a ``git://`` or ``filesystem://`` prefix. The filesystem mode is expected to be used in full operations when the scripts are mature and Git interactions are minimised. In this mode the observing script will be executed in the same Python that the OET application is running in, in particular using the same version of ``ska-oso-scripting`` that the OET depends on. This is known as the **default environment**. The rest of this page concerns the Git mode, which allows both observing script and a version of the ``ska-oso-scripting`` library to be pulled from Git. The point of this is to allow AIV and commissioning teams to make changes to scripts and re-execute them without having to release and redeploy. An SBDefinition can reference a branch or specific commit of a scripting repository to use. In ``ska-oso-scripting``, there is a distinction between the scripts and the library that the scripts use, however in the SBDefinition they are both referenced by the same branch/commit. When creating the child process, the OET offers a ``create_env`` boolean flag. If this is ``False``, the script will still be pulled from Git, but it will be executed with the OET default environment. If the ``create_env`` flag is ``True``, then the OET will also pull the ska-oso-scripting version from Git and install its dependencies in a new Python virtual environment which the script is then executed in. Preparing this environment takes some amount of time under the ``PREP_ENV`` stage of OET execution. The OET caches environments based on the commit hash, so each execution on a branch with a new commit will create a new environment. To minimise this time, follow these guidelines #. If you are only making changes to the observing script and not the library, and are happy to use the version of ska-oso-scripting that is installed in the OET, set ``create_env=True``. Each further commit to the script will be picked up on a new execution, but a new Python environment doesn't need to be prepared #. If you are making changing within the ska-oso-scripting library, want to pin to an older version of the library or want to use a different library, set ``create_env=True``. Each further commit to the script or library will cause a new OET environment to be created on execution.