Skip to content

Commit

Permalink
Merge pull request #166 from shikshalokam/release-5.1.0
Browse files Browse the repository at this point in the history
Uncommented cloud upload part.
  • Loading branch information
aks30 authored Dec 22, 2023
2 parents b9a0d86 + cb0ae4d commit 28d2ea9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions urgent_data_metrics/imp_project_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
config.read(config_path[0] + "/config.ini")
sys.path.append(config.get("COMMON", "cloud_module_path"))

# from cloud import MultiCloud
from cloud import MultiCloud

# cloud_init = MultiCloud()
cloud_init = MultiCloud()
formatter = logging.Formatter('%(asctime)s - %(levelname)s')

successLogger = logging.getLogger('success log')
Expand Down Expand Up @@ -188,6 +188,7 @@ def searchEntities(url,ids_list):
response = requests.request("POST", url, headers=headers, data=payload)
delta_ids = []
entity_name_mapping = {}

if response.status_code == 200:
# convert the response to dictionary
response = response.json()
Expand All @@ -207,6 +208,7 @@ def searchEntities(url,ids_list):
else :
delta_ids = ids_list
# if there are missing data , fetch the data from mongo

if len(delta_ids) > 0 :
# aggregate mongo query to fetch data from mongo
delta_loc = projectsCollec.aggregate([
Expand Down Expand Up @@ -255,9 +257,8 @@ def searchEntities(url,ids_list):
# add delta entities to master variable
for index in delta_loc:
entity_name_mapping[index['userProfile']["userLocations"]['id']] = index['userProfile']["userLocations"]['name']
return entity_name_mapping
else:
return False

return entity_name_mapping

except Exception as e:
errorLogger.error(e,exc_info=True)
Expand Down Expand Up @@ -368,7 +369,7 @@ def searchEntities(url,ids_list):
os.rename(f'{path}' + f'{result[0]}', f'{path}' + 'data.csv')

# Uploading file to Cloud
# cloud_init.upload_to_cloud(blob_Path = blob_path, local_Path = local_path, file_Name = 'data.csv')
cloud_init.upload_to_cloud(blob_Path = blob_path, local_Path = local_path, file_Name = 'data.csv')

print("file got uploaded to Cloud.")
print("DONE")
Expand Down

0 comments on commit 28d2ea9

Please sign in to comment.