@@ -29,6 +29,42 @@ make collect
29
29
# we need a make save-state here as we need current_state.json for make collection
30
30
# state from s3 should be named something like historical_state.json
31
31
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
+
32
68
echo Build the collection database
33
69
make collection # we will read from current_state.json here
34
70
0 commit comments