Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow test branch #4

Merged
merged 12 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ jobs:
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme myst-parser
pip install sphinx sphinx_rtd_theme myst-parser sphinx-argparse==0.5.2
- name: Sphinx build
run: |
sphinx-apidoc -e -M -d 8 -o docs/docsource/api discover
sphinx-apidoc -e -M -d 8 -o docs/docsource/api discover-utils/discover_utils discover-utils/discover_utils/scripts/extract.py discover-utils/discover_utils/scripts/train.py discover-utils/discover_utils/scripts/predict.py
sphinx-build discover-utils/docs/docsource _build
sphinx-build docs/docsource _build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: ${{ github.event_name == 'push' }} # && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
39 changes: 24 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,34 @@ Use Cases

DISCOVER provides a set of blueprints for exploratory data analysis, serving as a starting point for researchers to engage in detailed behavioral analysis.

### Prerequesites
### Prerequesites

Before starting to install NOVA-Server you need to install Python and FFMPEG. While other Python versions may work as well the module is only tested for the following versions:
Before starting to install DISCOVER you need to install Python and FFMPEG.
While other Python versions may work as well the module is only tested for the following versions:

3.9.x
You can download the current version of python for your system here.
* 3.9.x
* 3.10.x
* 3.11.x

Download the current version off FFMPEG binaries from here for your system and make sure to extract them to a place that is in your system path. It is recommended to setup a separate virtual environment to isolate the NOVA server installation from your system python installation. To do so, open a terminal at the directory where your virtual environment should be installed and paste the following command:
You can download the current version of python for your system [here](https://www.python.org/downloads/).

python -m venv nova-server-venv
Download the current version off FFMPEG binaries from [here](https://github.com/BtbN/FFmpeg-Builds/releases) for your system and make sure to extract them to a place that is in your system path.
It is recommended to setup a separate virtual environment to isolate the NOVA server installation from your system python installation.
To do so, open a terminal at the directory where your virtual environment should be installed and paste the following command:

```python -m venv discover-venv```

You can then activate the virtual environment like this:

.\nova-server-venv\Scripts\activate
```.\discover-venv\Scripts\activate```

Setup
### Setup

Install NOVA-Server using pip like this:
Install DISCOVER using pip like this:

pip install hcai-nova-server
```pip install hcai-discover```

Start the server
### Start the server

To start DISCOVER you just open a Terminal and type

Expand Down Expand Up @@ -74,11 +80,13 @@ Internally DISCOVER converts the input to environment variables with the followi

```DISCOVER_SERVER_HOST```, ```DISCOVER_PORT```, ```DISCOVER_CML_DIR```, ```DISCOVER_CML_DIR```, ```DISCOVER_CML_DIR```, ```DISCOVER_CML_DIR```, ```DISCOVER_CML_DIR```

All variables can be either passed directly as commandline argument, set in a dotenv file or as system wide environment variables. During runtime the arguments will be prioritized in this order commandline arguments -> dotenv file -> environment variable -> default value.

If the server started successfully your console output should look like this:
All variables can be either passed directly as commandline argument, set in a [dotenv](https://hexdocs.pm/dotenvy/dotenv-file-format.html) file or as system wide environment variables.
During runtime the arguments will be prioritized in this order commandline arguments -> dotenv file -> environment variable -> default value.

Starting DISCOVER ...
If the server started successfully your console output should look like this:
```
Starting DISCOVER v1.0.0...
HOST: 0.0.0.0
PORT: 8080
DISCOVER_CML_DIR : cml
Expand All @@ -87,8 +95,9 @@ DISCOVER_CACHE_DIR : cache
DISCOVER_TMP_DIR : tmp
DISCOVER_LOG_DIR : log
...done
```

You can find the full documentation of the project [here](https://hcmlab.github.io/discover/docbuild/).
You can find the full documentation of the project [here](https://hcmlab.github.io/discover).

## Citation
If you use DISCOVER consider citing the following paper:
Expand Down
1 change: 1 addition & 0 deletions discover/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def resolve_arg(arg_val, env_var, arg_default_val, create_directory=False):
os.environ[env.VENV_LOG_VERBOSE] = resolve_arg(
"True", env.VENV_LOG_VERBOSE, "True"
)

print("...done")
tempfile.tempdir = os.environ[env.DISCOVER_TMP_DIR]
host = os.environ[env.DISCOVER_HOST]
Expand Down
4 changes: 2 additions & 2 deletions discover/backend/virtual_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class VenvHandler:
Example:
>>> import logging
>>> load_dotenv("../.env")
>>> log_dir = Path(os.getenv('NOVA_LOG_DIR', '.'))
>>> log_dir = Path(os.getenv('DISCOVER_LOG_DIR', '.'))
>>> log_file = log_dir / 'test.log'
>>> logging.basicConfig(filename=log_file, encoding='utf-8', level=logging.DEBUG)
>>> logger = logging.getLogger('test_logger')
>>> module_path = Path(os.getenv("NOVA_CML_DIR")) / "test"
>>> module_path = Path(os.getenv("DISCOVER_CML_DIR")) / "test"
>>> venv_handler = VenvHandler(module_path, logger=logger, log_verbose=True)
>>> venv_handler.run_python_script_from_file(
... module_path / "test.py",
Expand Down
10 changes: 5 additions & 5 deletions discover/exec/execution_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _nova_server_env_to_arg(self):
env.DISCOVER_DATA_DIR,
env.DISCOVER_LOG_DIR,
env.DISCOVER_CACHE_DIR,
env.NOVA_SERVER_TMP_DIR,
env.DISCOVER_TMP_DIR,
env.DISCOVER_VIDEO_BACKEND,
]

Expand Down Expand Up @@ -99,7 +99,7 @@ def run(self):
# Add dotenv variables to arguments for script
self._script_arguments |= self._nova_server_env_to_arg()
self._script_arguments.setdefault(
"--shared_dir", os.getenv(env.NOVA_SERVER_TMP_DIR)
"--shared_dir", os.getenv(env.DISCOVER_TMP_DIR)
)

args = []
Expand All @@ -115,12 +115,12 @@ def run(self):
# Setup virtual environment
cml_dir = os.getenv(env.DISCOVER_CML_DIR)
if cml_dir is None:
raise ValueError(f"NOVA_CML_DIR not set")
raise ValueError(f"DISCOVER_CML_DIR not set")

module_dir = Path(cml_dir) / self.module_name
if not module_dir.is_dir():
raise NotADirectoryError(
f"NOVA_CML_DIR {module_dir} is not a valid directory"
f"DISCOVER_CML_DIR {module_dir} is not a valid directory"
)

extra_index_urls = os.getenv(env.VENV_EXTRA_INDEX_URLS, None)
Expand All @@ -140,7 +140,7 @@ def run(self):
# Add dotenv variables to arguments for script
self._script_arguments |= self._nova_server_env_to_arg()
self._script_arguments.setdefault(
"--shared_dir", os.getenv(env.NOVA_SERVER_TMP_DIR)
"--shared_dir", os.getenv(env.DISCOVER_TMP_DIR)
)

self.backend_handler.run_shell_script(
Expand Down
2 changes: 1 addition & 1 deletion discover/route/fetch_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def fetch_thread():
if isinstance(delete_after_download, str):
delete_after_download = string_to_bool(delete_after_download)

shared_dir = os.getenv(env.NOVA_SERVER_TMP_DIR)
shared_dir = os.getenv(env.DISCOVER_TMP_DIR)
job_dir = Path(shared_dir) / job_id

if not job_dir.exists():
Expand Down
4 changes: 0 additions & 4 deletions docs/docbuild/.buildinfo

This file was deleted.

Binary file removed docs/docbuild/.doctrees/api/modules.doctree
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/api/nova_server.app.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/api/nova_server.data.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/api/nova_server.doctree
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/api/nova_server.exec.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/index.doctree
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/modules/README.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed docs/docbuild/.doctrees/tutorials/examples.doctree
Binary file not shown.
Binary file not shown.
Empty file removed docs/docbuild/.gitkeep
Empty file.
129 changes: 0 additions & 129 deletions docs/docbuild/_modules/index.html

This file was deleted.

Loading
Loading