Skip to content

Commit 5a6ab12

Browse files
authored
Merge pull request #17 from odtp-org/adding-submodule
v0.3.0
2 parents 4037c22 + fdebfca commit 5a6ab12

11 files changed

Lines changed: 63 additions & 740 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "odtp-component-client"]
2+
path = odtp-component-client
3+
url = https://github.com/odtp-org/odtp-component-client

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RUN pip install -r /tmp/requirements.txt
7979
RUN mkdir /odtp \
8080
/odtp/odtp-config \
8181
/odtp/odtp-app \
82-
/odtp/odtp-client \
82+
/odtp/odtp-component-client \
8383
/odtp/odtp-logs \
8484
/odtp/odtp-input \
8585
/odtp/odtp-workdir \
@@ -92,9 +92,9 @@ RUN mkdir /odtp/odtp-workdir/cache \
9292
# This copy all the information for running the ODTP component
9393
COPY odtp.yml /odtp/odtp-config/odtp.yml
9494

95-
COPY ./odtp-client /odtp/odtp-client
95+
COPY ./odtp-component-client /odtp/odtp-component-client
9696

9797
COPY ./app /odtp/odtp-app
9898
WORKDIR /odtp
9999

100-
ENTRYPOINT ["bash", "/odtp/odtp-client/startup.sh"]
100+
ENTRYPOINT ["bash", "/odtp/odtp-component-client/startup.sh"]

README.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,13 @@ ODTP component for running Eqasim.
1414

1515
## How to run this component in docker.
1616

17-
1. Prepare manually a folder called volume containing the following datafolder of our selected scenario:
17+
1. Prepare manually a folder called `odtp-input` containing the following datafolder of our selected scenario:
1818

1919
- data
2020

21-
2. Create your `.env` file with this structure. **If you do not have MONGODB and/or S3 activated omit this step, and just provide the scenario as environmental variable.**
21+
2. Create your `.env` file with this structure.
2222

23-
Add the selected scenario `IDF`, or `CH`. Also select the eqasim pipeline you want to run `Synthesis`, or `matsim`.
24-
25-
```
26-
SCENARIO=IDF
27-
PIPELINE=Synthesis
28-
MONGODB_CLIENT=mongodb://.....
29-
S3_SERVER=https://....
30-
S3_ACCESS_KEY=Q0ISQ....
31-
S3_SECRET_KEY=OoPthI....
32-
S3_BUCKET_NAME=13301....
33-
```
34-
35-
3. Build the dockerfile
36-
37-
```
38-
docker build -t odtp-eqasim .
39-
```
40-
41-
3. Depending on your scenario add the parameters requested:
23+
Add the selected scenario `IDF`, or `CH`. Also select the eqasim pipeline you want to run `Synthesis`, or `Matsim`.
4224

4325
For Corsica:
4426
```
@@ -78,19 +60,40 @@ hafas_date=01.10.2018
7860
output_id=test
7961
```
8062

81-
4. Run the following command. Select the correct volume folder, the `SCENARIO` you want to simulate (`"IDF"`, `CORSICA`, or `"CH"`) and the MONGODB_CLIENT URL.
63+
3. Build the dockerfile
64+
65+
```
66+
docker build -t odtp-eqasim .
67+
```
68+
69+
4. Run the following command. Mount the correct volumes for input/output folders.
8270

8371
```
84-
docker run -it --rm -v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input -v {PATH_TO_YOUR_OUTPUT_VOLUME}:/odtp/odtp-output --env-file .env odtp-eqasim
72+
docker run -it --rm \
73+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \
74+
-v {PATH_TO_YOUR_OUTPUT_VOLUME}:/odtp/odtp-output \
75+
--env-file .env odtp-eqasim
8576
```
8677

78+
79+
8780
## Example of tmux session
8881

89-
In this example you will run the isolated container with the CH scenario.
82+
In this example you will run the isolated container with the CORSICA scenario.
9083

9184
```
9285
tmux new -s odtp-test
93-
docker run -it --rm -v /home/vivar/odtp-tutorial/volume-ch:/odtp/odtp-volume -e SCENARIO=CH --name odtp-test odtp-eqasim
86+
docker run -it --rm \
87+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \
88+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-output \
89+
-e SCENARIO=CORSICA \
90+
-e PIPELINE=Synthesis \
91+
-e processes=4 \
92+
-e hts=entd \
93+
-e sampling_rate=0.001 \
94+
-e random_seed=1234 \
95+
-e java_memory=8GB \
96+
--name odtp-eqasim odtp-eqasim
9497
```
9598

