Skip to content

Commit

Permalink
Merge pull request #108 from kbase/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jkbaumohl authored Mar 16, 2023
2 parents 0ceab07 + b0dc0f2 commit 9246355
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
32 changes: 28 additions & 4 deletions source/monthly_cron_jobs/get_downloaders_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def pull_downloading_jobs(downloaders_set, problem_refs_lookup):
earliest_year = 2016
today = date.today()
current_year = int(today.year)
part_of_year_list = (1,2,3,4)
part_of_year_list = (1,2,3,4,5,6,7,8,9,10,11,12)

years_to_do = range(earliest_year,(current_year + 1))

Expand All @@ -162,15 +162,39 @@ def pull_downloading_jobs(downloaders_set, problem_refs_lookup):
for part_of_year in part_of_year_list:
if part_of_year == 1:
begin = int(datetime(year_to_do, 1, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 3, 31, 23, 59).timestamp()) * 1000
end = int(datetime(year_to_do, 1, 31, 23, 59).timestamp()) * 1000
elif part_of_year == 2:
begin = int(datetime(year_to_do, 2, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 3, 1, 23, 59).timestamp()) * 1000
elif part_of_year == 3:
begin = int(datetime(year_to_do, 3, 2, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 3, 31, 23, 59).timestamp()) * 1000
elif part_of_year == 4:
begin = int(datetime(year_to_do, 4, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 4, 30, 23, 59).timestamp()) * 1000
elif part_of_year == 5:
begin = int(datetime(year_to_do, 5, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 5, 31, 23, 59).timestamp()) * 1000
elif part_of_year == 6:
begin = int(datetime(year_to_do, 6, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 6, 30, 23, 59).timestamp()) * 1000
elif part_of_year == 3:
elif part_of_year == 7:
begin = int(datetime(year_to_do, 7, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 7, 31, 23, 59).timestamp()) * 1000
elif part_of_year == 8:
begin = int(datetime(year_to_do, 8, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 8, 30, 23, 59).timestamp()) * 1000
elif part_of_year == 9:
begin = int(datetime(year_to_do, 9, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 9, 30, 23, 59).timestamp()) * 1000
else:
elif part_of_year == 10:
begin = int(datetime(year_to_do, 10, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 10, 31, 23, 59).timestamp()) * 1000
elif part_of_year == 11:
begin = int(datetime(year_to_do, 11, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 11, 30, 23, 59).timestamp()) * 1000
elif part_of_year == 12:
begin = int(datetime(year_to_do, 12, 1, 0, 0).timestamp()) * 1000
end = int(datetime(year_to_do, 12, 31, 23, 59).timestamp()) * 1000

yearly_start_time = time.time()
Expand Down
4 changes: 2 additions & 2 deletions source/monthly_cron_jobs/methods_upload_doi_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def upload_doi_externally_derived_data(doi_results_map, ws_owners_lookup):

doi_total_downloads_statement = ("select count(*) as total_downloads from "
"(select distinct downloaded_ws_obj_id, job_id "
"from copy_doi_unique_downloads where doi_ws_id = %s);")
"from copy_doi_unique_downloads where doi_ws_id = %s) tdl;")

doi_total_unique_download_users = (
"select count(*) from (select distinct downloader_username from copy_doi_unique_downloads where doi_ws_id = %s) as user_count;")
Expand Down Expand Up @@ -829,7 +829,7 @@ def upload_doi_externally_derived_data(doi_results_map, ws_owners_lookup):

doi_total_downloads_statement = ("select count(*) as total_downloads from "
"(select distinct downloaded_ws_obj_id, job_id "
"from doi_unique_downloads where doi_ws_id = %s);")
"from doi_unique_downloads where doi_ws_id = %s) tdl;")

doi_total_unique_download_users = (
"select count(*) from (select distinct downloader_username from doi_unique_downloads where doi_ws_id = %s) as user_count;")
Expand Down

0 comments on commit 9246355

Please sign in to comment.