Skip to content

Commit 253efc8

Browse files
move incremental override logic for test
1 parent 7433ab1 commit 253efc8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

task/run.sh

+36
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ make collect
2929
# we need a make save-state here as we need current_state.json for make collection
3030
# state from s3 should be named something like historical_state.json
3131

32+
if [ "$INCREMENTAL_LOADING_OVERRIDE" = "True" ]; then
33+
echo Incremental loading disabled as override flag is set.
34+
else
35+
if [ -n "$COLLECTION_DATASET_BUCKET_NAME" ]; then
36+
make load-state
37+
if [ -f "state.json" ]; then
38+
digital-land check-state \
39+
--specification-dir=specification \
40+
--collection-dir=collection \
41+
--pipeline-dir=pipeline \
42+
--resource-dir=collection/resource \
43+
--incremental-override=$INCREMENTAL_LOADING_OVERRIDE \
44+
--state-path=state.json \
45+
&& { \
46+
echo "Incremental loading enabled. Saving log.csv and resource.csv to $COLLECTION_DATASET_BUCKET_NAME."; \
47+
make save-collection-log-resource; \
48+
echo "No state change and no new resources. Stopping processing."; \
49+
# Generate a new state file and upload to s3
50+
rm -f state.json; \
51+
make state.json; \
52+
make save-state; \
53+
exit 0; \
54+
}; \
55+
else \
56+
echo "No state.json found."; \
57+
fi
58+
59+
# Generate a new state file
60+
# We will have to move this earlier in the future
61+
rm -f state.json
62+
make state.json
63+
else
64+
echo "No COLLECTION_DATASET_BUCKET_NAME defined to get previous state.json"
65+
fi
66+
fi
67+
3268
echo Build the collection database
3369
make collection # we will read from current_state.json here
3470

0 commit comments

Comments
 (0)