Skip to content

Commit

Permalink
fix docs and add docker install
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerle committed Sep 21, 2023
1 parent 4508c2b commit f9d62a7
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 26 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ RUN chown -R admin /src /home/admin
USER admin
RUN pip install -e .
ENV PYTHONUNBUFFERED=1
EXPOSE 9099
ENTRYPOINT ["assume"]
2 changes: 1 addition & 1 deletion assume/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class World:
def __init__(
self,
ifac_addr: str = "localhost",
ifac_addr: str = "0.0.0.0",
port: int = 9099,
database_uri: str = "",
export_csv_path: str = "",
Expand Down
7 changes: 1 addition & 6 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ services:
image: ghcr.io/assume-framework/assume:latest
profiles: ["cli-only"]
build: .
environment:
DATABASE_URI: 'postgresql://assume:assume@assume_db/assume'
EXPORT_CSV_PATH: ''
ports:
- 5000:5000
depends_on:
- assume_db
command: -s example_02 -c base -db "sqlite:///"
command: -s example_02 -db "postgresql://assume:assume@assume_db:5432/assume"
81 changes: 65 additions & 16 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,88 @@
Installation
################

Getting Python
You can install ASSUME using pip or docker. Choose the appropriate
installation method based on your needs.

Using Learning Capabilities
---------------------------

If you intend to use the reinforcement learning capabilities of
ASSUME and train your agents, make sure to install Torch. Detailed
installation instructions can be found `here <https://pytorch.org/get-started/locally/>`_.

Using Pip/Python
==============

In general most people use an environment manager for python.
Here, Install instructions for Conda and Venv are given.

If it is your first time with Python, we recommend `conda
<https://docs.conda.io/en/latest/miniconda.html>`_ as easy-to-use package managers. It is
available for Windows, Mac OS X and GNU/Linux.

Installation
============
With Conda
----------

After installing conda, you can create an environment for assume like::

conda create -n assume python=3.11

accept the installed packages and activate the newly created environment::

conda activate assume

Now you can proceed with the assume installation using pip below.

With Venv
-----------------

Venvs are the python native way of handling environments using the same python version.
To activate a venv, you have to be in the same folder where you created it.

Using venvs, we can create a new environment::

python -m venv venv

You can install ASSUME using pip. Choose the appropriate
installation method based on your needs:
And activate it::

Using pip
---------
source venv/bin/activate

Now you can proceed with the assume installation using pip below.


Install using pip
-----------------

To install the core package::

pip install assume-framework

To install with learning capabilities::

pip install assume-framework[learning]

To install with optimization capabilities::

pip install assume-framework[optimize]

To install with testing capabilities::

pip install assume-framework[test]

Install using Docker
=========================================

After installing `Docker Engine <https://docs.docker.com/engine/install/>`_ you can run::
docker compose up -d assume_db grafana
docker compose run simulation -s example_01a -db "postgresql://assume:assume@assume_db:5432/assume"

Now you can see the simulation results directly on grafana at `http://localhost:3000`

Timescale Database and Grafana Dashboards
-----------------------------------------
=========================================

ASSUME supports writing into Databases supported by `SQLAlchemy <https://docs.sqlalchemy.org/en/latest/dialects/index.html>`_ and CSV files.

If you want to benefit from a supported database and integrated
Grafana dashboards for scenario analysis, you can use the provided
Expand All @@ -42,15 +98,8 @@ Follow these steps:

2. Start the database and Grafana using the following command::

docker-compose up -d
docker compose up -d

This will launch a container for TimescaleDB and Grafana with
preconfigured dashboards for analysis. You can access the Grafana
dashboards at `http://localhost:3000`.

Using Learning Capabilities
---------------------------

If you intend to use the reinforcement learning capabilities of
ASSUME and train your agents, make sure to install Torch. Detailed
installation instructions can be found `here <https://pytorch.org/get-started/locally/>`_.
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ python-dateutil = "^2.8.2"
sqlalchemy = "^2.0.9"
pandas = {version = "^2.0.0"}
psycopg2-binary = "^2.9.5"
pyomo = "^6.6.1"
pyyaml = "^6.0"
nest-asyncio = "^1.5.6"
black = {version = "^23.3.0", optional = true}
Expand All @@ -44,7 +45,7 @@ pytest = {version = "^7.2.2", optional = true}
pytest-cov = {version = "^4.1.0", optional = true}
pytest-asyncio = {version = "^0.21.1", optional = true}
torch = {version = "^2.0.1", optional = true}
pyomo = {version = "^6.6.1", optional = true}

glpk = {version = "^0.4.7", optional = true}

[tool.poetry.group.dev.dependencies]
Expand All @@ -58,8 +59,8 @@ pytest-asyncio = "^0.21.1"

[tool.poetry.extras]
learning = ["torch"]
optimize = ["pyomo", "glpk"]
test = ["black", "isort", "matplotlib", "pytest", "pytest-cov", "pytest-asyncio", "pyomo", "glpk"]
optimize = ["glpk"]
test = ["black", "isort", "matplotlib", "pytest", "pytest-cov", "pytest-asyncio", "glpk"]


[tool.poetry.scripts]
Expand Down

0 comments on commit f9d62a7

Please sign in to comment.