9699
Now you can push Control + B, and then D to dettach from the tmux session. In order to come back to the session you can do:
@@ -100,25 +103,26 @@ tmux attach-session -t odtp-test
100103
```
101104
If you want to kill the session just write `exit`. Also use `tmux ls` to list all available tmux sessions.
102105

106+
## Usage with ODTP
107+
108+
To connect this docker with an existing implementation of ODTP the following variables should be added to the env file.
103109

104-
## Description of files
110+
```
111+
ODTP_MONGO_SERVER="mongodb://USER:PASSWORD@.....
112+
ODTP_S3_SERVER=http://....
113+
ODTP_BUCKET_NAME=...
114+
ODTP_ACCESS_KEY=....
115+
ODTP_SECRET_KEY=...
116+
```
105117

106-
- app/startup.ch
107-
- This file is the entrypoint. Check the scenario and keep log of all stout.
108-
- app/idf.ch
109-
- Pull IDF repo. Launch the pipeline. Activate logger and s3 uploaders. Compress output and workdir.
110-
- app/ch.ch
111-
- Pull CH repo. Launch the pipeline. Activate logger and s3 uploaders. Compress output and workdir.
112-
- logger.py
113-
- Check log.txt and uploads stout to MongoDB
114-
- s3uploader.py
115-
- Upload output.zip & workdir.zip to S3. Create a mongodb entry.
116-
- parameters.py
117-
- Takes care of replacing the placeholder on the config templates.
118118

119119
## Changelog
120120

121-
- v0.2.0: Version compatible with IDF, CH & Corsica
121+
- v0.3.0 Corsica compatibility
122+
- Updating odtp-component-client to submodule
123+
- Output now delivers `eqasim-output` and `cache`.
124+
125+
- v0.2.0: Version compatible with IDF & CH.
122126

123127
- v0.1.0: Version compatible with IDF & CH
124128
- Parameters. Now the parameters are taken from the enviroment variables.

app/app.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ if [ "$SCENARIO" == "IDF" ]; then
1111
# Reading placeholders and create config file from environment variables
1212
if [ "$PIPELINE" == "Synthesis" ]; then
1313
echo "Running Synthesis PIPELINE"
14-
python3 /odtp/odtp-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_idf.yml /odtp/odtp-workdir/scenario/config.yml
14+
python3 /odtp/odtp-component-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_idf.yml /odtp/odtp-workdir/scenario/config.yml
1515

1616
# Preparing input data folder
17-
ln -s /odtp/odtp-input/data /odtp/odtp-workdir/data
17+
ln -s /odtp/odtp-component-client/data /odtp/odtp-workdir/data
1818

1919
else
2020
echo "Running Matsim PIPELINE"
@@ -41,14 +41,14 @@ elif [ "$SCENARIO" == "CORSICA" ]; then
4141
# Reading placeholders and create config file from environment variables
4242
if [ "$PIPELINE" == "Synthesis" ]; then
4343
echo "Running Synthesis PIPELINE"
44-
python3 /odtp/odtp-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_corsica.yml /odtp/odtp-workdir/scenario/config.yml
44+
python3 /odtp/odtp-component-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_corsica.yml /odtp/odtp-workdir/scenario/config.yml
4545

4646
# Preparing input data folder
4747
ln -s /odtp/odtp-input/data /odtp/odtp-workdir/data
4848

4949
else
5050
echo "Running Matsim PIPELINE"
51-
python3 /odtp/odtp-client/parameters.py /odtp/odtp-app/config_templates/config_matsim_corsica.yml /odtp/odtp-workdir/scenario/config.yml
51+
python3 /odtp/odtp-component-client/parameters.py /odtp/odtp-app/config_templates/config_matsim_corsica.yml /odtp/odtp-workdir/scenario/config.yml
5252

5353
# Preparing input data folder
5454
ln -s /odtp/odtp-input/data /odtp/odtp-workdir/data
@@ -73,10 +73,10 @@ else
7373
# Reading placeholders and create config file from environment variables
7474
if [ "$PIPELINE" == "Synthesis" ]; then
7575
echo "Running Synthesis PIPELINE"
76-
python3 /odtp/odtp-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_ch.yml /odtp/odtp-workdir/scenario/config.yml
76+
python3 /odtp/odtp-component-client/parameters.py /odtp/odtp-app/config_templates/config_synthesis_ch.yml /odtp/odtp-workdir/scenario/config.yml
7777

7878
# Preparing input data folder
79-
ln -s /odtp/odtp-input/data /odtp/odtp-workdir/data
79+
ln -s /odtp/odtp-component-client/data /odtp/odtp-workdir/data
8080

8181
else
8282
echo "Running Matsim PIPELINE"
@@ -93,6 +93,13 @@ fi
9393
# Running Eqasim pipeline
9494
python3 -m synpp
9595

96+
if [ "$PIPELINE" == "Matsim" ]; then
97+
# For some reason it fails the first time the command is executed with a maven related
98+
# Could not transfer artifact org.geotools:gt-opengis:jar:24.2 from/to osgeo
99+
sleep 10
100+
python3 -m synpp
101+
fi
102+
96103
# Copying output in odtp-output
97104
mkdir /odtp/odtp-output/eqasim-output
98105
cp -r /odtp/odtp-workdir/output/* /odtp/odtp-output/eqasim-output

odtp-client/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)