Skip to content

Commit c1e9fc0

Browse files
author
Alan Christie
committed
- Adds DATASET_EXTRA_VARIABLES notes
- Updates TESTING to illustrate extra-vars and failure tests
1 parent d492499 commit c1e9fc0

5 files changed

Lines changed: 38 additions & 10 deletions

File tree

RULES.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,19 @@ Images...
9595
10. If `DT_DATASET_OUTPUT_FORMAT` is set, the environment variable
9696
`DT_DATASET_OUTPUT_FILENAME` will be set, i.e. 'data.sdf.gz'
9797
If the output file ends '.gz' the output must be compressed (using gzip)
98-
11. **Must** expect the input and output directories to contain pre-existing
98+
11. The formatter **Must** expect `DT_DATASET_EXTRA_VARIABLES` to be set.
99+
The text present is expected to be supported by the formatter having been
100+
supplied through the REST API when the Dataset was first uploaded.
101+
12. **Must** expect the input and output directories to contain pre-existing
99102
files
100-
12. **Must not** remove or over-write any files present in the input or
103+
13. **Must not** remove or over-write any files present in the input or
101104
output directories
102-
13. **Should not** expect to be called to perform a file conversion for
105+
14. **Should not** expect to be called to perform a file conversion for
103106
a dataset that's already been converted successfully.
104-
14. **Should** expect to be limited to no more than 1 CPU core ane no
107+
15. **Should** expect to be limited to no more than 1 CPU core ane no
105108
more than 1GiB of memory. Importantly, exceeding the memory limit will
106109
result in the container being terminated
107-
15. **Must** use a non-zero exit code to indicate an unrecoverable failure
110+
16. **Must** use a non-zero exit code to indicate an unrecoverable failure
108111

109112
---
110113

TESTING.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ normally be created by the DataTier Manager, we can run a specific test...
3131

3232
Here we apply our test/success/**1** dataset to the container...
3333

34+
$ export TEST_TYPE=success
3435
$ export TEST_DIR=1
3536
$ export DATASET_FILENAME=dummy.txt
36-
$ mkdir -p test/success/${TEST_DIR}/output
37+
$ export DATASET_EXTRA_VARIABLES="x=1"
38+
$ mkdir -p test/${TEST_TYPE}/${TEST_DIR}/output
39+
$ IMAGE_NAME=${PWD##*/} docker-compose up
40+
41+
Or we can run tests based on files in the failure branch of the test tree
42+
with...
43+
44+
$ export TEST_TYPE=failure
45+
$ export TEST_DIR=1
46+
$ export DATASET_FILENAME=dummy.txt
47+
$ export DATASET_EXTRA_VARIABLES="x=1"
48+
$ mkdir -p test/${TEST_TYPE}/${TEST_DIR}/output
3749
$ IMAGE_NAME=${PWD##*/} docker-compose up

docker-compose.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#
99
# - DATASET_FILENAME (default 'dummy.txt')
1010
# - IMAGE_NAME (default 'formatter')
11+
# - DATASET_EXTRA_VARIABLES (default '')
12+
# - TEST_TYPE (default 'success')
1113
# - TEST_DIR (default '1')
1214
#
1315
# See TESTING.md
@@ -20,8 +22,9 @@ services:
2022
- DT_DATASET_FILENAME=${DATASET_FILENAME:-dummy.txt}
2123
- DT_DATASET_INPUT_PATH=/dataset/input
2224
- DT_DATASET_OUTPUT_PATH=/dataset/output
25+
- DT_DATASET_EXTRA_VARIABLES=${DATASET_EXTRA_VARIABLES}
2326
volumes:
24-
- ${PWD}/test/success/${TEST_DIR:-1}:/dataset
27+
- ${PWD}/test/${TEST_TYPE:-success}/${TEST_DIR:-1}:/dataset
2528
deploy:
2629
resources:
2730
limits:

docker-entrypoint.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,30 @@
66
# Refer to RULES.md for comprehensive format support rules,
77
# summarised below...
88
#
9+
# Formatting rules
10+
# ----------------
911
# 1. The environment variable `DT_DATASET_FILENAME` will be set to
1012
# a string value representing the filename of the dataset.
11-
# i.e. 'data.sdf.gz'. If compressed it wil end with '.gz'.
13+
# i.e. 'data.sdf'. The formatters will not be presented with compressed
14+
# files.
1215
# 2. The environment variable `DT_DATASET_INPUT_PATH` will be
1316
# a directory you can find the file defined in part 1
1417
# 3. The environment variable `DT_DATASET_OUTPUT_PATH` will be
1518
# a directory you can write to
1619
# 4. The output path may not be empty, and the image must be aware of this
1720
# possibility. The container must not remove any files (from the input or
1821
# or output directory).
22+
# 5. If available, additional format variables will be presented, as text,
23+
# in the variable `DT_DATASET_EXTRA_VARIABLES`.
1924
#
20-
# 5. The optional environment variable `DT_DATASET_OUTPUT_FORMAT` will be set
25+
# Conversion
26+
# ----------
27+
# As well as the above, when called upon to change file formats...
28+
#
29+
# 1. The optional environment variable `DT_DATASET_OUTPUT_FORMAT` will be set
2130
# if a file format conversion, rather than data loading, is to be performed.
2231
# This is expected be a MIME type supported by the image
23-
# 6. If `DT_DATASET_OUTPUT_FORMAT` is set, the environment variable
32+
# 2. If `DT_DATASET_OUTPUT_FORMAT` is set, the environment variable
2433
# `DT_DATASET_OUTPUT_FILENAME` will be set, i.e. 'data.sdf.gz'.
2534
# The conversion process simply checks whether the filename ends '.gz'
2635
# to determine whether compression (gzip) is required. The file must be

test/failure/1/input/dummy.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A dummy test file

0 commit comments

Comments
 (0)