-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.jinja
98 lines (78 loc) · 3.75 KB
/
README.md.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# {{algorithm_name}}
{{algorithm_description}}
This algorithm is designed to be run with the [vantage6](https://vantage6.ai)
infrastructure for distributed analysis and learning.
The base code for this algorithm has been created via the
[v6-algorithm-template](https://github.com/vantage6/v6-algorithm-template)
template generator.
### Checklist
Note that the template generator does not create a completely ready-to-use
algorithm yet. There are still a number of things you have to do yourself.
Please ensure to execute the following steps. The steps are also indicated with
TODO statements in the generated code - so you can also simply search the
code for TODO instead of following the checklist below.
- [ ] Include a URL to your code repository in setup.py.
- [ ] Implement your algorithm functions.
- [ ] You are free to add more arguments to the functions. Be sure to add them
*after* the `client` and dataframe arguments.
- [ ] When adding new arguments, if you run the `test/test.py` script, be sure
to include values for these arguments in the `client.task.create()` calls
that are available there.
- [ ] If you are using Python packages that are not in the standard library, add
them to the `requirements.txt` and `setup.py` file.
{% if has_docs %}
- [ ] Fill in the documentation template. This will help others to understand your
algorithm, be able to use it safely, and to contribute to it.
{% else %}
- [ ] We strongly recommend adding documentation to your code. This will help
others to understand your code and will help you to understand your own code
in the future.
{% endif %}
- [ ] If you want to submit your algorithm to a vantage6 algorithm store, be sure
to fill in everything in ``algorithm_store.json`` (and be sure to update
it if you change function names, arguments, etc.).
{% if has_gh_pipeline %}
- [ ] Create a ``DOCKER_USER`` and ``DOCKER_PASSWORD`` secret in the GitHub repository
settings. This will be used to push the Docker image to the registry in the github
pipeline.
{% endif %}
{% if use_vpn %}
- [ ] Review the EXPOSE and LABEL commands in the Dockerfile for VPN
{% endif %}
- [ ] Finally, remove this checklist section to keep the README clean.
### Dockerizing your algorithm
To finally run your algorithm on the vantage6 infrastructure, you need to
create a Docker image of your algorithm.
{% if has_gh_pipeline %}
#### Automatically
The easiest way to create a Docker image is to use the GitHub Actions pipeline to
automatically build and push the Docker image. All that you need to do is push a
commit to the ``main`` branch.
#### Manually
{% endif %}
A Docker image can be created by executing the following command in the root of your
algorithm directory:
```bash
docker build -t [my_docker_image_name] .
```
where you should provide a sensible value for the Docker image name. The
`docker build` command will create a Docker image that contains your algorithm.
You can create an additional tag for it by running
```bash
docker tag [my_docker_image_name] [another_image_name]
```
This way, you can e.g. do
`docker tag local_average_algorithm harbor2.vantage6.ai/algorithms/average` to
make the algorithm available on a remote Docker registry (in this case
`harbor2.vantage6.ai`).
Finally, you need to push the image to the Docker registry. This can be done
by running
```bash
docker push [my_docker_image_name]
```
Note that you need to be logged in to the Docker registry before you can push
the image. You can do this by running `docker login` and providing your
credentials. Check [this page](https://docs.docker.com/get-started/04_sharing_app/)
For more details on sharing images on Docker Hub. If you are using a different
Docker registry, check the documentation of that registry and be sure that you
have sufficient permissions.