def delete_html(self, data_set, url_id): result_local = Result.Ok() result_s3 = Result.Ok() if self.html_stored_local(data_set): result_local = self.delete_html_local(data_set, url_id) if self.html_stored_s3(data_set): # pragma: no cover result_s3 = self.delete_html_s3(data_set, url_id) return Result.Combine([result_local, result_s3])
def sync_down_to_local(app, year, file_type, data_set): """Sync files from S3 bucket to local folder.""" data_sets_int = sum(int(ds) for ds in flatten_list2d(data_set)) result_dict = SyncDataNoPromptsTask(app).execute( sync_direction=SyncDirection.DOWN_TO_LOCAL, year=year, file_type=file_type, data_sets_int=data_sets_int, ) result = Result.Combine(list(result_dict.values())) if os.environ.get("ENV") != "TEST": # pragma: no cover pause(message="\nPress any key to continue...") return exit_app(app, result)
def save_combined_game_data(self, combined_data): local_filepath = None s3_object_key = None result_local = Result.Ok() result_s3 = Result.Ok() if self.json_stored_local_folder(VigFile.COMBINED_GAME_DATA, DataSet.ALL): result_local = self.save_combined_game_data_local_file(combined_data) if result_local.success: local_filepath = result_local.value if self.json_stored_s3(VigFile.COMBINED_GAME_DATA, DataSet.ALL): # pragma: no cover result_s3 = self.save_combined_game_data_s3(combined_data) if result_s3.success: s3_object_key = result_s3.value result = Result.Combine([result_local, result_s3]) if result.failure: return result return Result.Ok({"local_filepath": local_filepath, "s3_object_key": s3_object_key})
def save_json(self, data_set, parsed_data): local_filepath = None s3_object_key = None result_local = Result.Ok() result_s3 = Result.Ok() if self.json_stored_local_folder(VigFile.PARSED_JSON, data_set): result_local = self.save_json_local(data_set, parsed_data) if result_local.success: local_filepath = result_local.value if self.json_stored_s3(VigFile.PARSED_JSON, data_set): # pragma: no cover result_s3 = self.save_json_s3(data_set, parsed_data) if result_s3.success: s3_object_key = result_s3.value result = Result.Combine([result_local, result_s3]) if result.failure: return result return Result.Ok({"local_filepath": local_filepath, "s3_object_key": s3_object_key})
def save_html(self, data_set, url_id, html): local_filepath = None s3_object_key = None result_local = Result.Ok() result_s3 = Result.Ok() if self.html_stored_local(data_set): result_local = self.save_html_local(data_set, url_id, html) if result_local.success: local_filepath = result_local.value if self.html_stored_s3(data_set): # pragma: no cover result_s3 = self.save_html_s3(data_set, url_id, html) if result_s3.success: s3_object_key = result_s3.value result = Result.Combine([result_local, result_s3]) if result.failure: return result return Result.Ok({ "local_filepath": local_filepath, "s3_object_key": s3_object_key })