88
99from enum import Enum
1010
11- from digital_land .state import compare_state
12-
1311
1412class ProcessingOption (Enum ):
1513 PROCESS_ALL = "all"
@@ -25,46 +23,47 @@ def dataset_path(dataset):
2523 return "$(DATASET_DIR)" + dataset + ".csv"
2624
2725
28- def get_processing_option (
29- collection ,
30- specification_dir ,
31- pipeline_dir ,
32- resource_dir ,
33- incremental_loading_override ,
34- state_path ,
35- ):
36- # If there's no previous state, process everything
37- if not state_path :
38- return ProcessingOption .PROCESS_ALL
39-
40- # Compare current state with the previous state
41- diffs = compare_state (
42- specification_dir ,
43- collection .dir ,
44- pipeline_dir ,
45- resource_dir ,
46- incremental_loading_override ,
47- state_path ,
48- )
49-
50- diffs = diffs or [] # handle if diffs is None
51-
52- # If incremental loading is overridden or critical configs changed, process everything
53- critical_changes = {"code" , "pipeline" , "collection" , "specification" }
54- if incremental_loading_override or critical_changes & set (diffs ):
55- return ProcessingOption .PROCESS_ALL
56-
57- # New resources downloaded
58- if "resource" in diffs :
59- return (
60- ProcessingOption .PROCESS_PARTIAL
61- ) # To be changed to partial in the future
62-
63- if not diffs :
64- return ProcessingOption .PROCESS_NONE
65-
66- # If there are diffs we don't recognise then play safe and reprocess everything
67- return ProcessingOption .PROCESS_ALL
26+ # TODO remove function when confirmed not needed
27+ # def get_processing_option(
28+ # collection,
29+ # specification_dir,
30+ # pipeline_dir,
31+ # resource_dir,
32+ # incremental_loading_override,
33+ # state_path,
34+ # ):
35+ # # If there's no previous state, process everything
36+ # if not state_path:
37+ # return ProcessingOption.PROCESS_ALL
38+
39+ # # Compare current state with the previous state
40+ # diffs = compare_state(
41+ # specification_dir,
42+ # collection.dir,
43+ # pipeline_dir,
44+ # resource_dir,
45+ # incremental_loading_override,
46+ # state_path,
47+ # )
48+
49+ # diffs = diffs or [] # handle if diffs is None
50+
51+ # # If incremental loading is overridden or critical configs changed, process everything
52+ # critical_changes = {"code", "pipeline", "collection", "specification"}
53+ # if incremental_loading_override or critical_changes & set(diffs):
54+ # return ProcessingOption.PROCESS_ALL
55+
56+ # # New resources downloaded
57+ # if "resource" in diffs:
58+ # return (
59+ # ProcessingOption.PROCESS_PARTIAL
60+ # ) # To be changed to partial in the future
61+
62+ # if not diffs:
63+ # return ProcessingOption.PROCESS_NONE
64+
65+ # # If there are diffs we don't recognise then play safe and reprocess everything
66+ # return ProcessingOption.PROCESS_ALL
6867
6968
7069def pipeline_makerules (
@@ -76,14 +75,14 @@ def pipeline_makerules(
7675 state_path = None ,
7776):
7877 dataset_resource = collection .dataset_resource_map ()
79- process = get_processing_option (
80- collection ,
81- specification_dir ,
82- pipeline_dir ,
83- resource_dir ,
84- incremental_loading_override ,
85- state_path ,
86- )
78+ # process = get_processing_option(
79+ # collection,
80+ # specification_dir,
81+ # pipeline_dir,
82+ # resource_dir,
83+ # incremental_loading_override,
84+ # state_path,
85+ # )
8786
8887 redirect = {}
8988 for entry in collection .old_resource .entries :
@@ -104,14 +103,14 @@ def pipeline_makerules(
104103 print ("\\ \n %s" % (transformed_path (resource , dataset )), end = "" )
105104 print ()
106105
107- if process == ProcessingOption .PROCESS_NONE :
108- print ("\n $(%s)::" % dataset_var )
109- print ('\t echo "No state change and no new resources to transform"' )
110- print ("\n transformed::" )
111- print ('\t echo "No state change and no new resources to transform"' )
112- print ("\n dataset::" )
113- print ('\t echo "No state change so no resources have been transformed"' )
114- continue
106+ # if process == ProcessingOption.PROCESS_NONE:
107+ # print("\n$(%s)::" % dataset_var)
108+ # print('\techo "No state change and no new resources to transform"')
109+ # print("\ntransformed::")
110+ # print('\techo "No state change and no new resources to transform"')
111+ # print("\ndataset::")
112+ # print('\techo "No state change so no resources have been transformed"')
113+ # continue
115114
116115 for resource in sorted (dataset_resource [dataset ]):
117116 old_resource = resource
0 commit comments