You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Expect weights for last week to be available if more than 3 days after the end of last week and output files for last week have not yet been created.
176
-
if [[ $(TODAY) -gt $(TUESDAY) && ! -f $(LAST_SUNDAY)-weekly-weights.done ]]; then \
177
-
# Get list of start dates (Sunday) of weekly weights files.
178
-
MAX_WEEKLY_WEIGHTED=`$(MAX_WEEKLY_WEIGHTED)`; \
179
-
EXPECTED_MAX_WEEKLY_WEIGHTED="$(LAST_SUNDAY)"; \
180
-
if [[ $$MAX_WEEKLY_WEIGHTED -lt $$EXPECTED_MAX_WEEKLY_WEIGHTED ]]; then \
181
-
MSG="Weekly weights are old; Expected most recent weekly weights file to start on: $$EXPECTED_MAX_WEEKLY_WEIGHTED; Actual most recent file starts on: $$MAX_WEEKLY_WEIGHTED"; \
182
-
echo "WARNING: $${MSG}" >> $(MESSAGES); \
183
-
fi; \
184
-
fi
185
-
# If any new files are downloaded, run weekly weights pipeline for last week.
186
-
if [[ $(wc -w <<< $${NEW}) -gt 0 ]]; then \
187
-
# The earliest new weekly weights file should be for last week.
188
-
MIN_NEW_WEEKLY_WEIGHTED=`grep map <<< $${NEW} | head -1 | sed 's/_.*//;s/-//g;'`; \
189
-
EXPECTED_NEW_WEEKLY_WEIGHTED="$(LAST_SUNDAY)"; \
190
-
if [[ $$EXPECTED_NEW_WEEKLY_WEIGHTED -ne $$MIN_NEW_WEEKLY_WEIGHTED ]]; then \
191
-
MSG="Expected new weekly weights file to start on: $$EXPECTED_NEW_WEEKLY_WEIGHTED; Actual new file starts on: $$MIN_NEW_WEEKLY_WEIGHTED"; \
192
-
echo "WARNING: $${MSG}" >> $(MESSAGES); \
193
-
fi; \
194
-
# Save existing params file from normal daily run.
MIN_NEW_WEEKLY_WEIGHTED=`grep map <<< $${NEW} | head -1 | sed 's/_.*//;s/-//g;'`; \
179
+
if [[ `wc -w <<< $${NEW}` -gt 0 ]] && [[ $$MIN_NEW_WEEKLY_WEIGHTED -ne $$EXPECTED_WEEKLY_WEIGHTED ]]; then \
180
+
MSG="Expected new weekly weights files to start on: $$EXPECTED_WEEKLY_WEIGHTED; Actual new files starts on: $$MIN_NEW_WEEKLY_WEIGHTED"; \
181
+
echo "WARNING: $${MSG}" >> $(MESSAGES); \
182
+
fi; \
183
+
MAX_WEEKLY_WEIGHTED=`$(MAX_WEEKLY_WEIGHTED)`; \
184
+
if [[ `date --date='$(TODAY)' +'%Y%m%d'` -gt `date --date='$(TUESDAY)' +'%Y%m%d'` ]] && [[ $$MAX_WEEKLY_WEIGHTED -lt $$EXPECTED_WEEKLY_WEIGHTED ]]; then \
185
+
MSG="Weekly weights are old; Expected most recent weekly weights file to start on: $$EXPECTED_WEEKLY_WEIGHTED; Actual most recent file starts on: $$MAX_WEEKLY_WEIGHTED"; \
186
+
echo "WARNING: $${MSG}" >> $(MESSAGES); \
187
+
fi; \
188
+
if [[ ! -f tidy_weekly/$(LAST_SUNDAY)-weekly-weights.done ]] && [[ $$MAX_WEEKLY_WEIGHTED -eq $$EXPECTED_WEEKLY_WEIGHTED ]]; then \
195
189
if [ -f params.json ]; then cp params.json params.daily.json; fi; \
196
190
$(MAKE) weekly-weights-pipeline; \
197
-
rm -f params.json; \
198
-
# Restore params file from normal daily run.
199
-
if [ -f params.daily.json ]; then mv params.daily.json params.json; fi; \
0 commit comments