-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.deals-named-clients
22 lines (16 loc) · 1.17 KB
/
Makefile.deals-named-clients
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Worker
#
NAMED_CLIENT_HOURLY_TOTALS_DATES_DIRS := $(wildcard $(OUTPUT_DEALS_DIR)/deals/by_client_name/aggr_hourly/json/clientName=$(NAMED_CLIENT)/date=*)
NAMED_CLIENT_HOURLY_TOTALS_DATES := $(subst date=,,$(notdir $(NAMED_CLIENT_HOURLY_TOTALS_DATES_DIRS)))
NAMED_CLIENT_DIST_HOURLY_TOTALS := $(addsuffix .json,$(addprefix $(WORK_DIR)/dist/deals/named-clients/$(NAMED_CLIENT)/hourly/,$(NAMED_CLIENT_HOURLY_TOTALS_DATES)))
named-clients-hourly-totals-worker: $(WORK_DIR)/dist/deals/named-clients/$(NAMED_CLIENT)/hourly/dates.json $(NAMED_CLIENT_DIST_HOURLY_TOTALS)
@echo Worker: $(NAMED_CLIENT)
$(WORK_DIR)/dist/deals/named-clients/$(NAMED_CLIENT)/hourly/dates.json: $(NAMED_CLIENT_HOURLY_TOTALS_DATES_DIRS)
mkdir -p $(dir $@)
(for f in $(NAMED_CLIENT_HOURLY_TOTALS_DATES); do echo \"$$f\"; done) | jq -s 'sort' > $@
.SECONDEXPANSION:
$(NAMED_CLIENT_DIST_HOURLY_TOTALS): $(WORK_DIR)/dist/deals/named-clients/$(NAMED_CLIENT)/hourly/%.json: $$(wildcard $(OUTPUT_DEALS_DIR)/deals/by_client_name/aggr_hourly/json/clientName=$(NAMED_CLIENT)/date=%/part-*.json)
@echo $@
@mkdir -p $(WORK_DIR)/dist/deals/named-clients/$(NAMED_CLIENT)/hourly
@cat $^ | jq -s 'sort_by(.window.start)' > $@