Skip to content

Commit 5b56665

Browse files
committed
Add docker compose and use logger in template
1 parent f405792 commit 5b56665

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
template:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
volumes:
7+
- ./src:/src
8+
- ./in:/in
9+
- ./out:/out
10+
environment:
11+
- TOOL_RUN=foobar
12+
command: python run.py

src/run.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22
from datetime import datetime as dt
3-
from pprint import pprint
43

54
from json2args import get_parameter
65
from json2args.data import get_data
6+
from json2args.logger import logger
77

88
# parse parameters
99
kwargs = get_parameter()
@@ -15,16 +15,16 @@
1515
# switch the tool
1616
if toolname == 'foobar':
1717
# RUN the tool here and create the output in /out
18-
print('This toolbox does not include any tool. Did you run the template?\n')
18+
logger.info('This toolbox does not include any tool. Did you run the template?\n')
1919

2020
# write parameters to STDOUT.log
21-
pprint(kwargs)
21+
logger.info(kwargs)
2222

2323
for name, ds in data.items():
24-
print(f"\n### {name}")
25-
print(ds)
24+
logger.info(f"\n### {name}")
25+
logger.info(ds)
2626

2727

2828
# In any other case, it was not clear which tool to run
2929
else:
30-
raise AttributeError(f"[{dt.now().isocalendar()}] Either no TOOL_RUN environment variable available, or '{toolname}' is not valid.\n")
30+
raise AttributeError(f"[{dt.now().isocalendar()}] Either no TOOL_RUN environment variable available, or '{toolname}' is not valid.\n")

0 commit comments

Comments
 (0)