Carlos Vivar Rios
commited on
Commit
·
2a1a32a
unverified
·
0
Parent(s):
Initial commit
Browse files- .env.dist +15 -0
- .gitignore +132 -0
- .gitmodules +3 -0
- Dockerfile +73 -0
- LICENSE +15 -0
- README.md +276 -0
- README.template.md +62 -0
- app/app.sh +46 -0
- app/config_templates/template.yml +3 -0
- odtp-component-client +1 -0
- odtp.yml +95 -0
- requirements.txt +1 -0
.env.dist
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#ODTP COMPONENT VARIABLES
|
2 |
+
VARIABLES=
|
3 |
+
# ODTP ENV VARIABLES TO CONNECT
|
4 |
+
ODTP_MONGO_SERVER=
|
5 |
+
ODTP_S3_SERVER=
|
6 |
+
ODTP_BUCKET_NAME=
|
7 |
+
ODTP_ACCESS_KEY=
|
8 |
+
ODTP_SECRET_KEY=
|
9 |
+
# ODTP ENV VARIABLES DB REFERENCES
|
10 |
+
ODTP_USER_ID=
|
11 |
+
ODTP_DIGITAL_TWIN=
|
12 |
+
ODTP_EXCUTION=
|
13 |
+
ODTP_STEP=
|
14 |
+
ODTP_COMPONENT=
|
15 |
+
ODTP_COMPONENT_VERSION=
|
.gitignore
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Mac crap
|
2 |
+
.DS_Store
|
3 |
+
|
4 |
+
# Byte-compiled / optimized / DLL files
|
5 |
+
__pycache__/
|
6 |
+
*.py[cod]
|
7 |
+
*$py.class
|
8 |
+
|
9 |
+
# C extensions
|
10 |
+
*.so
|
11 |
+
|
12 |
+
# Distribution / packaging
|
13 |
+
.Python
|
14 |
+
build/
|
15 |
+
develop-eggs/
|
16 |
+
dist/
|
17 |
+
downloads/
|
18 |
+
eggs/
|
19 |
+
.eggs/
|
20 |
+
lib/
|
21 |
+
lib64/
|
22 |
+
parts/
|
23 |
+
sdist/
|
24 |
+
var/
|
25 |
+
wheels/
|
26 |
+
pip-wheel-metadata/
|
27 |
+
share/python-wheels/
|
28 |
+
*.egg-info/
|
29 |
+
.installed.cfg
|
30 |
+
*.egg
|
31 |
+
MANIFEST
|
32 |
+
|
33 |
+
# PyInstaller
|
34 |
+
# Usually these files are written by a python script from a template
|
35 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
36 |
+
*.manifest
|
37 |
+
*.spec
|
38 |
+
|
39 |
+
# Installer logs
|
40 |
+
pip-log.txt
|
41 |
+
pip-delete-this-directory.txt
|
42 |
+
|
43 |
+
# Unit test / coverage reports
|
44 |
+
htmlcov/
|
45 |
+
.tox/
|
46 |
+
.nox/
|
47 |
+
.coverage
|
48 |
+
.coverage.*
|
49 |
+
.cache
|
50 |
+
nosetests.xml
|
51 |
+
coverage.xml
|
52 |
+
*.cover
|
53 |
+
*.py,cover
|
54 |
+
.hypothesis/
|
55 |
+
.pytest_cache/
|
56 |
+
|
57 |
+
# Translations
|
58 |
+
*.mo
|
59 |
+
*.pot
|
60 |
+
|
61 |
+
# Django stuff:
|
62 |
+
*.log
|
63 |
+
local_settings.py
|
64 |
+
db.sqlite3
|
65 |
+
db.sqlite3-journal
|
66 |
+
|
67 |
+
# Flask stuff:
|
68 |
+
instance/
|
69 |
+
.webassets-cache
|
70 |
+
|
71 |
+
# Scrapy stuff:
|
72 |
+
.scrapy
|
73 |
+
|
74 |
+
# Sphinx documentation
|
75 |
+
docs/_build/
|
76 |
+
|
77 |
+
# PyBuilder
|
78 |
+
target/
|
79 |
+
|
80 |
+
# Jupyter Notebook
|
81 |
+
.ipynb_checkpoints
|
82 |
+
|
83 |
+
# IPython
|
84 |
+
profile_default/
|
85 |
+
ipython_config.py
|
86 |
+
|
87 |
+
# pyenv
|
88 |
+
.python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
98 |
+
__pypackages__/
|
99 |
+
|
100 |
+
# Celery stuff
|
101 |
+
celerybeat-schedule
|
102 |
+
celerybeat.pid
|
103 |
+
|
104 |
+
# SageMath parsed files
|
105 |
+
*.sage.py
|
106 |
+
|
107 |
+
# Environments
|
108 |
+
.env
|
109 |
+
.venv
|
110 |
+
env/
|
111 |
+
venv/
|
112 |
+
ENV/
|
113 |
+
env.bak/
|
114 |
+
venv.bak/
|
115 |
+
|
116 |
+
# Spyder project settings
|
117 |
+
.spyderproject
|
118 |
+
.spyproject
|
119 |
+
|
120 |
+
# Rope project settings
|
121 |
+
.ropeproject
|
122 |
+
|
123 |
+
# mkdocs documentation
|
124 |
+
/site
|
125 |
+
|
126 |
+
# mypy
|
127 |
+
.mypy_cache/
|
128 |
+
.dmypy.json
|
129 |
+
dmypy.json
|
130 |
+
|
131 |
+
# Pyre type checker
|
132 |
+
.pyre/
|
.gitmodules
ADDED
@@ -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
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ubuntu:22.04
|
2 |
+
|
3 |
+
RUN apt update
|
4 |
+
RUN apt install python3.10 python3-pip -y
|
5 |
+
|
6 |
+
##################################################
|
7 |
+
# Ubuntu setup
|
8 |
+
##################################################
|
9 |
+
|
10 |
+
RUN apt-get update \
|
11 |
+
&& apt-get install -y wget \
|
12 |
+
&& rm -rf /var/lib/apt/lists/*
|
13 |
+
|
14 |
+
RUN apt-get update && apt-get -y upgrade \
|
15 |
+
&& apt-get install -y --no-install-recommends \
|
16 |
+
unzip \
|
17 |
+
nano \
|
18 |
+
git \
|
19 |
+
g++ \
|
20 |
+
gcc \
|
21 |
+
htop \
|
22 |
+
zip \
|
23 |
+
ca-certificates \
|
24 |
+
&& rm -rf /var/lib/apt/lists/*
|
25 |
+
|
26 |
+
##################################################
|
27 |
+
# ODTP setup
|
28 |
+
##################################################
|
29 |
+
|
30 |
+
COPY odtp-component-client/requirements.txt /tmp/odtp.requirements.txt
|
31 |
+
RUN pip install -r /tmp/odtp.requirements.txt
|
32 |
+
|
33 |
+
|
34 |
+
#######################################################################
|
35 |
+
# PLEASE INSTALL HERE ALL SYSTEM DEPENDENCIES RELATED TO YOUR TOOL
|
36 |
+
#######################################################################
|
37 |
+
|
38 |
+
# Installing dependecies from the app
|
39 |
+
COPY requirements.txt /tmp/requirements.txt
|
40 |
+
RUN pip install -r /tmp/requirements.txt
|
41 |
+
|
42 |
+
|
43 |
+
######################################################################
|
44 |
+
# ODTP COMPONENT CONFIGURATION.
|
45 |
+
# DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING.
|
46 |
+
######################################################################
|
47 |
+
|
48 |
+
##################################################
|
49 |
+
# ODTP Preparation
|
50 |
+
##################################################
|
51 |
+
|
52 |
+
RUN mkdir /odtp \
|
53 |
+
/odtp/odtp-config \
|
54 |
+
/odtp/odtp-app \
|
55 |
+
/odtp/odtp-component-client \
|
56 |
+
/odtp/odtp-logs \
|
57 |
+
/odtp/odtp-input \
|
58 |
+
/odtp/odtp-workdir \
|
59 |
+
/odtp/odtp-output
|
60 |
+
|
61 |
+
# This last 2 folders are specific from odtp-eqasim
|
62 |
+
RUN mkdir /odtp/odtp-workdir/cache \
|
63 |
+
/odtp/odtp-workdir/output
|
64 |
+
|
65 |
+
# This copy all the information for running the ODTP component
|
66 |
+
COPY odtp.yml /odtp/odtp-config/odtp.yml
|
67 |
+
|
68 |
+
COPY ./odtp-component-client /odtp/odtp-component-client
|
69 |
+
|
70 |
+
COPY ./app /odtp/odtp-app
|
71 |
+
WORKDIR /odtp
|
72 |
+
|
73 |
+
ENTRYPOINT ["bash", "/odtp/odtp-component-client/startup.sh"]
|
LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
BSD 3-Clause "New" or "Revised" License
|
2 |
+
Licence ID
|
3 |
+
BSD-3-Clause
|
4 |
+
Licence text
|
5 |
+
Copyright (c) 2023-2024 Swiss Data Science Center. All rights reserved.
|
6 |
+
|
7 |
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
8 |
+
|
9 |
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
10 |
+
|
11 |
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
12 |
+
|
13 |
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
14 |
+
|
15 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
README.md
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ODTP Component Template
|
2 |
+
|
3 |
+
This is a template that facilitates the development of new `odtp-components`. An `odtp` compatible component is a docker container able to perform a functional unit of computing in the digital twin. You can think of it as a blackbox that takes inputs files and/or parameters and perfom a task. Usually this lead to some files as a result (Ephemeral component), or to a visualization (Interactive component).
|
4 |
+
|
5 |
+
Internally a component will run a bash script `./app/app.sh` that must include the commands for running your tool, and managing the input/output logic. While input files are located in the folder `/odtp/odtp-input`, parameters values are represented by environment variables within the component. In this way you can access to them by using `$` before the name of your variable. Finally, the output files generated are requested to be placed in `/odtp/odtp-output/`.
|
6 |
+
|
7 |
+
## How to clone this repository?
|
8 |
+
|
9 |
+
> [!NOTE]
|
10 |
+
> This repository makes use of submodules. Therefore, when cloning it you need to include them.
|
11 |
+
>
|
12 |
+
> `git clone --recurse-submodules https://github.com/odtp-org/odtp-component-template`
|
13 |
+
|
14 |
+
|
15 |
+
## How to create an odtp compatible component using this template?
|
16 |
+
|
17 |
+
1. Identify which parameters would you like to expose.
|
18 |
+
2. Configure the Dockerfile to install all the OS requirements needed for your tool to run.
|
19 |
+
1. (Optional) If your tool requires python, and the dependencies offered in the repo are not compatible with the docker image you can configure custom dependencies in requirements.txt
|
20 |
+
3. Configure the `app/app.sh` file to:
|
21 |
+
1. Clone the repository of your tool and checkout to one specific commit.
|
22 |
+
2. (Optional) If your app uses a config file (i.e. `config.yml` or `config.json`), you need to provide a templace including placeholders for the variables you would like to expose. Placeholders can be defined by using double curly braces wrapping the name of the variable, such as `{{VARIABLE}}`. Then you can run `python3 /odtp/odtp-component-client/parameters.py PATH_TO_TEMPLATE PATH_TO_OUTPUT_CONFIG_FILE` and every placeholder will be replaced by the value in the environment variable.
|
23 |
+
3. Copy (`cp -r`) or create symbolic links (`ln -s`) to locate the input files in `/odpt/odtp-input/` in the folder.
|
24 |
+
4. Run the tool. You can access to the parameters as environemnt variables (i.e. `$PARAMETER_A`)
|
25 |
+
5. Manage the output exporting. At the end of the component execution all generated output should be located in `/odtp/odtp-output`. Copy all output files into this folder.
|
26 |
+
4. Describe all the metadata in `odtp.yml`. Please check below for instructions.
|
27 |
+
5. Publish your tool in the ODTP Zoo. (Temporaly unavailable)
|
28 |
+
|
29 |
+
### Semantic Validation
|
30 |
+
|
31 |
+
ODTP will be able to validate the input/output files. In order to do this we use SHACL validation. However, the developer should provide a schema of the input/output schema. This section is still under development and it will be available soon.
|
32 |
+
|
33 |
+
## Internal data structure of a component
|
34 |
+
|
35 |
+
It's important to remark that when the container is built an specific folder structure is generated:
|
36 |
+
|
37 |
+
- `/odtp`: The main folder.
|
38 |
+
- `/odtp/odtp-component-client`: This is the odtp client that will manage the execution, logging, and input/output functions of the component. It is include as a submodule, and the user doesn't need to modify it.
|
39 |
+
- `/odtp/odtp-app`: This folder have the content of `/app` folder in this template. It contains the tool execution bash script and the tool configuration files.
|
40 |
+
- `/odtp/odtp-workdir`: This is the working directory where the tool repository should be placed and all the middle files such as cache folders.
|
41 |
+
- `/odtp/odtp-input`: Input folder that is be mounted as volume for the docker container.
|
42 |
+
- `/odtp/odtp-output`: Output folder that is mounted as volume for the docker container.
|
43 |
+
- `/odtp/odtp-logs`: Folder reserved for internal loggings.
|
44 |
+
- `/odtp/odtp-config`: Folder reserved for odtp configuration.
|
45 |
+
|
46 |
+
## Testing the component
|
47 |
+
|
48 |
+
There are 3 main ways in which you can test a component and the different odtp features.
|
49 |
+
|
50 |
+
1. Testing it as a docker container
|
51 |
+
2. Testing it as a single component using `odtp`
|
52 |
+
3. Testing it in a `odtp` digital twin execution
|
53 |
+
|
54 |
+
When developing we recomend to start by testing the component via docker and then follow with the others.
|
55 |
+
|
56 |
+
### Testing the component as a docker container
|
57 |
+
|
58 |
+
The user will need to manually create the input/output folders and build the docker image.
|
59 |
+
|
60 |
+
1. Prepare the following folder structure:
|
61 |
+
|
62 |
+
```
|
63 |
+
- testing-folder
|
64 |
+
- data-input
|
65 |
+
- data-output
|
66 |
+
```
|
67 |
+
|
68 |
+
Place all required input files in `testing-folder/data-input`.
|
69 |
+
|
70 |
+
2. Create your `.env` file with the following parameters.
|
71 |
+
|
72 |
+
```
|
73 |
+
# ODTP COMPONENT VARIABLES
|
74 |
+
PARAMETER-A=.....
|
75 |
+
PARAMETER-B=.....
|
76 |
+
```
|
77 |
+
|
78 |
+
3. Build the dockerfile.
|
79 |
+
|
80 |
+
```
|
81 |
+
docker build -t odtp-component .
|
82 |
+
```
|
83 |
+
|
84 |
+
4. Run the following command.
|
85 |
+
|
86 |
+
```
|
87 |
+
docker run -it --rm \
|
88 |
+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \
|
89 |
+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-output \
|
90 |
+
--env-file .env \
|
91 |
+
odtp-component
|
92 |
+
```
|
93 |
+
|
94 |
+
This command will run the component. If you want debug some errors and execute the docker in an interactive manner, you can use the flag `--entrypoint bash` when running docker.
|
95 |
+
|
96 |
+
Also if your tool is interactive such as an Streamlit app, don't forget to map the ports by using `-p XXXX:XXXX`.
|
97 |
+
|
98 |
+
### Testing the component as part of odtp
|
99 |
+
|
100 |
+
To execute the command as part of `odtp` please refer to our `odtp` documentation:
|
101 |
+
|
102 |
+
https://odtp-org.github.io/odtp-manuals/
|
103 |
+
|
104 |
+
## `odtp.yml`
|
105 |
+
|
106 |
+
ODTP requires a set of metadata to work. These fields should be filled by the developers.
|
107 |
+
|
108 |
+
```yml
|
109 |
+
# This file should contain basic component information for your component.
|
110 |
+
component-name: Component Name
|
111 |
+
component-author: Component Author
|
112 |
+
component-version: Component Version
|
113 |
+
component-repository: Component Repository
|
114 |
+
component-license: Component License
|
115 |
+
component-type: ephemeral or interactive
|
116 |
+
component-description: Description
|
117 |
+
tags:
|
118 |
+
- tag1
|
119 |
+
- tag2
|
120 |
+
|
121 |
+
# Information about the tools
|
122 |
+
tools:
|
123 |
+
- tool-name: tool's name
|
124 |
+
tool-author: Tool's author
|
125 |
+
tool-version: Tool version
|
126 |
+
tool-repository: Tool's repository
|
127 |
+
tool-license: Tool's license
|
128 |
+
|
129 |
+
# If your tool require some secrets token to be passed as ENV to the component
|
130 |
+
# This won't be traced
|
131 |
+
secrets:
|
132 |
+
- name: Key of the argument
|
133 |
+
- description: Description of the secret
|
134 |
+
|
135 |
+
# If the tool requires some building arguments such as Matlab license
|
136 |
+
build-args:
|
137 |
+
- name: Key of the argument
|
138 |
+
- description: Descriptio of the building argument
|
139 |
+
- secret: Bool
|
140 |
+
|
141 |
+
# If applicable, ports exposed by the component
|
142 |
+
# Include Name, Description, and Port Value for each port
|
143 |
+
ports:
|
144 |
+
- name: PORT A
|
145 |
+
description: Description of Port A
|
146 |
+
port-value: XXXX
|
147 |
+
- name: PORT B
|
148 |
+
description: Description of Port B
|
149 |
+
port-value: YYYY
|
150 |
+
|
151 |
+
# If applicable, parameters exposed by the component
|
152 |
+
# Datatype can be str, int, float, or bool.
|
153 |
+
parameters:
|
154 |
+
- name: PARAMETER A
|
155 |
+
default-value: DEFAULT_VALUE_A
|
156 |
+
datatype: DATATYPE_A
|
157 |
+
description: Description of Parameter A
|
158 |
+
parameter-bounds: # Boundaries for int and float datatype
|
159 |
+
- 0 # Lower bound
|
160 |
+
- inf # Upper bound
|
161 |
+
options: null
|
162 |
+
allow-custom-value: false # If true the user can add a custom value out of parameter-bounds, or options
|
163 |
+
|
164 |
+
- name: PARAMETER B
|
165 |
+
default-value: DEFAULT_VALUE_B
|
166 |
+
datatype: DATATYPE_B
|
167 |
+
description: Description of Parameter B
|
168 |
+
parameter-bounds: null
|
169 |
+
options: # If your string parameter is limited to a few option, please list them here.
|
170 |
+
- OptionA
|
171 |
+
- OptionB
|
172 |
+
- OptionC
|
173 |
+
allow-custom-value: false # If true the user can add a custom value out of parameter-bounds, or options
|
174 |
+
|
175 |
+
# If applicable, data-input list required by the component
|
176 |
+
data-inputs:
|
177 |
+
- name: INPUT A
|
178 |
+
type: TYPE_A # Folder or filetype
|
179 |
+
path: VALUE_A
|
180 |
+
description: Description of Input A
|
181 |
+
- name: INPUT B
|
182 |
+
type: TYPE_B # Folder or filetype
|
183 |
+
path: VALUE_B
|
184 |
+
description: Description of Input B
|
185 |
+
|
186 |
+
# If applicable, data-output list produced by the component
|
187 |
+
data-output:
|
188 |
+
- name: OUTPUT A
|
189 |
+
type: TYPE_A # Folder or filetype
|
190 |
+
path: VALUE_A
|
191 |
+
description: Description of Output A
|
192 |
+
- name: OUTPUT B
|
193 |
+
type: TYPE_B # Folder or filetype
|
194 |
+
path: VALUE_B
|
195 |
+
description: Description of Output B
|
196 |
+
|
197 |
+
# If applicable, path to schemas to perform semantic validation.
|
198 |
+
# Still under development. Ignore.
|
199 |
+
schema-input: PATH_TO_INPUT_SCHEMA
|
200 |
+
schema-output: PATH_TO_OUTPUT_SCHEMA
|
201 |
+
|
202 |
+
# If applicable, define devices needed such as GPU.
|
203 |
+
devices:
|
204 |
+
gpu: Bool
|
205 |
+
```
|
206 |
+
|
207 |
+
## Changelog
|
208 |
+
|
209 |
+
- v0.4.0
|
210 |
+
- Update default Base and Python in Dockerfile to `ubuntu:22.04` and `python3.10`
|
211 |
+
|
212 |
+
- v0.3.4
|
213 |
+
- Inclusion of `secrets` and `build-args` in `odtp.yml`
|
214 |
+
- Tools as list
|
215 |
+
|
216 |
+
- v0.3.3
|
217 |
+
- Inclusion of boundaries conditions and options in `odtp.yml` parameters.
|
218 |
+
|
219 |
+
- v0.3.2
|
220 |
+
- Extended `odtp.yml` parameters and input/output definition.
|
221 |
+
- `odtp.requirements.txt` transfered to submodule `odtp-component-client`.
|
222 |
+
|
223 |
+
- v0.3.1
|
224 |
+
- Updating schema fields in `odtp.yml` to kebab-case.
|
225 |
+
|
226 |
+
- v0.3.0
|
227 |
+
- Turning `odtp-client` into a separate repository and adding it as a submodule in `odtp-component-client`
|
228 |
+
- Updating `app.sh` and tutorial.
|
229 |
+
- Updating `odtp.yml` file.
|
230 |
+
- Adding `.DS_Store` to `.gitignore`
|
231 |
+
|
232 |
+
- v0.2.0
|
233 |
+
- Compatible with ODTP v.0.2.0 only with platform / components
|
234 |
+
- Compatible with configuration text files
|
235 |
+
- Improved loging system
|
236 |
+
- Accepting Digital Twins, Executions, and steps, metadata.
|
237 |
+
- Including component versioning in `odtp.yml`
|
238 |
+
|
239 |
+
- v0.1.0
|
240 |
+
- Compatible with ODTP v.0.1.0 only with platform / components
|
241 |
+
- Compatible with configuration text files
|
242 |
+
|
243 |
+
## Acknowledgments, Copyright, and Licensing
|
244 |
+
|
245 |
+
### Acknowledgments and Funding
|
246 |
+
|
247 |
+
This work is part of the broader project **O**pen **D**igital **T**win **P**latform of the **S**wiss **M**obility **S**ystem (ODTP-SMS) funded by Swissuniversities CHORD grant Track B - Establish Projects. ODTP-SMS project is a joint endeavour by the Center for Sustainable Future Mobility - CSFM (ETH Zürich) and the Swiss Data Science Center - SDSC (EPFL and ETH Zürich).
|
248 |
+
The Swiss Data Science Center (SDSC) develops domain-agnostic standards and containerized components to manage digital twins. This includes the creation of the Core Platform (both back-end and front-end), Service Component Integration Templates, Component Ontology, and the Component Zoo template.
|
249 |
+
The Center for Sustainable Future Mobility (CSFM) develops mobility services and utilizes the components produced by SDSC to deploy a mobility digital twin platform. CSFM focuses on integrating mobility services and collecting available components in the mobility zoo, thereby applying the digital twin concept in the realm of mobility.
|
250 |
+
|
251 |
+
### Copyright
|
252 |
+
|
253 |
+
Copyright © 2023-2024 Swiss Data Science Center (SDSC), www.datascience.ch. All rights reserved.
|
254 |
+
The SDSC is jointly established and legally represented by the École Polytechnique Fédérale de Lausanne (EPFL) and the Eidgenössische Technische Hochschule Zürich (ETH Zürich). This copyright encompasses all materials, software, documentation, and other content created and developed by the SDSC.
|
255 |
+
|
256 |
+
### Intellectual Property (IP) Rights
|
257 |
+
|
258 |
+
The Open Digital Twin Platform (ODTP) is the result of a collaborative effort between ETH Zurich (ETHZ) and the École Polytechnique Fédérale de Lausanne (EPFL). Both institutions hold equal intellectual property rights for the ODTP project, reflecting the equitable and shared contributions of EPFL and ETH Zürich in the development and advancement of this initiative.
|
259 |
+
|
260 |
+
### Licensing
|
261 |
+
|
262 |
+
The Service Component Integration Templates within this repository are licensed under the BSD 3-Clause "New" or "Revised" License. This license allows for broad compatibility and standardization, encouraging open use and contribution. For the full license text, please see the LICENSE file accompanying these templates.
|
263 |
+
|
264 |
+
#### Distinct Licensing for Other Components
|
265 |
+
|
266 |
+
- **Core Platform**: Open-source under AGPLv3.
|
267 |
+
- **Ontology**: Creative Commons Attribution-ShareAlike (CC BY-SA).
|
268 |
+
- **Component Zoo Template**: BSD-3 license.
|
269 |
+
|
270 |
+
### Alternative Commercial Licensing
|
271 |
+
|
272 |
+
Alternative commercial licensing options for the core platform and other components are available and can be negotiated through the EPFL Technology Transfer Office (https://tto.epfl.ch) or ETH Zürich Technology Transfer Office (https://ethz.ch/en/industry/transfer.html).
|
273 |
+
|
274 |
+
## Ethical Use and Legal Compliance Disclaimer
|
275 |
+
|
276 |
+
Please note that this software should not be used to deliberately harm any individual or entity. Users and developers must adhere to ethical guidelines and use the software responsibly and legally. This disclaimer serves to remind all parties involved in the use or development of this software to engage in practices that are ethical, lawful, and in accordance with the intended purpose of the software.
|
README.template.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Name of the component
|
2 |
+
|
3 |
+
Description of the component
|
4 |
+
|
5 |
+
| Tool Info | Links |
|
6 |
+
| --- | --- |
|
7 |
+
| Original Tool | []() |
|
8 |
+
| Current Tool Version | [commit-hash](link-to-commit-hash) |
|
9 |
+
|
10 |
+
|
11 |
+
## ODTP command
|
12 |
+
|
13 |
+
```
|
14 |
+
odtp new odtp-component-entry \
|
15 |
+
--name odtp-component \
|
16 |
+
--component-version x.y.z \
|
17 |
+
--repository Link to repository
|
18 |
+
```
|
19 |
+
|
20 |
+
## Data sheet
|
21 |
+
|
22 |
+
### Parameters
|
23 |
+
|
24 |
+
| Parameter | Description | Default Value |
|
25 |
+
| --- | --- | --- |
|
26 |
+
| A | B | C |
|
27 |
+
|
28 |
+
### Input Files
|
29 |
+
|
30 |
+
| File/Folder | Description |
|
31 |
+
| --- | --- |
|
32 |
+
| A | B |
|
33 |
+
|
34 |
+
### Output Files
|
35 |
+
|
36 |
+
| File/Folder | Description |
|
37 |
+
| --- | --- |
|
38 |
+
| A | B |
|
39 |
+
|
40 |
+
## Tutorial
|
41 |
+
|
42 |
+
### How to run this component as docker
|
43 |
+
|
44 |
+
Build the dockerfile
|
45 |
+
|
46 |
+
```
|
47 |
+
docker build -t odtp-component .
|
48 |
+
```
|
49 |
+
|
50 |
+
Run the following command. Mount the correct volumes for input/output folders.
|
51 |
+
|
52 |
+
```
|
53 |
+
docker run -it --rm \
|
54 |
+
-v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \
|
55 |
+
-v {PATH_TO_YOUR_OUTPUT_VOLUME}:/odtp/odtp-output \
|
56 |
+
--env-file .env odtp-component
|
57 |
+
```
|
58 |
+
|
59 |
+
|
60 |
+
## Developed by
|
61 |
+
|
62 |
+
XXXXXXXXXX
|
app/app.sh
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
############################################################################################
|
4 |
+
# START OF MANUAL CONFIGURATION.
|
5 |
+
# ADAPT THE TEMPLATE HERE.
|
6 |
+
############################################################################################
|
7 |
+
|
8 |
+
#########################################################
|
9 |
+
# 1. GITHUB CLONING OF REPO
|
10 |
+
# Clone the repository of your tool and checkout to one specific commit.
|
11 |
+
#########################################################
|
12 |
+
|
13 |
+
# git clone https://github.com/odtp-org/tool-example.git /odtp/odtp-workdir/tool-example
|
14 |
+
# cd /odtp/odtp-workdir/tool-example
|
15 |
+
# git checkout xxxxxxxxxxxx
|
16 |
+
|
17 |
+
#########################################################
|
18 |
+
# 2. CONFIG FILE CONFIGURATION
|
19 |
+
# Read placeholders and create config file from Environment
|
20 |
+
#########################################################
|
21 |
+
|
22 |
+
# python3 /odtp/odtp-component-client/parameters.py /odtp/odtp-app/config_templates/template.yml /odtp/odtp-workdir/config.yml
|
23 |
+
|
24 |
+
#########################################################
|
25 |
+
# 3. INPUT FOLDER MANAGEMENT
|
26 |
+
#########################################################
|
27 |
+
|
28 |
+
# ln -s /odtp/odtp-input/... /odtp/odtp-workdir/...
|
29 |
+
|
30 |
+
#########################################################
|
31 |
+
# 4. TOOL EXECUTION
|
32 |
+
# While the output is managed by ODTP and placed in /odtp/odtp-output/
|
33 |
+
#########################################################
|
34 |
+
|
35 |
+
# COMMAND $PARAMETER_A #PARAMETER_B /odtp/odtp-input/data
|
36 |
+
|
37 |
+
#########################################################
|
38 |
+
# 5. OUTPUT FOLDER MANAGEMENT
|
39 |
+
# The selected output files generated should be placed in the output folder
|
40 |
+
#########################################################
|
41 |
+
|
42 |
+
# cp -r /odtp/odtp-workdir/output/* /odtp/odtp-output
|
43 |
+
|
44 |
+
############################################################################################
|
45 |
+
# END OF MANUAL USER APP
|
46 |
+
############################################################################################
|
app/config_templates/template.yml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Use the variable name between squared brackets to replace values in the template.
|
2 |
+
constant_string: /odtp/odtp-workdir/cache
|
3 |
+
value_to_replace: [variable_key]
|
odtp-component-client
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 0b75d5b31a84d62e0bfc6a46a7827b0457369eef
|
odtp.yml
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file should contain basic component information for your component.
|
2 |
+
component-name: Component Name
|
3 |
+
component-author: Component Author
|
4 |
+
component-version: Component Version
|
5 |
+
component-repository: Component Repository
|
6 |
+
component-license: Component License
|
7 |
+
component-type: ephemeral or interactive
|
8 |
+
component-description: Description
|
9 |
+
tags:
|
10 |
+
- tag1
|
11 |
+
- tag2
|
12 |
+
|
13 |
+
# Information about the tools
|
14 |
+
tools:
|
15 |
+
- tool-name: tool's name
|
16 |
+
tool-author: Tool's author
|
17 |
+
tool-version: Tool version
|
18 |
+
tool-repository: Tool's repository
|
19 |
+
tool-license: Tool's license
|
20 |
+
|
21 |
+
# If your tool require some secrets token to be passed as ENV to the component
|
22 |
+
# This won't be traced in MongoDB
|
23 |
+
secrets:
|
24 |
+
- name: Key of the argument
|
25 |
+
- description: Description of the secret
|
26 |
+
|
27 |
+
# If the tool requires some building arguments such as Matlab license
|
28 |
+
build-args:
|
29 |
+
- name: Key of the argument
|
30 |
+
- description: Descriptio of the building argument
|
31 |
+
- secret: Bool
|
32 |
+
|
33 |
+
# If applicable, ports exposed by the component
|
34 |
+
# Include Name, Description, and Port Value for each port
|
35 |
+
ports:
|
36 |
+
- name: PORT A
|
37 |
+
description: Description of Port A
|
38 |
+
port-value: XXXX
|
39 |
+
- name: PORT B
|
40 |
+
description: Description of Port B
|
41 |
+
port-value: YYYY
|
42 |
+
|
43 |
+
# If applicable, parameters exposed by the component
|
44 |
+
# Datatype can be str, int, float, or bool.
|
45 |
+
parameters:
|
46 |
+
- name: PARAMETER A
|
47 |
+
default-value: DEFAULT_VALUE_A
|
48 |
+
datatype: DATATYPE_A
|
49 |
+
description: Description of Parameter A
|
50 |
+
parameter-bounds: # Boundaries for int and float datatype
|
51 |
+
- 0 # Lower bound
|
52 |
+
- inf # Upper bound
|
53 |
+
options: null
|
54 |
+
allow-custom-value: false # If true the user can add a custom value out of parameter-bounds, or options
|
55 |
+
- name: PARAMETER B
|
56 |
+
default-value: DEFAULT_VALUE_B
|
57 |
+
datatype: DATATYPE_B
|
58 |
+
description: Description of Parameter B
|
59 |
+
parameter-bounds: null
|
60 |
+
options: # If your string parameter is limited to a few option, please list them here.
|
61 |
+
- OptionA
|
62 |
+
- OptionB
|
63 |
+
- OptionC
|
64 |
+
allow-custom-value: false # If true the user can add a custom value out of parameter-bounds, or options
|
65 |
+
|
66 |
+
# If applicable, data-input list required by the component
|
67 |
+
data-inputs:
|
68 |
+
- name: INPUT A
|
69 |
+
type: TYPE_A # Folder or filetype
|
70 |
+
path: VALUE_A
|
71 |
+
description: Description of Input A
|
72 |
+
- name: INPUT B
|
73 |
+
type: TYPE_B # Folder or filetype
|
74 |
+
path: VALUE_B
|
75 |
+
description: Description of Input B
|
76 |
+
|
77 |
+
# If applicable, data-output list produced by the component
|
78 |
+
data-output:
|
79 |
+
- name: OUTPUT A
|
80 |
+
type: TYPE_A # Folder or filetype
|
81 |
+
path: VALUE_A
|
82 |
+
description: Description of Output A
|
83 |
+
- name: OUTPUT B
|
84 |
+
type: TYPE_B # Folder or filetype
|
85 |
+
path: VALUE_B
|
86 |
+
description: Description of Output B
|
87 |
+
|
88 |
+
# If applicable, path to schemas to perform semantic validation.
|
89 |
+
# Still under development. Ignore.
|
90 |
+
schema-input: PATH_TO_INPUT_SCHEMA
|
91 |
+
schema-output: PATH_TO_OUTPUT_SCHEMA
|
92 |
+
|
93 |
+
# If applicable, define devices needed such as GPU.
|
94 |
+
devices:
|
95 |
+
gpu: Bool
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
# Please list here all python dependencies of your tool
|