-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_targets.mk
61 lines (46 loc) · 1.92 KB
/
main_targets.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
$(call log.debug, COOKBOOK BEGIN INCLUDE: cookbook/main_targets.mk)
###############################################################################
# MAIN PROCESSING TARGETS
# Core targets for newspaper processing pipeline
###############################################################################
# TARGET: newspaper
#: Process a single newspaper run by the processing pipeline
# Dependencies:
# - sync: Ensures data is synchronized
# - processing-target: Performs the actual processing
newspaper: | $(BUILD_DIR)
$(MAKE) sync
$(MAKE) processing-target
PHONY_TARGETS += newspaper
help::
@echo " newspaper # Process a single newspaper run by the processing pipeline"
# TARGET: all
# Complete processing with fresh data sync
# Steps:
# 1. Resync data (serial)
# 2. Process data (parallel)
all:
$(MAKE) -j 1 sync-input resync-output
$(MAKE) -j $(MAKE_PARALLEL_PROCESSING_NEWSPAPER_YEAR) --max-load $(MACHINE_MAX_LOAD) processing-target
sleep 3
PHONY_TARGETS += all
# TARGET: collection
#: Process multiple newspapers with specified parallel processing
# Uses xargs for parallel execution with PARALLEL_NEWSPAPERS limit
collection-xargs: newspaper-list-target
tr " " "\n" < $(NEWSPAPERS_TO_PROCESS_FILE) | \
xargs -n 1 -P $(PARALLEL_NEWSPAPERS) -I {} \
$(MAKE) NEWSPAPER={} -k --max-load $(MACHINE_MAX_LOAD) all
collection: newspaper-list-target
tr " " "\n" < $(NEWSPAPERS_TO_PROCESS_FILE) | \
parallel --jobs $(PARALLEL_NEWSPAPERS) --load $(MACHINE_MAX_LOAD) \
"$(MAKE) NEWSPAPER={} -k --max-load $(MACHINE_MAX_LOAD) all; sleep 3"
help::
@echo " collection # Process multiple newspapers with specified parallel processing"
# Alternative implementation using GNU parallel
# collection: newspaper-list-target
# cat $(NEWSPAPERS_TO_PROCESS_FILE) | \
# parallel -j $(PARALLEL_NEWSPAPERS) \
# "$(MAKE) NEWSPAPER={} all"
PHONY_TARGETS += collection
$(call log.debug, COOKBOOK END INCLUDE: cookbook/main_targets.mk)