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.
166
-
if [[ $(TODAY)-gt (shell date -d "$(LAST_SATURDAY) +3 day" +"%Y-%m-%d") &&-f$(LAST_SUNDAY)-weekly-weights.done ]];then \
167
-
# Get list of start dates (Sunday) of weekly weights files.
168
-
MAX_WEEKLY_WEIGHTED=`$(MAX_WEEKLY_WEIGHTED)`;\
169
-
EXPECTED_MAX_WEEKLY_WEIGHTED=$(LAST_SUNDAY);\
170
-
if [[ $$EXPECTED_MAX_WEEKLY_WEIGHTED -gt$$MAX_WEEKLY_WEIGHTED ]];then \
171
-
MSG="Expected most recent weekly weights file to start on: $$EXPECTED_MAX_WEEKLY_WEIGHTED; Actual most recent file starts on: $$MAX_WEEKLY_WEIGHTED";\
172
-
echo"WARNING: $${MSG}">>$(MESSAGES);\
173
-
fi
174
-
fi
175
-
# If any new files are downloaded, run weekly weights pipeline for last week.
176
-
if [[ (wc -w <<<$${NEW}) -gt 0 ]];then \
177
-
# The earliest new weekly weights file should be for last week.
178
-
MIN_NEW_WEEKLY_WEIGHTED=grep map <<<$${NEW}| head -1 | sed 's/_.*//;s/-//g;'
179
-
EXPECTED_NEW_WEEKLY_WEIGHTED=$(LAST_SUNDAY);\
180
-
if [[ $$EXPECTED_NEW_WEEKLY_WEIGHTED -ne$$MIN_NEW_WEEKLY_WEIGHTED ]];then \
181
-
MSG="Expected new weekly weights file to start on: $$EXPECTED_NEW_WEEKLY_WEIGHTED; Actual new file starts on: $$MIN_NEW_WEEKLY_WEIGHTED";\
182
-
echo"WARNING: $${MSG}">>$(MESSAGES);\
183
-
fi
184
-
# Save existing params file from normal daily run.
185
-
if [ -f params.json ];then cp params.json params.daily.json;fi
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 \
189
+
if [ -f params.json ]; then cp params.json params.daily.json; fi; \
0 commit comments