seanpedrickcase commited on
Commit
818efbc
·
1 Parent(s): 1418017

Corrected RUN_AWS_FUNCTIONS environment variable reference when downloading cost codes

Browse files
Files changed (2) hide show
  1. app.py +5 -3
  2. tools/config.py +1 -1
app.py CHANGED
@@ -648,7 +648,8 @@ with app:
648
 
649
  # If relevant environment variable is set, load in the default allow list file from S3 or locally. Even when setting S3 path, need to local path to give a download location
650
  if GET_DEFAULT_ALLOW_LIST == "True" and (ALLOW_LIST_PATH or S3_ALLOW_LIST_PATH):
651
- if not os.path.exists(ALLOW_LIST_PATH) and S3_ALLOW_LIST_PATH and RUN_AWS_FUNCTIONS == 1:
 
652
  app.load(download_file_from_s3, inputs=[s3_default_bucket, s3_default_allow_list_file, default_allow_list_output_folder_location]).\
653
  success(load_in_default_allow_list, inputs = [default_allow_list_output_folder_location], outputs=[in_allow_list])
654
  print("Successfully loaded allow list from S3")
@@ -658,8 +659,9 @@ with app:
658
  else: print("Could not load in default allow list")
659
 
660
  # If relevant environment variable is set, load in the default cost code file from S3 or locally
661
- if GET_COST_CODES == "True" and (COST_CODES_PATH or S3_COST_CODES_PATH):
662
- if not os.path.exists(COST_CODES_PATH) and S3_COST_CODES_PATH and RUN_AWS_FUNCTIONS == 1:
 
663
  app.load(download_file_from_s3, inputs=[s3_default_bucket, s3_default_cost_codes_file, default_cost_codes_output_folder_location]).\
664
  success(load_in_default_cost_codes, inputs = [default_cost_codes_output_folder_location, default_cost_code_textbox], outputs=[cost_code_dataframe, cost_code_dataframe_base, cost_code_choice_drop])
665
  print("Successfully loaded cost codes from S3")
 
648
 
649
  # If relevant environment variable is set, load in the default allow list file from S3 or locally. Even when setting S3 path, need to local path to give a download location
650
  if GET_DEFAULT_ALLOW_LIST == "True" and (ALLOW_LIST_PATH or S3_ALLOW_LIST_PATH):
651
+ if not os.path.exists(ALLOW_LIST_PATH) and S3_ALLOW_LIST_PATH and RUN_AWS_FUNCTIONS == "1":
652
+ print("Downloading allow list from S3")
653
  app.load(download_file_from_s3, inputs=[s3_default_bucket, s3_default_allow_list_file, default_allow_list_output_folder_location]).\
654
  success(load_in_default_allow_list, inputs = [default_allow_list_output_folder_location], outputs=[in_allow_list])
655
  print("Successfully loaded allow list from S3")
 
659
  else: print("Could not load in default allow list")
660
 
661
  # If relevant environment variable is set, load in the default cost code file from S3 or locally
662
+ if GET_COST_CODES == "True" and (COST_CODES_PATH or S3_COST_CODES_PATH):
663
+ if not os.path.exists(COST_CODES_PATH) and S3_COST_CODES_PATH and RUN_AWS_FUNCTIONS == "1":
664
+ print("Downloading cost codes from S3")
665
  app.load(download_file_from_s3, inputs=[s3_default_bucket, s3_default_cost_codes_file, default_cost_codes_output_folder_location]).\
666
  success(load_in_default_cost_codes, inputs = [default_cost_codes_output_folder_location, default_cost_code_textbox], outputs=[cost_code_dataframe, cost_code_dataframe_base, cost_code_choice_drop])
667
  print("Successfully loaded cost codes from S3")
tools/config.py CHANGED
@@ -237,7 +237,7 @@ else: OUTPUT_ALLOW_LIST_PATH = 'config/default_allow_list.csv'
237
 
238
  SHOW_COSTS = get_or_create_env_var('SHOW_COSTS', 'False')
239
 
240
- GET_COST_CODES = get_or_create_env_var('GET_COST_CODES', 'True')
241
 
242
  DEFAULT_COST_CODE = get_or_create_env_var('DEFAULT_COST_CODE', '')
243
 
 
237
 
238
  SHOW_COSTS = get_or_create_env_var('SHOW_COSTS', 'False')
239
 
240
+ GET_COST_CODES = get_or_create_env_var('GET_COST_CODES', 'False')
241
 
242
  DEFAULT_COST_CODE = get_or_create_env_var('DEFAULT_COST_CODE', '')
243